diff options
author | bde <bde@FreeBSD.org> | 1998-06-09 12:52:35 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1998-06-09 12:52:35 +0000 |
commit | dbddecf49eaeda892dce76adfbf7a10618a9180d (patch) | |
tree | 65360eba72c760467994e1773c5addb180260cbb /sys/kern/vfs_conf.c | |
parent | 1d52ca33dca3e759fbef901483dcd6ad74431c61 (diff) | |
download | FreeBSD-src-dbddecf49eaeda892dce76adfbf7a10618a9180d.zip FreeBSD-src-dbddecf49eaeda892dce76adfbf7a10618a9180d.tar.gz |
Pass lists of possible root devices and their names up to the
machine-independent code and try mounting the devices in the
lists instead of guessing alternative root devices in a machine-
dependent way.
autoconf.c:
Reject preposterous slice numbers instead of silently converting
them to COMPATIBILITY_SLICE.
Don't forget to force slice = COMPATIBILITY_SLICE in the floppy
device name.
Eliminated most magic numbers and magic device names in setroot().
Fixed dozens of style bugs.
vfs_conf.c:
Put the actual root device name instead of "root_device" in the
mount struct if the actual name is available. This is useful after
booting with -s. If it were set in all cases then it could be used
to do mount(8)'s ROOTSLICE_HUNT and fsck(8)'s hotroot guess better.
Diffstat (limited to 'sys/kern/vfs_conf.c')
-rw-r--r-- | sys/kern/vfs_conf.c | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/sys/kern/vfs_conf.c b/sys/kern/vfs_conf.c index 01f4800..3bbc406 100644 --- a/sys/kern/vfs_conf.c +++ b/sys/kern/vfs_conf.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94 - * $Id: vfs_conf.c,v 1.23 1998/04/19 23:31:57 julian Exp $ + * $Id: vfs_conf.c,v 1.24 1998/04/20 03:57:30 julian Exp $ */ /* @@ -71,15 +71,16 @@ MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount struct"); /* * These define the root filesystem, device, and root filesystem type. */ -static struct mount *rootfs; +dev_t rootdevs[] = { NODEV, NODEV }; +char *rootdevnames[2]; struct vnode *rootvnode; char *mountrootfsname; #ifdef SLICE char rootdevice[32]; -#endif /* SLICE */ +#endif #ifdef BOOTP extern void bootpc_init __P((void)); -#endif /* BOOTP */ +#endif /* * vfs_init() will set maxvfsconf @@ -119,8 +120,9 @@ static void vfs_mountrootfs(void *unused) { struct mount *mp; - int err = 0; + int i, err; struct proc *p = curproc; /* XXX */ + dev_t orootdev; #ifdef BOOTP bootpc_init(); @@ -138,20 +140,30 @@ vfs_mountrootfs(void *unused) /* * Attempt the mount */ - err = VFS_MOUNT(mp, NULL, NULL, NULL, p); - /* - * rootdev may be bogus (slice field may be incorrect for disks) - * If slice field is nonzero, clear and retry. - * - * XXX Implicit knowledge of device minor number layout. - * This is placeholder code until saner root mounts arrive with - * DEVFS. - */ - if ((err == ENXIO) && (rootdev & 0xff0000)) { - rootdev &= ~0xff0000; + err = ENXIO; + orootdev = rootdev; + if (rootdevs[0] == NODEV) + rootdevs[0] = rootdev; + for (i = 0; i < sizeof(rootdevs) / sizeof(rootdevs[0]); i++) { + if (rootdevs[i] == NODEV) + break; + rootdev = rootdevs[i]; + if (rootdev != orootdev) { + printf("changing root device to %s\n", rootdevnames[i]); + orootdev = rootdev; + } + strncpy(mp->mnt_stat.f_mntfromname, + rootdevnames[i] ? rootdevnames[i] : ROOTNAME, MNAMELEN - 1); err = VFS_MOUNT(mp, NULL, NULL, NULL, p); + if (err != ENXIO) + break; } if (err) { + /* + * XXX should ask the user for the name in some cases. + * Why do we call vfs_unbusy() here and not after ENXIO + * is returned above? + */ vfs_unbusy(mp, p); /* * free mount struct before failing |