diff options
author | yar <yar@FreeBSD.org> | 2008-02-14 17:04:31 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2008-02-14 17:04:31 +0000 |
commit | 9713f1f445b6ba1d2c2b46e10a1c5b61b5633763 (patch) | |
tree | 8e0a9bfa2af120bb39925453ef3dfe0268093ee8 /sys | |
parent | 0e60a1b33c0d7b886460cc863fd7d1eddffef40f (diff) | |
download | FreeBSD-src-9713f1f445b6ba1d2c2b46e10a1c5b61b5633763.zip FreeBSD-src-9713f1f445b6ba1d2c2b46e10a1c5b61b5633763.tar.gz |
In the new order of things dictated by nmount(2), a read-only mount
is to be requested via a "ro" option. At the same time, MNT_RDONLY
is gradually becoming an indicator of the current state of the FS
instead of a command flag. Today passing MNT_RDONLY alone to the
kernel's mount machinery will lead to various glitches. (See the
PRs for examples.)
Therefore mount the root FS with a "ro" option instead of the
MNT_RDONLY flag. (Note that MNT_RDONLY still is added to the mount
flags internally, by vfs_donmount(), if "ro" was specified.)
To be able to pass "ro" cleanly to kernel_vmount(), teach the latter
function to accept options with NULL values.
Also correct the comment explaining how mount_arg() handles length
of -1.
PR: bin/106636 kern/120319
Submitted by: Jaakko Heinonen <see PR kern/120319 for email> (originally)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_mount.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 146f868..1f66a07 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -1723,10 +1723,11 @@ vfs_mountroot_try(const char *mountfrom) strcpy(path, ROOTNAME); error = kernel_vmount( - MNT_RDONLY | MNT_ROOTFS, + MNT_ROOTFS, "fstype", vfsname, "fspath", "/", "from", path, + "ro", NULL, NULL); if (error == 0) { /* @@ -2213,7 +2214,7 @@ mount_argsu(struct mntarg *ma, const char *name, const void *val, int len) /* * Plain argument. * - * If length is -1, use printf. + * If length is -1, treat value as a C string. */ struct mntarg * mount_arg(struct mntarg *ma, const char *name, const void *val, int len) @@ -2300,7 +2301,7 @@ kernel_vmount(int flags, ...) if (cp == NULL) break; vp = va_arg(ap, const void *); - ma = mount_arg(ma, cp, vp, -1); + ma = mount_arg(ma, cp, vp, (vp != NULL ? -1 : 0)); } va_end(ap); |