In nmount(), internally convert the mount option: "rdonly" to "ro".

This makes updates mounts such as:
 "mount -u -o rdonly" work more like, "mount -u -o ro".

References to "-o rdonly" were changed to "-o ro" in revision 1.60 of
the mount(8) man page,
but some people still like to use "-o rdonly" since it was documented
in earlier versions of FreeBSD.

Requested by:	rwatson
MFC after:	1 week
This commit is contained in:
Craig Rodrigues 2007-12-05 03:26:14 +00:00
parent 22cf347586
commit 62bdb328bb

View File

@ -134,7 +134,6 @@ static const char *global_opts[] = {
"errmsg", "errmsg",
"fstype", "fstype",
"fspath", "fspath",
"rdonly",
"ro", "ro",
"rw", "rw",
"nosuid", "nosuid",
@ -684,9 +683,13 @@ vfs_donmount(struct thread *td, int fsflags, struct uio *fsoptions)
fsflags &= ~MNT_RDONLY; fsflags &= ~MNT_RDONLY;
has_rw = 1; has_rw = 1;
} }
else if (strcmp(opt->name, "ro") == 0 || else if (strcmp(opt->name, "ro") == 0)
strcmp(opt->name, "rdonly") == 0)
fsflags |= MNT_RDONLY; fsflags |= MNT_RDONLY;
else if (strcmp(opt->name, "rdonly") == 0) {
free(opt->name, M_MOUNT);
opt->name = strdup("ro", M_MOUNT);
fsflags |= MNT_RDONLY;
}
else if (strcmp(opt->name, "snapshot") == 0) else if (strcmp(opt->name, "snapshot") == 0)
fsflags |= MNT_SNAPSHOT; fsflags |= MNT_SNAPSHOT;
else if (strcmp(opt->name, "suiddir") == 0) else if (strcmp(opt->name, "suiddir") == 0)