[PATCH] Add -t noproc,tmpfs options to mount/umount
Natanael Copa
natanael.copa at gmail.com
Wed Apr 4 10:56:40 PDT 2007
On Wed, 2007-04-04 at 18:10 +0100, Roy Marples wrote:
> Hi List
>
> I'm busy working on baselayout-2, Gentoo's init system. One of the
> goals is to allow busybox to be used as a default shell.
>
> This requires the use of the -t fstype option for mount/umount, which
> the attached patch allows. Both umount.c and mount.c statically define
> the match_fstype function, which is probably a little bloatly, but I'm
> unsure of the busybox build system and where would be a good
> alternative to put it. Pointers welcome :)
>
> Thanks
>
> Roy
>
>
>
>
>
>
> differences
> between files
> attachment
> (busybox-mount-types.patch)
>
> diff -ur busybox-1.5.0.orig/util-linux/mount.c
> busybox-1.5.0/util-linux/mount.c
> --- busybox-1.5.0.orig/util-linux/mount.c 2007-03-22
> 20:21:39.000000000 +0000
> +++ busybox-1.5.0/util-linux/mount.c 2007-04-04 17:25:37.000000000
> +0100
> @@ -77,6 +77,7 @@
> {"defaults", 0},
> /* {"quiet", 0}, - do not filter out, vfat wants to
> see it */
> {"noauto", MOUNT_NOAUTO},
> + {"sw", MOUNT_SWAP},
> {"swap", MOUNT_SWAP},
> USE_DESKTOP({"user", MOUNT_USERS},)
> USE_DESKTOP({"users", MOUNT_USERS},)
> @@ -1528,6 +1529,33 @@
> return rc;
> }
>
> +static int match_fstype (struct mntent *mt, const char *fstype)
> +{
> + bool no = false;
> + char *fst, *p, *token;
> + int retval = 0;
> +
> + if (!mt || ! fstype)
> + return -1;
> +
> + fst = p = xstrdup (fstype);
> + if (strlen (p) > 2 && p[0] == 'n' && p[1] == 'o') {
> + no = true;
> + p += 2;
> + }
Shouldn't the test for 'no...' be done on the token inside the look
below? mount -t nonfs,noshm,ext3,no...
> +
> + while ((token = strsep (&p, ","))) {
> + if (strcmp (token, mt->mnt_type) == 0) {
> + if (! no)
> + retval = 0;
> + break;
> + }
> + }
Will this really work? seems like only time the func returns anything
else but 0 is when either mt or fstype is NULL.
> +
> + free (fst);
> + return (retval);
> +}
> +
> // Parse options, if necessary parse fstab/mtab, and call singlemount
> for
> // each directory to be mounted.
More information about the busybox
mailing list