Module Name:    src
Committed By:   dholland
Date:           Mon Jun  7 21:44:35 UTC 2021

Modified Files:
        src/sbin/mount_chfs: mount_chfs.8 mount_chfs.c

Log Message:
Teach mount_chfs to understand -o. From Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sbin/mount_chfs/mount_chfs.8
cvs rdiff -u -r1.3 -r1.4 src/sbin/mount_chfs/mount_chfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/mount_chfs/mount_chfs.8
diff -u src/sbin/mount_chfs/mount_chfs.8:1.4 src/sbin/mount_chfs/mount_chfs.8:1.5
--- src/sbin/mount_chfs/mount_chfs.8:1.4	Mon Sep 12 00:38:42 2016
+++ src/sbin/mount_chfs/mount_chfs.8	Mon Jun  7 21:44:35 2021
@@ -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

Index: src/sbin/mount_chfs/mount_chfs.c
diff -u src/sbin/mount_chfs/mount_chfs.c:1.3 src/sbin/mount_chfs/mount_chfs.c:1.4
--- src/sbin/mount_chfs/mount_chfs.c:1.3	Fri Jun  4 22:41:36 2021
+++ src/sbin/mount_chfs/mount_chfs.c	Mon Jun  7 21:44:35 2021
@@ -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();

Reply via email to