Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jul 2013 01:11:52 +0200
From:      Robert Millan <rmh@freebsd.org>
To:        freebsd-fs@freebsd.org
Subject:   Compatibility options for mount(8)
Message-ID:  <CAOfDtXM_KJeLLUcsFA0EZOC8ZgSjKiLKuGeeNPQKCcZwcaJbCQ@mail.gmail.com>

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

[-- Attachment #1 --]
Hi,

On Debian GNU/kFreeBSD, we've been using these bits of glue to make
FreeBSD mount a bit more compatible with the Linux version of mount.

We found that this occasionally helps when porting software that needs
to use those features and relies on Linux semantics:

  - Ignore "-n" flag, since it requests not to update /etc/mtab, which
we never do anyway.

  - Map "-o remount" to its FreeBSD equivalent, "-o update".

I'd like to check in the attached patch. Please have a look!

Thanks

--
Robert Millan

[-- Attachment #2 --]
Index: sbin/mount/mount.c
===================================================================
--- sbin/mount/mount.c	(revision 252490)
+++ sbin/mount/mount.c	(working copy)
@@ -253,7 +253,7 @@
 	options = NULL;
 	vfslist = NULL;
 	vfstype = "ufs";
-	while ((ch = getopt(argc, argv, "adF:fLlo:prt:uvw")) != -1)
+	while ((ch = getopt(argc, argv, "adF:fLlo:prt:uvwn")) != -1)
 		switch (ch) {
 		case 'a':
 			all = 1;
@@ -274,6 +274,9 @@
 		case 'l':
 			late = 1;
 			break;
+		case 'n':
+			/* For compatibility with the Linux version of mount. */
+			break;
 		case 'o':
 			if (*optarg) {
 				options = catopt(options, optarg);
@@ -771,6 +774,11 @@
 			} else if (strncmp(p, groupquotaeq,
 			    sizeof(groupquotaeq) - 1) == 0) {
 				continue;
+			} else if (strcmp(p, "remount") == 0) {
+				/* For compatibility with the Linux version of mount. */
+				append_arg(a, strdup("-o"));
+				append_arg(a, strdup("update"));
+				continue;
 			} else if (*p == '-') {
 				append_arg(a, p);
 				p = strchr(p, '=');

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