diff options
author | msmith <msmith@FreeBSD.org> | 1999-11-03 11:02:47 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1999-11-03 11:02:47 +0000 |
commit | 219fe6842a464ef7e072186fbb1cd79e73154c56 (patch) | |
tree | 3597b31a080789c1b8136a3478046ee6d1cc9403 /sys/kern/vfs_conf.c | |
parent | 4a7e87b904b999ae60cdb0f26880f32eb2745e8e (diff) | |
download | FreeBSD-src-219fe6842a464ef7e072186fbb1cd79e73154c56.zip FreeBSD-src-219fe6842a464ef7e072186fbb1cd79e73154c56.tar.gz |
Make MFS work with the new root filesystem search process.
In order to achieve this, root filesystem mount is moved from
SI_ORDER_FIRST to SI_ORDER_SECOND in the SI_SUB_MOUNT_ROOT sysinit
group. Now, modules which wish to usurp the default root mount
can use SI_ORDER_FIRST.
A compiled-in or preloaded MFS filesystem will become the root
filesystem unless the vfs.root.mountfrom environment variable refers
to a valid bootable device. This will normally only be the case when
the kernel and MFS image have been loaded from a disk which has a
valid /etc/fstab file. In this case, the variable should be manually
overridden in the loader, or the kernel booted with -a. In either
case "mfs:" should be supplied as the new value.
Also fix a typo in one DFLTROOT case that would not have compiled.
Diffstat (limited to 'sys/kern/vfs_conf.c')
-rw-r--r-- | sys/kern/vfs_conf.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 2de291f..b0f3646 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -70,7 +70,7 @@ static void gets(char *cp); char *rootdevnames[2] = {NULL, NULL}; static int setrootbyname(char *name); -SYSINIT(mountroot, SI_SUB_MOUNT_ROOT, SI_ORDER_FIRST, vfs_mountroot, NULL); +SYSINIT(mountroot, SI_SUB_MOUNT_ROOT, SI_ORDER_SECOND, vfs_mountroot, NULL); /* * Find and mount the root filesystem @@ -119,8 +119,8 @@ vfs_mountroot(void *junk) */ #ifdef ROOTDEVNAME if (!(boothowto & RB_DFLTROOT)) - !vfs_mountroot_try(ROOTDEVNAME)) - return; + if (!vfs_mountroot_try(ROOTDEVNAME)) + return; #endif /* @@ -138,12 +138,12 @@ vfs_mountroot(void *junk) static int vfs_mountroot_try(char *mountfrom) { - struct mount *mp; + struct mount *mp; char *vfsname, *path; int error; char patt[16]; - vfsname = path = NULL; + vfsname = path = mp = NULL; error = EINVAL; if (mountfrom == NULL) @@ -154,8 +154,9 @@ vfs_mountroot_try(char *mountfrom) /* parse vfs name and path */ vfsname = malloc(MFSNAMELEN, M_MOUNT, M_WAITOK); path = malloc(MNAMELEN, M_MOUNT, M_WAITOK); + vfsname[0] = path[0] = 0; sprintf(patt, "%%%d[a-z]:%%%ds", MFSNAMELEN, MNAMELEN); - if (sscanf(mountfrom, patt, vfsname, path) != 2) + if (sscanf(mountfrom, patt, vfsname, path) < 1) goto done; /* allocate a root mount */ @@ -167,7 +168,7 @@ vfs_mountroot_try(char *mountfrom) mp->mnt_flag |= MNT_ROOTFS; /* do our best to set rootdev */ - if (setrootbyname(path)) + if ((path[0] != 0) && setrootbyname(path)) printf("setrootbyname failed\n"); strcpy(mp->mnt_stat.f_mntfromname, path); @@ -190,7 +191,8 @@ done: /* sanity check system clock against root filesystem timestamp */ inittodr(mp->mnt_time); } - vfs_unbusy(mp, curproc); + if (mp != NULL) + vfs_unbusy(mp, curproc); return(error); } |