Fwd: swapon and swapoff testcases on busybox

Denis Vlasenko vda.linux at googlemail.com
Wed Mar 14 22:56:54 UTC 2007


On Wednesday 14 March 2007 09:31, Bernhard Fischer wrote:
> On Tue, Mar 13, 2007 at 10:22:13PM +0000, Luciano Miguel Ferreira Rocha wrote:
> >On Tue, Mar 13, 2007 at 10:10:05PM +0100, Denis Vlasenko wrote:
> >> Hi
> >> 
> >> On Tuesday 13 March 2007 08:44, Riaz Rahaman wrote:
> >> > BTW..the bb swaponoff file checks for the condition (st.st_blocks * 512 <
> >> > st.st_size) and gives a message if the swap file has holes...now do we
> >> > require this check in the busybox? can bb not call the swapon syscall from
> >> > swaponoff code..swapon syscall also seems to be doing the check.
> >> 
> >> I removed that check.
> >
> >It was better with the check. Swap file with holes isn't supported by
> >linux, and that check would give the correct error message, instead of
> >the cryptic "invlaid argument".
> 
> seconded. OTOH it's a pure cosmetic issue and we try to be small, so the
> check may be considered a bit of bloat since an elaborate error is
> likely to be found in the error-logs nonetheless:
> bad_bmap:
>         printk(KERN_ERR "swapon: swapfile has holes\n");
>         ret = -EINVAL;

#if ENABLE_DESKTOP
        /* test for holes */
        if (S_ISREG(st.st_mode))
                if (st.st_blocks * 512 < st.st_size)
                        bb_error_msg("warning: swap file has holes");
#endif

should make everyone happy. We do not exit, just in case
we are wrong and kernel will actually decide to successfully
enable swap.
--
vda



More information about the busybox mailing list