Busybox[PATCH] for mount.c - enable fsc as a mount option for NFS

Denys Vlasenko vda.linux at googlemail.com
Mon May 18 08:17:08 UTC 2009


> Hi Denys,
>
> In looking at this I first hacked up a very quick hard-coded test to
> only pass the mount string to the kernel for an NFS3 setup, and
> according to bloatcheck the resulting busybox binary shrank by ~56
> kilobytes,

Kilobytes? Can you send me the patch and .config you saw this on?

> which is a nice saving indeed. Except by handling the
> choice between binary or string mounts at run-time instead (the
> uname() sys-call via the KERNEL_VERSION() macro looks ideal),
> everything can only get bigger.
>
> Personally, I'd prefer making this a compile setting instead -
> obviously, with error checking etc.,

People may copy mount binary to 2.4-based machine, and then
it will fail there. They can even move it to older 2.6 machine,
and it will fail. Bad PR :D ;)

I think 2.4 is not old enough to disregard that.

> the savings won't be quite that
> big in the end, but they should still be appreciable. I was thinking
> of adding a Makefile flag and a #define somewhere allowing me to write
> code like this:
>
> #if CURRENT_LINUX_VERSION >= LINUX_VERSION(2,6,23):
>    nfs_string_mount()
> #else
>    nfs_binary_mount()
> #endif
>
> This would enable other checks in the code to be done at compile-time,
> leading to savings generally. I'd also want to break the nfs mounting
> out into a separate file, which is going to be desirable when adding
> NFS4 support.
>
> Would this be acceptable, or would (as another alternative) a
> menuconfig setting (Binary NFS mount call vs String NFS mount call) be
> more preferable for you? Are there other examples that I should look
> at?

I still think runtime check is better than smaller code size.
If you really need to exclude that code, add CONFIG_xxx
as _optional_ way to exclude binary NFS mount machinery
(CONFIG_xxx help text should explain which kernels are safe
to use it on), but let people be able to have mount applet
which works on both newer and older kernels.
--
vda


More information about the busybox mailing list