summaryrefslogtreecommitdiffstats
path: root/sbin/mdconfig
diff options
context:
space:
mode:
authoryar <yar@FreeBSD.org>2003-04-01 15:23:55 +0000
committeryar <yar@FreeBSD.org>2003-04-01 15:23:55 +0000
commit5f9d93b08dc52cc46df0c0935575163741ef4092 (patch)
tree1eca69a9634d0178880c2766077fd06fa76dae33 /sbin/mdconfig
parentc235e25328c6cf4b9091f38d9c18db15764df594 (diff)
downloadFreeBSD-src-5f9d93b08dc52cc46df0c0935575163741ef4092.zip
FreeBSD-src-5f9d93b08dc52cc46df0c0935575163741ef4092.tar.gz
Give clearer diagnostics on some cases of invalid
combinations of mdconfig(8) command-line arguments. Make mdconfig(8) accept "-a -f file -o options" equally with "-a -f file" (assuming "-t vnode".)
Diffstat (limited to 'sbin/mdconfig')
-rw-r--r--sbin/mdconfig/mdconfig.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 8ead3ad..2f0049b 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -105,6 +105,7 @@ main(int argc, char **argv)
/* Imply ``-t vnode'' */
mdio.md_type = MD_VNODE;
mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS;
+ cmdline = 2;
}
mdio.md_file = optarg;
break;
@@ -176,12 +177,17 @@ main(int argc, char **argv)
&& (mdio.md_type == MD_MALLOC || mdio.md_type == MD_SWAP))
if (mdio.md_size == 0)
errx(1, "must specify -s for -t malloc or -t swap");
+ if (cmdline == 2 && mdio.md_type == MD_VNODE)
+ if (mdio.md_file == NULL)
+ errx(1, "must specify -f for -t vnode");
if (action == LIST) {
if (mdio.md_options & MD_AUTOUNIT)
list(fd);
else
query(fd, mdio.md_unit);
} else if (action == ATTACH) {
+ if (cmdline < 2)
+ usage();
i = ioctl(fd, MDIOCATTACH, &mdio);
if (i < 0)
err(1, "ioctl(/dev/%s)", MDCTL_NAME);
OpenPOWER on IntegriCloud