summaryrefslogtreecommitdiffstats
path: root/sys/ufs/mfs
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-11-03 11:02:47 +0000
committermsmith <msmith@FreeBSD.org>1999-11-03 11:02:47 +0000
commit219fe6842a464ef7e072186fbb1cd79e73154c56 (patch)
tree3597b31a080789c1b8136a3478046ee6d1cc9403 /sys/ufs/mfs
parent4a7e87b904b999ae60cdb0f26880f32eb2745e8e (diff)
downloadFreeBSD-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/ufs/mfs')
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c44
1 files changed, 30 insertions, 14 deletions
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index 9b35b46..dcd766e 100644
--- a/sys/ufs/mfs/mfs_vfsops.c
+++ b/sys/ufs/mfs/mfs_vfsops.c
@@ -78,6 +78,7 @@ static int mfs_start __P((struct mount *mp, int flags, struct proc *p));
static int mfs_statfs __P((struct mount *mp, struct statfs *sbp,
struct proc *p));
static int mfs_init __P((struct vfsconf *));
+static void mfs_takeroot __P((void *));
static struct cdevsw mfs_cdevsw = {
/* open */ noopen,
@@ -228,8 +229,14 @@ mfs_mount(mp, path, data, ndp, p)
mfs_rootbase = base;
mfs_rootsize = fs->fs_fsize * fs->fs_size;
- printf("rootfs is %ld Kbyte compiled in MFS\n",
- mfs_rootsize/1024);
+
+ /* remake rootdev, since vfs_mountroot will have it wrong */
+ rootdev = make_dev(&mfs_cdevsw, mfs_minor,
+ 0, 0, 0, "MFS%d", mfs_minor);
+ rootdev->si_bsize_phys = DEV_BSIZE;
+ rootdev->si_iosize_max = DFLTPHYS;
+ mfs_minor++;
+
if ((err = bdevvp(rootdev, &rootvp))) {
printf("mfs_mount: can't find rootvp\n");
return (err);
@@ -486,19 +493,28 @@ mfs_init(vfsp)
{
cdevsw_add(&mfs_cdevsw);
+ return (0);
+}
+
#ifdef MFS_ROOT
+/*
+ * Just before root is mounted, check to see if we are a candidate
+ * to supply it. If we have an image available, override the guessed
+ * defaults.
+ */
+static void
+mfs_takeroot(junk)
+ void *junk;
+{
if (bootverbose)
- printf("Considering MFS root f/s.\n");
+ printf("Considering MFS root f/s...");
if (mfs_getimage()) {
- mountrootfsname = "mfs";
- rootdev = make_dev(&mfs_cdevsw, mfs_minor,
- 0, 0, 0, "MFS%d", mfs_minor);
- /* It is not clear that these will get initialized otherwise */
- rootdev->si_bsize_phys = DEV_BSIZE;
- rootdev->si_iosize_max = DFLTPHYS;
- mfs_minor++;
- } else if (bootverbose)
- printf("No MFS image available as root f/s.\n");
-#endif
- return (0);
+ rootdevnames[0] = "mfs:";
+ printf("preloaded filesystem found.\n");
+ } else if (bootverbose) {
+ printf("not found.\n");
+ }
}
+
+SYSINIT(mfs_root, SI_SUB_MOUNT_ROOT, SI_ORDER_FIRST, mfs_takeroot, NULL);
+#endif
OpenPOWER on IntegriCloud