Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Jul 2013 20:42:24 -0700
From:      Kirk McKusick <mckusick@mckusick.com>
To:        Robert Millan <rmh@freebsd.org>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: Compatibility options for mount(8) 
Message-ID:  <201307020342.r623gOTv012017@chez.mckusick.com>
In-Reply-To: <CAOfDtXM_KJeLLUcsFA0EZOC8ZgSjKiLKuGeeNPQKCcZwcaJbCQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> Date: Tue, 2 Jul 2013 01:11:52 +0200
> Subject: Compatibility options for mount(8)
> From: Robert Millan <rmh@freebsd.org>
> To: freebsd-fs@freebsd.org
> 
> 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.

Your proposed changes look reasonable to me. Some comments below.
Also you need to update the manual page for mount to document these
two changes lest someone be surprised or confused.

> 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".

It is shorter to remap it to "-u" which is shorthand for "-o update".

> I'd like to check in the attached patch. Please have a look!
> 
> Thanks
> 
> --
> Robert Millan
> 
> 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)

Our coding style is to sort the options into alphabetical order.
So the "n" option should be between "l" and "o".

>  		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;

As noted above, I would recoomend using "-u".

>  			} else if (*p == '-') {
>  				append_arg(a, p);
>  				p = strchr(p, '=');

	Kirk McKusick



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