allow to set ffs options with command-line -o

XXX: can't mix puffs and ffs options in one -o foo,bar
This commit is contained in:
pooka 2007-08-27 23:15:26 +00:00
parent a1bb1e3040
commit 396d174477
1 changed files with 22 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ffs.c,v 1.3 2007/08/14 15:56:16 pooka Exp $ */
/* $NetBSD: ffs.c,v 1.4 2007/08/27 23:15:26 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -39,6 +39,21 @@
#include "p2k.h"
/* XXX: figure out a proper way to share code/integrate with mount_ffs */
static const struct mntopt ffsmopts[] = {
MOPT_STDOPTS,
MOPT_ASYNC,
MOPT_SYNC,
MOPT_UPDATE,
MOPT_RELOAD,
MOPT_NOATIME,
MOPT_NODEVMTIME,
MOPT_FORCE,
MOPT_SOFTDEP,
MOPT_GETARGS,
MOPT_NULL,
};
static void
usage(void)
{
@ -55,14 +70,18 @@ main(int argc, char *argv[])
int rv, ch;
setprogname(argv[0]);
getmnt_silent = 1;
mntflags = pflags = 0;
while ((ch = getopt(argc, argv, "o:")) != -1) {
switch (ch) {
case 'o':
mp = getmntopts(optarg, puffsmopts, &mntflags, &pflags);
if (mp == NULL)
err(1, "getmntops");
if (mp == NULL) {
mp = getmntopts(optarg, ffsmopts, &mntflags, 0);
if (mp == NULL)
err(1, "getmntops");
}
freemntopts(mp);
break;
default: