Add ignore option to mount

Andreas Hauser andy at splashground.de
Sat Jun 10 06:59:05 PDT 2006


Hoi,

this patch adds an 'ignore' option to mount.
The actual infrustructure is already in place (MNT_IGNORE)
but it can't be set.
This means df(1) already has code to ignore MNT_IGNORE mounts
and an option to also show ignored mounts (-a), but the user
currently can't set the ignored option.
Below patch fixes that.
This is useful for procfs, amd, nullfs, filebacked fs, etc.
To test it with procfs you also need to recompile mount_std(8).
Use a fstab entry like:
proc   /proc           procfs  rw,ignore       0       0

Some systems call the option 'hidden', but i don't think it
is semantically any better (both aren't very good), but at least
'ignore' corresponds to the MNT_IGNORE flag.

-- 
Andy

diff -r 9bff3c77bbfb bin/df/df.1
--- a/bin/df/df.1	Sat Jun 03 10:41:26 2006 +0000
+++ b/bin/df/df.1	Sat Jun 10 13:02:49 2006 +0200
@@ -67,8 +67,9 @@ The following options are available:
 The following options are available:
 .Bl -tag -width Ds
 .It Fl a
-Show all mount points, including those that were mounted with the MNT_IGNORE
-flag.
+Show all mount points, including those that were mounted with the
+.Cm ignore
+option.
 .It Fl b
 Use 512-byte blocks rather than the default.  Note that
 this overrides the
diff -r 9bff3c77bbfb sbin/mount/mntopts.h
--- a/sbin/mount/mntopts.h	Sat Jun 03 10:41:26 2006 +0000
+++ b/sbin/mount/mntopts.h	Sat Jun 10 13:02:49 2006 +0200
@@ -57,6 +57,7 @@ struct mntopt {
 #define MOPT_NOCLUSTERR		{ "clusterr",	1, MNT_NOCLUSTERR, 0 }
 #define MOPT_NOCLUSTERW		{ "clusterw",	1, MNT_NOCLUSTERW, 0 }
 #define MOPT_SUIDDIR		{ "suiddir",	0, MNT_SUIDDIR, 0 }
+#define MOPT_IGNORE		{ "ignore",	0, MNT_IGNORE, 0 }
 
 /* Control flags. */
 #define MOPT_FORCE		{ "force",	0, MNT_FORCE, 0 }
@@ -89,7 +90,8 @@ struct mntopt {
 	MOPT_RDONLY,							\
 	MOPT_UNION,							\
 	MOPT_NOCLUSTERR,						\
-	MOPT_NOCLUSTERW
+	MOPT_NOCLUSTERW,						\
+	MOPT_IGNORE
 
 void getmntopts(const char *, const struct mntopt *, int *, int *);
 void rmslashes(char *, char *);
diff -r 9bff3c77bbfb sbin/mount/mount.8
--- a/sbin/mount/mount.8	Sat Jun 03 10:41:26 2006 +0000
+++ b/sbin/mount/mount.8	Sat Jun 10 13:02:49 2006 +0200
@@ -214,6 +214,9 @@ If those operations fail due to a non-ex
 If those operations fail due to a non-existent file the underlying
 directory is then accessed.
 All creates are done in the mounted filesystem.
+.It Cm ignore
+Will be ignored by
+.Xr df 1 .
 .El
 .Pp
 Any additional options specific to a filesystem type that is not
@@ -368,6 +371,7 @@ In this case, the above error message ca
 In this case, the above error message can also mean that you did not
 have permission to load the module.
 .Sh SEE ALSO
+.Xr df 1 ,
 .Xr mount 2 ,
 .Xr vfsload 3 ,
 .Xr fstab 5 ,
diff -r 9bff3c77bbfb sbin/mount/mount.c
--- a/sbin/mount/mount.c	Sat Jun 03 10:41:26 2006 +0000
+++ b/sbin/mount/mount.c	Sat Jun 10 13:02:49 2006 +0200
@@ -99,6 +99,7 @@ static struct opt {
 	{ MNT_NOCLUSTERW,	"noclusterw" },
 	{ MNT_SUIDDIR,		"suiddir" },
 	{ MNT_SOFTDEP,		"soft-updates" },
+	{ MNT_IGNORE,		"ignore" },
 	{ 0, NULL }
 };
 
@@ -715,6 +716,7 @@ flags2opts(int flags)
 	if (flags & MNT_NOCLUSTERW)	res = catopt(res, "noclusterw");
 	if (flags & MNT_NOSYMFOLLOW)	res = catopt(res, "nosymfollow");
 	if (flags & MNT_SUIDDIR)	res = catopt(res, "suiddir");
+	if (flags & MNT_IGNORE)		res = catopt(res, "ignore");
 
 	return res;
 }
diff -r 9bff3c77bbfb sbin/mount/mount_ufs.c
--- a/sbin/mount/mount_ufs.c	Sat Jun 03 10:41:26 2006 +0000
+++ b/sbin/mount/mount_ufs.c	Sat Jun 10 13:02:49 2006 +0200
@@ -58,6 +58,7 @@ static struct mntopt mopts[] = {
 	MOPT_FORCE,
 	MOPT_SYNC,
 	MOPT_UPDATE,
+	MOPT_IGNORE,
 	MOPT_NULL
 };
 





More information about the Submit mailing list