Teach mount_chfs to understand -o. From Andrius V.

This commit is contained in:
dholland 2021-06-07 21:44:35 +00:00
parent c83e65e698
commit 976049247d
2 changed files with 32 additions and 4 deletions

View File

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

View File

@ -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();