Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 1995 17:19:40 -0700 (PDT)
From:      "Rodney W. Grimes" <rgrimes@gndrsh.aac.dev.com>
To:        simon@masi.ibp.fr
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: patch adding the 'noauto' switch to 'mount'
Message-ID:  <199508080019.RAA01843@gndrsh.aac.dev.com>
In-Reply-To: <199508071209.OAA00200@neuromancer.ibp.fr> from "simon@masi.ibp.fr" at Aug 7, 95 02:09:31 pm

next in thread | previous in thread | raw e-mail | index | archive | help

> 
> 
> Hi,
> 
> I just got fed up with my DOS partition being mounted automatically
> at boot time, so I wrote a patch which enables the use of the 'noauto' 
> flag in /etc/fstab.
> 
> For example:	 /dev/sd0s2              /dos    msdos rw,noauto 0 0
...

Patch has a rather serious bug in it.  DO NOT APPLY THIS PATCH TO ANY
RUNNING SYSTEM.

> 
> 
> --- /usr/include/sys/mount.h.old	Sun Aug  6 14:57:33 1995
> +++ /usr/include/sys/mount.h	Sun Aug  6 13:18:34 1995
> @@ -147,6 +147,7 @@
>   */
>  #define	MNT_RDONLY	0x00000001	/* read only filesystem */
>  #define	MNT_SYNCHRONOUS	0x00000002	/* file system written synchronously */
> +#define 	MNT_NOAUTO	0x00000003	/* don't mount with 'mount -a' */

WRONG VALUE!!!  These are bit fields, not integers.  MNT_NOAUTO is now
the same as -o ro,sync :-(.  MNT_NOAUTO does _not_ belong on in this
set of bit patterns, the kernel could care less about this!  We are also
out of bits for some structures that try to store this value :-(.


>  #define	MNT_NOEXEC	0x00000004	/* can't exec from filesystem */
>  #define	MNT_NOSUID	0x00000008	/* don't honor setuid bits on fs */
>  #define	MNT_NODEV	0x00000010	/* don't interpret special files */
> 
> 
> 
> diff -urN /usr/src/sbin/mount.old/mntopts.h /usr/src/sbin/mount/mntopts.h
> --- /usr/src/sbin/mount.old/mntopts.h	Sun Aug  6 14:45:30 1995
> +++ /usr/src/sbin/mount/mntopts.h	Sun Aug  6 14:54:49 1995
> @@ -42,6 +42,7 @@
>  
>  /* User-visible MNT_ flags. */
>  #define MOPT_ASYNC		{ "async",	0, MNT_ASYNC, 0 }
> +#define MOPT_NOAUTO		{ "auto",	1, MNT_NOAUTO, 0 }
>  #define MOPT_NODEV		{ "dev",	1, MNT_NODEV, 0 }
>  #define MOPT_NOEXEC		{ "exec",	1, MNT_NOEXEC, 0 }
>  #define MOPT_NOSUID		{ "suid",	1, MNT_NOSUID, 0 }
> @@ -68,6 +69,7 @@
>  /* Standard options which all mounts can understand. */
>  #define MOPT_STDOPTS							\
>  	MOPT_FSTAB_COMPAT,						\
> +	MOPT_NOAUTO,							\
>  	MOPT_NODEV,							\
>  	MOPT_NOEXEC,							\
>  	MOPT_NOSUID,							\
> diff -urN /usr/src/sbin/mount.old/mount.c /usr/src/sbin/mount/mount.c
> --- /usr/src/sbin/mount.old/mount.c	Sun Aug  6 14:45:40 1995
> +++ /usr/src/sbin/mount/mount.c	Sun Aug  6 14:55:53 1995
> @@ -84,6 +84,7 @@
>  	{ MNT_ASYNC,		"asynchronous" },
>  	{ MNT_EXPORTED,		"NFS exported" },
>  	{ MNT_LOCAL,		"local" },
> +	{ MNT_NOAUTO,		"noauto" },
>  	{ MNT_NODEV,		"nodev" },
>  	{ MNT_NOEXEC,		"noexec" },
>  	{ MNT_NOSUID,		"nosuid" },
> @@ -166,10 +167,12 @@
>  					continue;
>  				if (badvfsname(fs->fs_vfstype, vfslist))
>  					continue;
> +				if (!strstr(fs->fs_mntops, "noauto")) {
>  				if (mountfs(fs->fs_vfstype, fs->fs_spec,
> -				    fs->fs_file, init_flags, options,
> -				    fs->fs_mntops))
> -					rval = 1;
> +			    		fs->fs_file, init_flags, options,
> +				    	fs->fs_mntops))
> +						rval = 1;
> +				}
>  			}
>  		else {
>  			if ((mntsize = getmntinfo(&mntbuf, MNT_NOWAIT)) == 0)
> 
> 
> 
> 


-- 
Rod Grimes                                      rgrimes@gndrsh.aac.dev.com
Accurate Automation Company                 Reliable computers for FreeBSD



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508080019.RAA01843>