aboutsummaryrefslogtreecommitdiff
path: root/sbin/mdconfig/mdconfig.c
diff options
context:
space:
mode:
authorNick Hibma <n_hibma@FreeBSD.org>2007-02-20 21:29:30 +0000
committerNick Hibma <n_hibma@FreeBSD.org>2007-02-20 21:29:30 +0000
commit35ce0ff2f20a35997c4be1a87f034651df7da71c (patch)
treef9afa1e354020f31392d1c18654ccf7957cf6fbd /sbin/mdconfig/mdconfig.c
parent1253fe1ead6043e8757fcdc0d00f78320a9e9704 (diff)
downloadsrc-35ce0ff2f20a35997c4be1a87f034651df7da71c.tar.gz
src-35ce0ff2f20a35997c4be1a87f034651df7da71c.zip
[Found the original diff I made, see previous commit for other part]
Assume '-a' and '-t malloc' flags for '-s <size>' (malloc ramdisk) if not specified. Reviewed by: phk (some time ago) MFC: 1 week
Notes
Notes: svn path=/head/; revision=166853
Diffstat (limited to 'sbin/mdconfig/mdconfig.c')
-rw-r--r--sbin/mdconfig/mdconfig.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c
index 4fc580c115f8..068aaba64a0a 100644
--- a/sbin/mdconfig/mdconfig.c
+++ b/sbin/mdconfig/mdconfig.c
@@ -130,8 +130,6 @@ main(int argc, char **argv)
cmdline=2;
break;
case 'f':
- if (cmdline != 0 && cmdline != 1 && cmdline != 2)
- usage();
if (cmdline == 0) {
action = ATTACH;
cmdline = 1;
@@ -142,6 +140,8 @@ main(int argc, char **argv)
mdio.md_options = MD_CLUSTER | MD_AUTOUNIT | MD_COMPRESS;
cmdline = 2;
}
+ if (cmdline != 2)
+ usage();
if (realpath(optarg, mdio.md_file) == NULL) {
err(1, "could not find full path for %s",
optarg);
@@ -194,6 +194,17 @@ main(int argc, char **argv)
mdio.md_sectorsize = strtoul(optarg, &p, 0);
break;
case 's':
+ if (cmdline == 0) {
+ /* Imply ``-a'' */
+ action = ATTACH;
+ cmdline = 1;
+ }
+ if (cmdline == 1) {
+ /* Imply ``-t malloc'' */
+ mdio.md_type = MD_MALLOC;
+ mdio.md_options = MD_AUTOUNIT | MD_COMPRESS;
+ cmdline = 2;
+ }
if (cmdline != 2)
usage();
mdio.md_mediasize = (off_t)strtoumax(optarg, &p, 0);