summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-11-25 09:47:51 +0000
committerphk <phk@FreeBSD.org>2004-11-25 09:47:51 +0000
commitdc8dcdc3f335be2f9cef536af14cf3f7af38e5d7 (patch)
tree865e2b2057cf99e46b5317fe519d6797478f2f7b /sys/kern/vfs_mount.c
parent52c7e742ee5cbc42df2e3e067f6203b9012be878 (diff)
downloadFreeBSD-src-dc8dcdc3f335be2f9cef536af14cf3f7af38e5d7.zip
FreeBSD-src-dc8dcdc3f335be2f9cef536af14cf3f7af38e5d7.tar.gz
Integrate the relevant bits of vfs_rootmountalloc() where it matters.
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c56
1 files changed, 18 insertions, 38 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 25fe589..917d4e2 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1166,37 +1166,6 @@ dounmount(mp, flags, td)
}
/*
- * Lookup a filesystem type, and if found allocate and initialize
- * a mount structure for it.
- *
- * Devname is usually updated by mount(8) after booting.
- */
-int
-vfs_rootmountalloc(fstypename, devname, mpp)
- char *fstypename;
- char *devname;
- struct mount **mpp;
-{
- struct thread *td = curthread; /* XXX */
- struct vfsconf *vfsp;
- struct mount *mp;
- int error;
-
- if (fstypename == NULL)
- return (ENODEV);
- vfsp = vfs_byname(fstypename);
- if (vfsp == NULL)
- return (ENODEV);
- error = vfs_mount_alloc(NULLVP, vfsp, "/", td, &mp);
- if (error)
- return (error);
- mp->mnt_flag |= MNT_RDONLY | MNT_ROOTFS;
- strlcpy(mp->mnt_stat.f_mntfromname, devname, MNAMELEN);
- *mpp = mp;
- return (0);
-}
-
-/*
* Find and mount the root filesystem
*/
void
@@ -1289,6 +1258,8 @@ static int
vfs_mountroot_try(const char *mountfrom)
{
struct mount *mp;
+ struct thread *td = curthread;
+ struct vfsconf *vfsp;
char *vfsname, *path;
int error;
char patt[32];
@@ -1303,7 +1274,7 @@ vfs_mountroot_try(const char *mountfrom)
return (error); /* don't complain */
s = splcam(); /* Overkill, but annoying without it */
- printf("Mounting root from %s\n", mountfrom);
+ printf("Trying to mount root from %s\n", mountfrom);
splx(s);
/* parse vfs name and path */
@@ -1314,14 +1285,23 @@ vfs_mountroot_try(const char *mountfrom)
if (sscanf(mountfrom, patt, vfsname, path) < 1)
goto done;
- /* allocate a root mount */
- error = vfs_rootmountalloc(vfsname, path[0] != 0 ? path : ROOTNAME,
- &mp);
- if (error != 0) {
- printf("Can't allocate root mount for filesystem '%s': %d\n",
- vfsname, error);
+ if (path[0] == '\0')
+ strcpy(path, ROOTNAME);
+
+ vfsp = vfs_byname(vfsname);
+ if (vfsp == NULL) {
+ printf("Can't find filesystem \"%s\"\n", vfsname);
goto done;
}
+ error = vfs_mount_alloc(NULLVP, vfsp, "/", td, &mp);
+ if (error) {
+ printf("Could not alloc mountpoint\n");
+ goto done;
+ }
+
+ mp->mnt_flag |= MNT_RDONLY | MNT_ROOTFS;
+
+ strlcpy(mp->mnt_stat.f_mntfromname, path, MNAMELEN);
/*
* do our best to set rootdev
OpenPOWER on IntegriCloud