Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/mount_chfs Teach mount_chfs to understand -o. From Andr...



details:   https://anonhg.NetBSD.org/src/rev/a1378cc2ffb5
branches:  trunk
changeset: 379571:a1378cc2ffb5
user:      dholland <dholland%NetBSD.org@localhost>
date:      Mon Jun 07 21:44:35 2021 +0000

description:
Teach mount_chfs to understand -o. From Andrius V.

diffstat:

 sbin/mount_chfs/mount_chfs.8 |  19 +++++++++++++++++--
 sbin/mount_chfs/mount_chfs.c |  17 +++++++++++++++--
 2 files changed, 32 insertions(+), 4 deletions(-)

diffs (86 lines):

diff -r aa01c4809803 -r a1378cc2ffb5 sbin/mount_chfs/mount_chfs.8
--- a/sbin/mount_chfs/mount_chfs.8      Mon Jun 07 20:27:59 2021 +0000
+++ b/sbin/mount_chfs/mount_chfs.8      Mon Jun 07 21:44:35 2021 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount_chfs.8,v 1.4 2016/09/12 00:38:42 sevan Exp $
+.\" $NetBSD: mount_chfs.8,v 1.5 2021/06/07 21:44:35 dholland Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd September 12, 2016
+.Dd June 7, 2021
 .Dt MOUNT_CHFS 8
 .Os
 .Sh NAME
@@ -41,6 +41,21 @@ For regular block devices like SSD drive
 please use a regular file system.
 The file system will be created during the first mount.
 CHFS stands for Chip File System.
+.Pp
+This command is normally executed by
+.Xr mount 8
+at boot time.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl o
+Options are specified with a
+.Fl o
+flag followed by a comma-separated string of options.
+See the
+.Xr mount 8
+man page for possible options and their meanings.
+.El
 .Sh EXAMPLES
 .Dl mount_chfs /dev/flash0 /mnt
 .Sh SEE ALSO
diff -r aa01c4809803 -r a1378cc2ffb5 sbin/mount_chfs/mount_chfs.c
--- a/sbin/mount_chfs/mount_chfs.c      Mon Jun 07 20:27:59 2021 +0000
+++ b/sbin/mount_chfs/mount_chfs.c      Mon Jun 07 21:44:35 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mount_chfs.c,v 1.3 2021/06/04 22:41:36 riastradh Exp $ */
+/*     $NetBSD: mount_chfs.c,v 1.4 2021/06/07 21:44:35 dholland Exp $  */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -53,6 +53,12 @@
 #include "mountprog.h"
 #include "mount_chfs.h"
 
+static const struct mntopt mopts[] = {
+       MOPT_STDOPTS,
+       MOPT_GETARGS,
+       MOPT_NULL,
+};
+
 /* --------------------------------------------------------------------- */
 
 static void    usage(void) __dead;
@@ -64,6 +70,7 @@ mount_chfs_parseargs(int argc, char *arg
     int *mntflags, char *canon_dev, char *canon_dir)
 {
        int ch;
+       mntoptparse_t mp;
        struct stat sb;
 
        /* Set default values for mount point arguments. */
@@ -72,8 +79,14 @@ mount_chfs_parseargs(int argc, char *arg
 
        optind = optreset = 1;
 
-       while ((ch = getopt(argc, argv, "i:")) != -1) {
+       while ((ch = getopt(argc, argv, "o:")) != -1) {
                switch (ch) {
+               case 'o':
+                       mp = getmntopts(optarg, mopts, mntflags, 0);
+                       if (mp == NULL)
+                               err(1, "getmntopts");
+                       freemntopts(mp);
+                       break;
                case '?':
                default:
                        usage();



Home | Main Index | Thread Index | Old Index