From owner-p4-projects Tue Oct 8 10:34:34 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 5607B37B404; Tue, 8 Oct 2002 10:34:30 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E1CE237B401 for ; Tue, 8 Oct 2002 10:34:29 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9225943E4A for ; Tue, 8 Oct 2002 10:34:29 -0700 (PDT) (envelope-from green@freebsd.org) Received: from freefall.freebsd.org (perforce@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g98HYTCo061983 for ; Tue, 8 Oct 2002 10:34:29 -0700 (PDT) (envelope-from green@freebsd.org) Received: (from perforce@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g98HYTqM061980 for perforce@freebsd.org; Tue, 8 Oct 2002 10:34:29 -0700 (PDT) Date: Tue, 8 Oct 2002 10:34:29 -0700 (PDT) Message-Id: <200210081734.g98HYTqM061980@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to green@freebsd.org using -f From: Brian Feldman Subject: PERFORCE change 18938 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://people.freebsd.org/~peter/p4db/chv.cgi?CH=18938 Change 18938 by green@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@FreeBSD.org with "unsubscribe p4-projects" in the body of the message