Thanks for the extra debug code. 

The difference in messages is due to the ENABLE_DESKTOP define in swaponoff.c.
It's the actual status = swapon(device, 0) call just after this check, that is 
causing the error repost.
BusyBox's swaponoff.c doesn't report a problem.

I need to look deeper into swapon, and also possibly mkswap and dd too.


Ubidyne GmbH
Lise-Meitner-Straße 14
D-89081 Ulm

mail      [EMAIL PROTECTED]
web       www.ubidyne.com
 
Registered office: Ulm
District court of Ulm: HRB 5295
Managing Directors:
Dipl. Ing. Ken Hawk
Dipl. Ing. Beat Müller
Dr. Clemens Rheinfelder

-----Original Message-----
From: Denys Vlasenko [mailto:[EMAIL PROTECTED] 
Sent: 26 March 2008 21:21
To: [email protected]
Cc: Jonathan Moore
Subject: Re: v1.10.0 swapon: swapfile has holes - blocksize ?

On Wednesday 26 March 2008 18:24, Jonathan Moore wrote:
> I quickly downloaded and built BusyBox v1.10.0. But it still gave the same 
> "hole" problem. See below.
> 
> Are there any debug flags I can turn on ? I'll start going through the 
> documentation. I'm relatively new to BusyBox, and I'm wondering if I'm just 
> missing something out required to create a swapfile.
> 
> I made BusyBox using the following commands:
> 
> make defconfig
> export ARCH=powerpc
> export CROSS_COMPILE=ppc_6xx-
> PATH=$PATH:/home/jm0069/ws/MCU/MCU_dev/MCU/Tools/ELDK/usr/bin/
> make
> 
> /var/tmp $ dd if=/dev/zero of=swapfile bs=1M count=20
> 20+0 records in
> 20+0 records out
> /var/tmp $ ls -l
> -rw-r--r--    1 root     0        20971520 Jan  2 08:31 swapfile
> /var/tmp $ mkswap swapfile
> Setting up swapspace version 1, size = 20967424 bytes /var/tmp $ 
> swapon swapfile
> swapon: swapfile has holes   <==========================
> swapon: swapfile: Invalid argument

Remember this messages! Now, read on.

> /var/tmp $ swapon --help
> BusyBox v1.10.0 (2008-03-26 17:58:17 CET) multi-call binary
> 
> Usage: swapon [-a] [DEVICE]
> 
> Start swapping on DEVICE
> 
> Options:
>         -a      Start swapping on all swap devices

I'm sorry, but this is untrue.

# cd busybox-1.10.0
# grep -r 'holes' .
./util-linux/swaponoff.c:     /* test for holes */
./util-linux/swaponoff.c:               bb_error_msg("warning: swap file has 
holes");
./e2fsprogs/old_e2fsprogs/ext2fs/ext2fs.h: * to deal with files that contain 
"holes".
./e2fsprogs/old_e2fsprogs/e2fsck.c:                blkaddr pattern looks right 
(all non-holes up to

Look closely. In 1.10.0, message is "swap file has holes".
"swap file", not "swapfile". Also there is word "warning", so that user knows 
that unless swapon() call fails, it is not an error (merely warning).

Your message is different. How is that possible?

You can obtain more data by adding this message:

        if (S_ISREG(st.st_mode))
{
bb_error_msg("blocks %lld size %%lld", (unsigned long long)st.st_blocks, 
(unsigned long long)st.st_size);
                if (st.st_blocks * (off_t)512 < st.st_size)
                        bb_error_msg("warning: swap file has holes"); }

--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to