Remove the -C option as it does more harm than good. To be fully

compatible, it would have to (at least):

- support the "compat-compat" -T option,
- *not* support the -l, -O, and -v options,
- default to soft updates being disabled.

Worse, the compatibility mode makes it impossible to mount_mfs(8)
a file system from fstab(5) with soft updates disabled (-S).  [1]

Now, the only difference when called as "mount_mfs" or "mfs" (as
opposed to "mdmfs") is that the file mode of the mount point is
set by default to 01777.  All options available to mdmfs(8) are
also available to mount_mfs(8); the -C option is still recognized
but ignored for backward compatibility.

PR:		bin/98860 [1]
MFC after:	2 weeks
This commit is contained in:
Ruslan Ermilov 2006-11-03 12:02:24 +00:00
parent 8cd5dc08c3
commit 957d7c8f9c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163952
2 changed files with 15 additions and 80 deletions

View File

@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd October 1, 2006
.Dd November 3, 2006
.Dt MDMFS 8
.Os
.Sh NAME
@ -56,26 +56,6 @@ driver
.Op Fl w Ar user : Ns Ar group
.Ar md-device
.Ar mount-point
.Nm
.Fl C
.Op Fl lNU
.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 path-mdconfig
.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
.Op Fl v Ar version
.Ar md-device
.Ar mount-point
.Sh DESCRIPTION
The
.Nm
@ -134,12 +114,6 @@ out before forcing a rotational delay
option).
.It Fl b Ar block-size
The block size of the file system, in bytes.
.It Fl C
Enable full compatibility mode with
.Xr mount_mfs 8 .
See the
.Sx COMPATIBILITY
section for more information.
.It Fl c Ar cylinders
The number of cylinders per cylinder group in the file system.
.It Fl D
@ -250,7 +224,7 @@ backed disks
.Pq Dv MD_MALLOC .
.It Fl U
Enable soft-updates on the file system.
This is the default, even in compatibility mode, and is accepted only
This is the default, and is accepted only
for compatibility.
It is only really useful to negate the
.Fl S
@ -337,19 +311,16 @@ do not use soft-updates on it and mount it
.Sh COMPATIBILITY
The
.Nm
utility, while designed to be fully compatible with
utility, while designed to be compatible with
.Xr mount_mfs 8 ,
can be useful by itself.
Since
.Xr mount_mfs 8
had some silly defaults, a
.Dq full compatibility
.Dq 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
Compatibility is enabled by starting
.Nm
with the name
.Li mount_mfs
@ -357,17 +328,14 @@ or
.Li mfs
(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
In this mode, the following behavior, as done by
.Xr mount_mfs 8 ,
is duplicated:
.Bl -bullet -offset indent
.It
The file mode of
.Ar mount-point
is set to
is set by default to
.Li 01777
as if
.Fl p Ar 1777

View File

@ -61,7 +61,6 @@ 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? */
@ -119,8 +118,11 @@ main(int argc, char **argv)
/* If we were started as mount_mfs or mfs, imply -C. */
if (strcmp(getprogname(), "mount_mfs") == 0 ||
strcmp(getprogname(), "mfs") == 0)
compat = true;
strcmp(getprogname(), "mfs") == 0) {
/* Make compatibility assumptions. */
mi.mi_mode = 01777;
mi.mi_have_mode = true;
}
while ((ch = getopt(argc, argv,
"a:b:Cc:Dd:E:e:F:f:hi:LlMm:Nn:O:o:Pp:Ss:t:Uv:w:X")) != -1)
@ -132,16 +134,12 @@ main(int argc, char **argv)
argappend(&newfs_arg, "-b %s", optarg);
break;
case 'C':
if (compat)
usage();
compat = true;
/* Ignored for compatibility. */
break;
case 'c':
argappend(&newfs_arg, "-c %s", optarg);
break;
case 'D':
if (compat)
usage();
detach = false;
break;
case 'd':
@ -170,8 +168,6 @@ main(int argc, char **argv)
argappend(&newfs_arg, "-i %s", optarg);
break;
case 'L':
if (compat)
usage();
loudsubs = true;
break;
case 'l':
@ -187,8 +183,6 @@ main(int argc, char **argv)
argappend(&newfs_arg, "-m %s", optarg);
break;
case 'N':
if (compat)
usage();
norun = true;
break;
case 'n':
@ -201,13 +195,9 @@ main(int argc, char **argv)
argappend(&mount_arg, "-o %s", optarg);
break;
case 'P':
if (compat)
usage();
newfs = false;
break;
case 'p':
if (compat)
usage();
if ((set = setmode(optarg)) == NULL)
usage();
mi.mi_mode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO);
@ -215,8 +205,6 @@ main(int argc, char **argv)
free(set);
break;
case 'S':
if (compat)
usage();
softdep = false;
break;
case 's':
@ -229,13 +217,9 @@ main(int argc, char **argv)
argappend(&newfs_arg, "-O %s", optarg);
break;
case 'w':
if (compat)
usage();
extract_ugid(optarg, &mi);
break;
case 'X':
if (compat)
usage();
debug = true;
break;
default:
@ -246,12 +230,6 @@ 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)
@ -671,23 +649,12 @@ run(int *ofd, const char *cmdline, ...)
static void
usage(void)
{
const char *name;
if (compat)
name = getprogname();
else
name = "mdmfs";
if (!compat)
fprintf(stderr,
fprintf(stderr,
"usage: %s [-DLlMNPSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n"
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"
"\t[-i bytes] [-m percent-free] [-n rotational-positions] [-O optimization]\n"
"\t[-o mount-options] [-p permissions] [-s size] [-v version]\n"
"\t[-w user:group] md-device mount-point\n", name);
fprintf(stderr,
"usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n"
"\t[-d rotdelay] [-E path-mdconfig] [-e maxbpg] [-F file] [-f frag-size]\n"
"\t[-i bytes] [-m percent-free] [-n rotational-positions] [-O optimization]\n"
"\t[-o mount-options] [-s size] [-v version] md-device mount-point\n", name);
"\t[-w user:group] md-device mount-point\n", getprogname());
exit(1);
}