diff --git a/sbin/mdconfig/mdconfig.8 b/sbin/mdconfig/mdconfig.8 index 3de3af8d0bb7..0f993575aa1e 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 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);