From owner-svn-src-all@FreeBSD.ORG Thu Nov 12 15:59:05 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5BD76106566C; Thu, 12 Nov 2009 15:59:05 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B21E8FC1A; Thu, 12 Nov 2009 15:59:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id nACFx5tr035250; Thu, 12 Nov 2009 15:59:05 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id nACFx5v0035248; Thu, 12 Nov 2009 15:59:05 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200911121559.nACFx5v0035248@svn.freebsd.org> From: Attilio Rao Date: Thu, 12 Nov 2009 15:59:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r199227 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2009 15:59:05 -0000 Author: attilio Date: Thu Nov 12 15:59:05 2009 New Revision: 199227 URL: http://svn.freebsd.org/changeset/base/199227 Log: 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 Sponsored by: Sandvine Incorporated MFC: 2 weeks Modified: head/sys/kern/vfs_mount.c Modified: head/sys/kern/vfs_mount.c ============================================================================== --- head/sys/kern/vfs_mount.c Thu Nov 12 15:19:09 2009 (r199226) +++ head/sys/kern/vfs_mount.c Thu Nov 12 15:59:05 2009 (r199227) @@ -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 := 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, co 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; } /*