PERFORCE change 18938 for review

Brian Feldman green at freebsd.org
Tue Oct 8 17:34:29 GMT 2002


http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18938

Change 18938 by green at green_laptop_2 on 2002/10/08 10:33:31

	Introduce a hack, "vfs.root.multilabel", to trick the system
	into mounting the root filesystem initially as MNT_MULTILABEL.
	I intend to have /boot/loader set this automatically when it's
	the right time.

Affected files ...

.. //depot/projects/trustedbsd/mac/sys/kern/vfs_mount.c#9 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/vfs_mount.c#9 (text+ko) ====

@@ -97,8 +97,8 @@
 
 static void	checkdirs(struct vnode *olddp, struct vnode *newdp);
 static int	vfs_nmount(struct thread *td, int, struct uio *);
-static int	vfs_mountroot_try(char *mountfrom);
-static int	vfs_mountroot_ask(void);
+static int	vfs_mountroot_try(char *mountfrom, int rootmntflags);
+static int	vfs_mountroot_ask(int rootmntflags);
 static void	gets(char *cp);
 
 static int	usermount = 0;	/* if 1, non-root can mount fs. */
@@ -1402,15 +1402,19 @@
 vfs_mountroot(void)
 {
 	char		*cp;
-	int		i, error;
+	int		i, rootmntflags, error;
 	
+	if (getenv("vfs.root.multilabel") != NULL)
+		rootmntflags = MNT_MULTILABEL;
+	else
+		rootmntflags = 0;
 	/* 
 	 * The root filesystem information is compiled in, and we are
 	 * booted with instructions to use it.
 	 */
 #ifdef ROOTDEVNAME
 	if ((boothowto & RB_DFLTROOT) && 
-	    !vfs_mountroot_try(ROOTDEVNAME))
+	    !vfs_mountroot_try(ROOTDEVNAME, rootmntflags))
 		return;
 #endif
 	/* 
@@ -1418,7 +1422,7 @@
 	 * or to use the compiled-in default when it doesn't exist.
 	 */
 	if (boothowto & (RB_DFLTROOT | RB_ASKNAME)) {
-		if (!vfs_mountroot_ask())
+		if (!vfs_mountroot_ask(rootmntflags))
 			return;
 	}
 
@@ -1429,7 +1433,8 @@
 	 */
 	if (boothowto & RB_CDROM) {
 		for (i = 0; cdrom_rootdevnames[i] != NULL; i++) {
-			if (!vfs_mountroot_try(cdrom_rootdevnames[i]))
+			if (!vfs_mountroot_try(cdrom_rootdevnames[i],
+			    rootmntflags))
 				return;
 		}
 	}
@@ -1440,7 +1445,7 @@
 	 * mechanism.
 	 */
 	if ((cp = getenv("vfs.root.mountfrom")) != NULL) {
-		error = vfs_mountroot_try(cp);
+		error = vfs_mountroot_try(cp, rootmntflags);
 		freeenv(cp);
 		if (!error)
 			return;
@@ -1450,9 +1455,9 @@
 	 * Try values that may have been computed by the machine-dependant
 	 * legacy code.
 	 */
-	if (!vfs_mountroot_try(rootdevnames[0]))
+	if (!vfs_mountroot_try(rootdevnames[0], rootmntflags))
 		return;
-	if (!vfs_mountroot_try(rootdevnames[1]))
+	if (!vfs_mountroot_try(rootdevnames[1], rootmntflags))
 		return;
 
 	/*
@@ -1461,7 +1466,7 @@
 	 */
 #ifdef ROOTDEVNAME
 	if (!(boothowto & RB_DFLTROOT))
-		if (!vfs_mountroot_try(ROOTDEVNAME))
+		if (!vfs_mountroot_try(ROOTDEVNAME, rootmntflags))
 			return;
 #endif
 
@@ -1469,7 +1474,8 @@
 	 * Everything so far has failed, prompt on the console if we haven't
 	 * already tried that.
 	 */
-	if (!(boothowto & (RB_DFLTROOT | RB_ASKNAME)) && !vfs_mountroot_ask())
+	if (!(boothowto & (RB_DFLTROOT | RB_ASKNAME)) &&
+	    !vfs_mountroot_ask(rootmntflags))
 		return;
 	panic("Root mount failed, startup aborted.");
 }
@@ -1478,7 +1484,7 @@
  * Mount (mountfrom) as the root filesystem.
  */
 static int
-vfs_mountroot_try(char *mountfrom)
+vfs_mountroot_try(char *mountfrom, int rootmntflags)
 {
         struct mount	*mp;
 	char		*vfsname, *path;
@@ -1514,7 +1520,7 @@
 		       vfsname, error);
 		goto done;
 	}
-	mp->mnt_flag |= MNT_ROOTFS;
+	mp->mnt_flag |= MNT_ROOTFS | rootmntflags;
 
 	/* do our best to set rootdev */
 	if ((path[0] != 0) && setrootbyname(path))
@@ -1568,7 +1574,7 @@
  * Spin prompting on the console for a suitable root filesystem
  */
 static int
-vfs_mountroot_ask(void)
+vfs_mountroot_ask(int rootmntflags)
 {
 	char name[128];
 	int i;
@@ -1598,7 +1604,7 @@
 			printf("\n");
 			continue;
 		}
-		if (!vfs_mountroot_try(name))
+		if (!vfs_mountroot_try(name, rootmntflags))
 			return(0);
 	}
 }
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message



More information about the trustedbsd-cvs mailing list