aboutsummaryrefslogtreecommitdiff
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
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
-rw-r--r--sbin/mdconfig/mdconfig.812
-rw-r--r--sbin/mdconfig/mdconfig.c15
2 files changed, 23 insertions, 4 deletions
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);