diff options
author | n_hibma <n_hibma@FreeBSD.org> | 2007-02-20 21:29:30 +0000 |
---|---|---|
committer | n_hibma <n_hibma@FreeBSD.org> | 2007-02-20 21:29:30 +0000 |
commit | afe986e40e5a80d1dd3c4eae1b177256368b58e3 (patch) | |
tree | f9afa1e354020f31392d1c18654ccf7957cf6fbd | |
parent | 4a1dbd81cb62d9e8df40cb9c8307c08f4e42bd28 (diff) | |
download | FreeBSD-src-afe986e40e5a80d1dd3c4eae1b177256368b58e3.zip FreeBSD-src-afe986e40e5a80d1dd3c4eae1b177256368b58e3.tar.gz |
[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
-rw-r--r-- | sbin/mdconfig/mdconfig.8 | 12 | ||||
-rw-r--r-- | sbin/mdconfig/mdconfig.c | 15 |
2 files changed, 23 insertions, 4 deletions
diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 3de3af8..0f99357 100644 --- a/sbin/mdconfig/mdconfig.8 +++ b/sbin/mdconfig/mdconfig.8 @@ -101,7 +101,11 @@ becomes the backingstore for this memory disk. Swap space is used to back this memory disk. .El .It Fl f Ar file -Filename to use for the vnode type memory disk. +Filename to use for the vnode type memory disk. Options +.Fl a +and +.Fl t Ar vnode +are implied if not specified. .It Fl l List configured devices. If given with @@ -118,7 +122,11 @@ is the number of 512 byte sectors unless suffixed with a or .Cm t which -denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. +denotes byte, kilobyte, megabyte, gigabyte and terabyte respectively. Options +.Fl a +and +.Fl t Ar malloc +are implied if not specified. .It Fl S Ar sectorsize Sectorsize to use for malloc backed device. .It Fl x Ar sectors/track diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index 4fc580c..068aaba 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); |