[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
This commit is contained in:
Nick Hibma 2007-02-20 21:29:30 +00:00
parent 1253fe1ead
commit 35ce0ff2f2
2 changed files with 23 additions and 4 deletions

View File

@ -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

View File

@ -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);