From owner-freebsd-fs@FreeBSD.ORG Tue Jul 2 03:42:28 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id C61F314B; Tue, 2 Jul 2013 03:42:28 +0000 (UTC) (envelope-from mckusick@mckusick.com) Received: from chez.mckusick.com (chez.mckusick.com [IPv6:2001:5a8:4:7e72:4a5b:39ff:fe12:452]) by mx1.freebsd.org (Postfix) with ESMTP id A75141268; Tue, 2 Jul 2013 03:42:28 +0000 (UTC) Received: from chez.mckusick.com (localhost [127.0.0.1]) by chez.mckusick.com (8.14.3/8.14.3) with ESMTP id r623gOTv012017; Mon, 1 Jul 2013 20:42:24 -0700 (PDT) (envelope-from mckusick@chez.mckusick.com) Message-Id: <201307020342.r623gOTv012017@chez.mckusick.com> To: Robert Millan Subject: Re: Compatibility options for mount(8) In-reply-to: Date: Mon, 01 Jul 2013 20:42:24 -0700 From: Kirk McKusick Cc: freebsd-fs@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jul 2013 03:42:28 -0000 > Date: Tue, 2 Jul 2013 01:11:52 +0200 > Subject: Compatibility options for mount(8) > From: Robert Millan > 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