Implement a better compatibility mode with mount_mfs. It is the
default if the executable is named (called as) "mount_*", or can be enabled with the -C option. This allows users to leave their old fstab entires unchanged (modulo symlink'ing mdmfs to mount(md|mfs)) and have things behave the way they should (by emulating mount_mfs silliness), while still allowing mdmfs to be used as a generic make-an-md-and-mount-it type thing. Right now, the only effects of this option is to set the mount-point mode to 01777 as if "-p 1777" was given, and to complain about getting command-line options that mount_mfs didn't take (e.g., -X, -L, et al). The latter is mostly to try to catch operator errors. Also implement -U, which turns on soft-updates. It's redundant (since softdep is the default), but implement it anyway for compatibility.
This commit is contained in:
parent
1e2e2c4aaf
commit
a0098194ed
@ -25,7 +25,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 26, 2001
|
||||
.Dd August 5, 2001
|
||||
.Dt MDMFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -35,7 +35,7 @@
|
||||
driver
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl DLMNSX
|
||||
.Op Fl DLMNSUX
|
||||
.Op Fl a Ar maxcontig
|
||||
.Op Fl b Ar block-size
|
||||
.Op Fl c Ar cylinders
|
||||
@ -53,6 +53,24 @@ driver
|
||||
.Op Fl w Ar user : Ns Ar group
|
||||
.Ar md-device
|
||||
.Ar mount-point
|
||||
.Nm
|
||||
.Fl C
|
||||
.Op Fl NU
|
||||
.Op Fl a Ar maxcontig
|
||||
.Op Fl b Ar block-size
|
||||
.Op Fl c Ar cylinders
|
||||
.Op Fl d Ar rotdelay
|
||||
.Op Fl e Ar maxbpg
|
||||
.Op Fl F Ar file
|
||||
.Op Fl f Ar frag-size
|
||||
.Op Fl i Ar bytes
|
||||
.Op Fl m Ar percent-free
|
||||
.Op Fl n Ar rotational-positions
|
||||
.Op Fl O Ar optimization
|
||||
.Op Fl o Ar mount-options
|
||||
.Op Fl s Ar size
|
||||
.Ar md-device
|
||||
.Ar mount-point
|
||||
.Sh DESCRIPTION
|
||||
The
|
||||
.Nm
|
||||
@ -110,6 +128,13 @@ out before forcing a rotational delay
|
||||
option).
|
||||
.It Fl b Ar block-size
|
||||
The block size of the filesystem, in bytes.
|
||||
.It Fl C
|
||||
Enable full compatibility mode with
|
||||
.Xr mount_mfs 8 .
|
||||
See the
|
||||
.\" XXX link to another section?
|
||||
.Em COMPATIBILITY
|
||||
section for more information.
|
||||
.It Fl c Ar cylinders
|
||||
The number of cylinders per cylinder group in the filesystem.
|
||||
.It Fl D
|
||||
@ -192,6 +217,13 @@ and the optional
|
||||
.Xr malloc 9
|
||||
backed disks
|
||||
.Pq Dv MD_MALLOC .
|
||||
.It Fl U
|
||||
Enable soft-updates on the filesystem.
|
||||
This is the default, even in compatibility mode, and is accepted only
|
||||
for compatibility.
|
||||
It is only really useful to negate the
|
||||
.Fl S
|
||||
flag, should such a need occur.
|
||||
.It Fl w Ar user : Ns Ar group
|
||||
Set the owner and group to
|
||||
.Ar user
|
||||
@ -257,8 +289,46 @@ do not use soft-updates on it and mount it
|
||||
.Cm async :
|
||||
.Pp
|
||||
.Dl "mdmfs -M -S -o async -s 16m md1 /tmp"
|
||||
.Sh COMPATIBILITY
|
||||
.Nm ,
|
||||
while designed to be fully compatible with
|
||||
.Xr mount_mfs 8 ,
|
||||
can be useful by itself.
|
||||
Since
|
||||
.Xr mount_mfs 8
|
||||
has some silly defaults, a
|
||||
.Dq full compatibility
|
||||
mode is provided for the case where bug-to-bug compatibility is desired.
|
||||
.Pp
|
||||
Full compatibility is enabled with the
|
||||
.Fl C
|
||||
flag,
|
||||
or by starting
|
||||
.Nm
|
||||
with
|
||||
.Li mount_
|
||||
at the beginning of its name
|
||||
(as returned by
|
||||
.Xr getprogname 3 ) .
|
||||
In this mode, only the options which would be accepted by
|
||||
.Xr mount_mfs 8
|
||||
are valid.
|
||||
Furthermore, the following behavior, as done by
|
||||
.Xr mount_mfs 8 ,
|
||||
is duplicated:
|
||||
.Bl -bullet -offset indent -compat
|
||||
.It
|
||||
The file mode of
|
||||
.Ar mount-point
|
||||
is set to
|
||||
.Li 01777
|
||||
as if
|
||||
.Fl p Ar 1777
|
||||
was given on the command line.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr md 4 ,
|
||||
.Xr fstab 5 ,
|
||||
.Xr disklabel 8 ,
|
||||
.Xr mdconfig 8 ,
|
||||
.Xr mount 8 ,
|
||||
|
@ -65,6 +65,7 @@ struct mtpt_info {
|
||||
bool mi_have_mode;
|
||||
};
|
||||
|
||||
static bool compat; /* Full compatibility with mount_mfs? */
|
||||
static bool debug; /* Emit debugging information? */
|
||||
static bool loudsubs; /* Suppress output from helper programs? */
|
||||
static bool norun; /* Actually run the helper programs? */
|
||||
@ -115,8 +116,12 @@ main(int argc, char **argv)
|
||||
newfs_arg = strdup("");
|
||||
mount_arg = strdup("");
|
||||
|
||||
/* If we were started as mount_*, imply -C. */
|
||||
if (strncmp(getprogname(), "mount_", 6) == 0)
|
||||
compat = true;
|
||||
|
||||
while ((ch = getopt(argc, argv,
|
||||
"a:b:c:Dd:e:F:f:hi:LMm:Nn:O:o:p:Ss:t:w:X")) != -1)
|
||||
"a:b:Cc:Dd:e:F:f:hi:LMm:Nn:O:o:p:Ss:t:Uw:X")) != -1)
|
||||
switch (ch) {
|
||||
case 'a':
|
||||
argappend(&newfs_arg, "-a %s", optarg);
|
||||
@ -124,10 +129,17 @@ main(int argc, char **argv)
|
||||
case 'b':
|
||||
argappend(&newfs_arg, "-b %s", optarg);
|
||||
break;
|
||||
case 'C':
|
||||
if (compat)
|
||||
usage();
|
||||
compat = true;
|
||||
break;
|
||||
case 'c':
|
||||
argappend(&newfs_arg, "-c %s", optarg);
|
||||
break;
|
||||
case 'D':
|
||||
if (compat)
|
||||
usage();
|
||||
detach = false;
|
||||
break;
|
||||
case 'd':
|
||||
@ -153,6 +165,8 @@ main(int argc, char **argv)
|
||||
argappend(&newfs_arg, "-i %s", optarg);
|
||||
break;
|
||||
case 'L':
|
||||
if (compat)
|
||||
usage();
|
||||
loudsubs = true;
|
||||
break;
|
||||
case 'M':
|
||||
@ -165,6 +179,8 @@ main(int argc, char **argv)
|
||||
argappend(&newfs_arg, "-m %s", optarg);
|
||||
break;
|
||||
case 'N':
|
||||
if (compat)
|
||||
usage();
|
||||
norun = true;
|
||||
break;
|
||||
case 'n':
|
||||
@ -177,6 +193,8 @@ main(int argc, char **argv)
|
||||
argappend(&mount_arg, "-o %s", optarg);
|
||||
break;
|
||||
case 'p':
|
||||
if (compat)
|
||||
usage();
|
||||
if (*optarg >= '0' && *optarg <= '7')
|
||||
mi.mi_mode = strtol(optarg, NULL, 8);
|
||||
if ((mi.mi_mode & ~07777) != 0)
|
||||
@ -184,15 +202,24 @@ main(int argc, char **argv)
|
||||
mi.mi_have_mode = true;
|
||||
break;
|
||||
case 'S':
|
||||
if (compat)
|
||||
usage();
|
||||
softdep = false;
|
||||
break;
|
||||
case 's':
|
||||
argappend(&mdconfig_arg, "-s %s", optarg);
|
||||
break;
|
||||
case 'U':
|
||||
softdep = true;
|
||||
break;
|
||||
case 'w':
|
||||
if (compat)
|
||||
usage();
|
||||
extract_ugid(optarg, &mi);
|
||||
break;
|
||||
case 'X':
|
||||
if (compat)
|
||||
usage();
|
||||
debug = true;
|
||||
break;
|
||||
default:
|
||||
@ -203,6 +230,12 @@ main(int argc, char **argv)
|
||||
if (argc < 2)
|
||||
usage();
|
||||
|
||||
/* Make compatibility assumptions. */
|
||||
if (compat) {
|
||||
mi.mi_mode = 01777;
|
||||
mi.mi_have_mode = true;
|
||||
}
|
||||
|
||||
/* Derive 'unit' (global). */
|
||||
unitstr = argv[0];
|
||||
if (strncmp(unitstr, "/dev/", 5) == 0)
|
||||
@ -634,12 +667,23 @@ run(int *ofd, const char *cmdline, ...)
|
||||
static void
|
||||
usage(void)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
fprintf(stderr,
|
||||
"usage: %s [-DLMNSX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
|
||||
if (compat)
|
||||
name = getprogname();
|
||||
else
|
||||
name = "mdmfs";
|
||||
if (!compat)
|
||||
fprintf(stderr,
|
||||
"Usage: %s [-DLMNSUX] [-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] [-w user:group]\n"
|
||||
"\tmd-device mount-point\n", getprogname());
|
||||
"\tmd-device mount-point\n", name);
|
||||
fprintf(stderr,
|
||||
"Usage: %s -C [-NU] [-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] [-s size] md-device mount-point\n", name);
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user