summaryrefslogtreecommitdiffstats
path: root/sbin/mdmfs
diff options
context:
space:
mode:
authordd <dd@FreeBSD.org>2006-01-02 01:50:30 +0000
committerdd <dd@FreeBSD.org>2006-01-02 01:50:30 +0000
commitad6170dd977bddf2036b6072f006d259cfca6080 (patch)
tree7d9d6b7d5126e32e8e1d48232adab505f7d3f9aa /sbin/mdmfs
parent2c46267f6c677b52e9467a09f2108ef8cf98443e (diff)
downloadFreeBSD-src-ad6170dd977bddf2036b6072f006d259cfca6080.zip
FreeBSD-src-ad6170dd977bddf2036b6072f006d259cfca6080.tar.gz
Add a -P option to allow skipping newfs when using a vnode-backed
disk. Apparently some people want to use mdmfs as mount_* as a shortcut for mounting existing file-based file systems. Note that unlike in the patches from the submitters, this option is not available in compat mode. Compat mode was supposed to support only things that mount_mfs used to support. To use this option from fstab, mdmfs should be called mount_md, not mount_mfs. This distinction has not always upkept for new options, and those can't be fixed now without breaking people's systems, but new options should not usually be allowed in compat mode. (Not sure why -F is allowed there at all.) PR: 57641 Submitted by: Ruben de Groot Submitted independently by: Wojciech A. Koszek, for Urzad Miasta Czestochowa
Diffstat (limited to 'sbin/mdmfs')
-rw-r--r--sbin/mdmfs/mdmfs.811
-rw-r--r--sbin/mdmfs/mdmfs.c17
2 files changed, 22 insertions, 6 deletions
diff --git a/sbin/mdmfs/mdmfs.8 b/sbin/mdmfs/mdmfs.8
index 39af0cb..3d42988 100644
--- a/sbin/mdmfs/mdmfs.8
+++ b/sbin/mdmfs/mdmfs.8
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 26, 2004
+.Dd January 2, 2006
.Dt MDMFS 8
.Os
.Sh NAME
@@ -36,7 +36,7 @@
driver
.Sh SYNOPSIS
.Nm
-.Op Fl DLlMNSUX
+.Op Fl DLlMNPSUX
.Op Fl a Ar maxcontig
.Op Fl b Ar block-size
.Op Fl c Ar cylinders
@@ -197,6 +197,13 @@ Specify the mount options with which to mount the file system.
See
.Xr mount 8
for more information.
+.It Fl P
+Preserve the existing filesystem;
+do not run
+.Xr newfs 8 .
+This only makes sense if
+.Fl F
+is specified to create a vnode-backed disk.
.It Fl p Ar permissions
Set the file (directory) permissions of the mount point
.Ar mount-point
diff --git a/sbin/mdmfs/mdmfs.c b/sbin/mdmfs/mdmfs.c
index 9d4095c..33c35f9 100644
--- a/sbin/mdmfs/mdmfs.c
+++ b/sbin/mdmfs/mdmfs.c
@@ -89,7 +89,7 @@ main(int argc, char **argv)
*mount_arg;
enum md_types mdtype; /* The type of our memory disk. */
bool have_mdtype;
- bool detach, softdep, autounit;
+ bool detach, softdep, autounit, newfs;
char *mtpoint, *unitstr;
char *p;
int ch;
@@ -101,6 +101,7 @@ main(int argc, char **argv)
detach = true;
softdep = true;
autounit = false;
+ newfs = true;
have_mdtype = false;
mdtype = MD_SWAP;
mdname = MD_NAME;
@@ -121,7 +122,7 @@ main(int argc, char **argv)
compat = true;
while ((ch = getopt(argc, argv,
- "a:b:Cc:Dd:e:F:f:hi:LlMm:Nn:O:o:p:Ss:t:Uv:w:X")) != -1)
+ "a:b:Cc:Dd:e:F:f:hi:LlMm:Nn:O:o:p:PSs:t:Uv:w:X")) != -1)
switch (ch) {
case 'a':
argappend(&newfs_arg, "-a %s", optarg);
@@ -195,6 +196,11 @@ main(int argc, char **argv)
case 'o':
argappend(&mount_arg, "-o %s", optarg);
break;
+ case 'P':
+ if (compat)
+ usage();
+ newfs = false;
+ break;
case 'p':
if (compat)
usage();
@@ -263,6 +269,8 @@ main(int argc, char **argv)
mdtype = MD_SWAP;
if (softdep)
argappend(&newfs_arg, "-U");
+ if (mdtype != MD_VNODE && !newfs)
+ errx(1, "-P requires a vnode-backed disk");
/* Do the work. */
if (detach && !autounit)
@@ -271,7 +279,8 @@ main(int argc, char **argv)
do_mdconfig_attach_au(mdconfig_arg, mdtype);
else
do_mdconfig_attach(mdconfig_arg, mdtype);
- do_newfs(newfs_arg);
+ if (newfs)
+ do_newfs(newfs_arg);
do_mount(mount_arg, mtpoint);
do_mtptsetup(mtpoint, &mi);
@@ -666,7 +675,7 @@ usage(void)
name = "mdmfs";
if (!compat)
fprintf(stderr,
-"usage: %s [-DLlMNSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
+"usage: %s [-DLlMNPSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n"
"\t[-m percent-free] [-n rotational-positions] [-O optimization]\n"
"\t[-o mount-options] [-p permissions] [-s size] [-v version]\n"
OpenPOWER on IntegriCloud