From 976049247df70f8605ef662c8ff363f33e864bcc Mon Sep 17 00:00:00 2001 From: dholland Date: Mon, 7 Jun 2021 21:44:35 +0000 Subject: [PATCH] Teach mount_chfs to understand -o. From Andrius V. --- sbin/mount_chfs/mount_chfs.8 | 19 +++++++++++++++++-- sbin/mount_chfs/mount_chfs.c | 17 +++++++++++++++-- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/sbin/mount_chfs/mount_chfs.8 b/sbin/mount_chfs/mount_chfs.8 index da9f644ad9d3..80be4a000487 100644 --- a/sbin/mount_chfs/mount_chfs.8 +++ b/sbin/mount_chfs/mount_chfs.8 @@ -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 drives or USB drives, 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 --git a/sbin/mount_chfs/mount_chfs.c b/sbin/mount_chfs/mount_chfs.c index 12eb6aab9ca0..64b156497ad2 100644 --- a/sbin/mount_chfs/mount_chfs.c +++ b/sbin/mount_chfs/mount_chfs.c @@ -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 *argv[], struct ufs_args *args, 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 *argv[], struct ufs_args *args, 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();