diff options
author | attilio <attilio@FreeBSD.org> | 2009-11-12 15:59:05 +0000 |
---|---|---|
committer | attilio <attilio@FreeBSD.org> | 2009-11-12 15:59:05 +0000 |
commit | 00d48829b61e72f5c5d464333400559ec6056614 (patch) | |
tree | 4817c69b259e2a3e0782d6d89b9e1e3eef5f379a /sys/kern/vfs_mount.c | |
parent | 9cdb62841456ce1fc80d1750dde19b86c18979e9 (diff) | |
download | FreeBSD-src-00d48829b61e72f5c5d464333400559ec6056614.zip FreeBSD-src-00d48829b61e72f5c5d464333400559ec6056614.tar.gz |
Add the possibility for vfs.root.mountfrom tunable to accept a list of
items rather than a single one. The list is a space separated collection
of items defined as the current one accepted.
While there fix also a nit in a comment.
Obtained from: Sandvine Incorporated
Reviewed by: emaste
Tested by: Giovanni Trematerra
<giovanni dot trematerra at gmail dot com>
Sponsored by: Sandvine Incorporated
MFC: 2 weeks
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r-- | sys/kern/vfs_mount.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 71084f5..962ad67 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -104,13 +104,17 @@ struct vnode *rootvnode; * The root filesystem is detailed in the kernel environment variable * vfs.root.mountfrom, which is expected to be in the general format * - * <vfsname>:[<path>] + * <vfsname>:[<path>][ <vfsname>:[<path>] ...] * vfsname := the name of a VFS known to the kernel and capable * of being mounted as root * path := disk device name or other data used by the filesystem * to locate its physical store * - * The environment variable vfs.root.mountfrom options is a comma delimited + * If the environment variable vfs.root.mountfrom is a space separated list, + * each list element is tried in turn and the root filesystem will be mounted + * from the first one that suceeds. + * + * The environment variable vfs.root.mountfrom.options is a comma delimited * set of string mount options. These mount options must be parseable * by nmount() in the kernel. */ @@ -1643,7 +1647,7 @@ vfs_opterror(struct vfsoptlist *opts, const char *fmt, ...) void vfs_mountroot(void) { - char *cp, *options; + char *cp, *cpt, *options, *tmpdev; int error, i, asked = 0; options = NULL; @@ -1695,10 +1699,15 @@ vfs_mountroot(void) */ cp = getenv("vfs.root.mountfrom"); if (cp != NULL) { - error = vfs_mountroot_try(cp, options); + cpt = cp; + while ((tmpdev = strsep(&cpt, " \t")) != NULL) { + error = vfs_mountroot_try(tmpdev, options); + if (error == 0) { + freeenv(cp); + goto mounted; + } + } freeenv(cp); - if (!error) - goto mounted; } /* |