Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Aug 1995 14:09:31 +0200 (MET DST)
From:      simon@masi.ibp.fr
To:        freebsd-hackers@FreeBSD.ORG
Subject:   patch adding the 'noauto' switch to 'mount'
Message-ID:  <199508071209.OAA00200@neuromancer.ibp.fr>

next 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

This flag prevents a filesystem from being mounted when a 'mount -a' occurs.
It works for every kind of fs , since it's defined as a standard 
mount option. 

Just apply the patch, and don't forget to rebuild all the mount_xxx commands. 

Enjoy !

		Julien

-- 
http://www-masi.ibp.fr/~Julien.Simon


---------------------------------------------------------------------------


--- /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' */
 #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)






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