When FEATURE_MOUNT_HELPERS is enabled, mount should support the -i option, which prevents calling the helper function. This is used by FUSE: it installs fusermount as a helper, and if it's configured to update /etc/mtab then it does so by calling 'mount -i -f' (i.e. don't call helper, fake the system call, but do update mtab). I believe this is a fairly standard thing for mount helpers to want to do (why should they include code to update mtab when mount can do it for them?) and so I think it's worth supporting by default when mount helpers are enabled.
mount also ought to pass through the -f and -n options to helpers as necessary, since they may reasonably want to attempt to handle them. util-linux mount does this. Zero bloatcheck impact with defconfig. With FEATURE_MOUNT_HELPERS additionally enabled: function old new delta mount_it_now 293 332 +39 packed_usage 25845 25863 +18 .rodata 125771 125789 +18 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 75/0) Total: 75 bytes Signed-off-by: Colin Watson <[email protected]> --- include/usage.h | 3 +++ util-linux/mount.c | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/include/usage.h b/include/usage.h index 0f6378e..75f3e86 100644 --- a/include/usage.h +++ b/include/usage.h @@ -2901,6 +2901,9 @@ "\n -f Dry run" \ ) \ ) \ + IF_FEATURE_MOUNT_HELPERS( \ + "\n -i Don't call mount helper" \ + ) \ IF_FEATURE_MTAB_SUPPORT( \ "\n -n Don't update /etc/mtab" \ ) \ diff --git a/util-linux/mount.c b/util-linux/mount.c index ab24964..274e6bb 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -90,6 +90,12 @@ enum { #define fakeIt 0 #endif +#if ENABLE_FEATURE_MOUNT_HELPERS +#define externalAllowed (!(option_mask32 & OPT_i)) +#else +#define externalAllowed 0 +#endif + // TODO: more "user" flag compatibility. // "user" option (from mount manpage): @@ -414,11 +420,15 @@ static int mount_it_now(struct mntent *mp, long vfsflags, char *filteropts) // If mount failed, try // helper program mount.<mnt_type> - if (ENABLE_FEATURE_MOUNT_HELPERS && rc) { - char *args[6]; + if (externalAllowed && rc) { + char *args[8]; int errno_save = errno; args[0] = xasprintf("mount.%s", mp->mnt_type); rc = 1; + if (fakeIt) + args[rc++] = (char *)"-f"; + if (ENABLE_FEATURE_MTAB_SUPPORT && !useMtab) + args[rc++] = (char *)"-n"; args[rc++] = mp->mnt_fsname; args[rc++] = mp->mnt_dir; if (filteropts) { -- 1.6.3.1 _______________________________________________ busybox mailing list [email protected] http://lists.busybox.net/mailman/listinfo/busybox
