Use the correct mounted-from path when allocating the root mount, if we know

what it is.

Be more correct in unbusying the mountpoint (especially before freeing it).

Remove support for mounting 'r' devices as root.  You don't mount 'r'
devices anywhere else, and they're going away anyway.

Submitted by:	bde
This commit is contained in:
Mike Smith 1999-11-28 22:20:18 +00:00
parent e2285320a6
commit c0da4cacd0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53858
2 changed files with 14 additions and 14 deletions

View file

@ -186,7 +186,9 @@ vfs_mountroot_try(char *mountfrom)
goto done;
/* allocate a root mount */
if ((error = vfs_rootmountalloc(vfsname, ROOTNAME, &mp))) {
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);
goto done;
@ -201,7 +203,6 @@ vfs_mountroot_try(char *mountfrom)
if (devsw(rootdev) && (devsw(rootdev)->d_flags & D_MEMDISK))
mp->mnt_flag &= ~MNT_RDONLY;
strcpy(mp->mnt_stat.f_mntfromname, path);
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
done:
@ -210,8 +211,10 @@ vfs_mountroot_try(char *mountfrom)
if (path != NULL)
free(path, M_MOUNT);
if (error != 0) {
if (mp != NULL)
if (mp != NULL) {
vfs_unbusy(mp, curproc);
free(mp, M_MOUNT);
}
printf("Root mount failed: %d\n", error);
} else {
@ -222,9 +225,8 @@ vfs_mountroot_try(char *mountfrom)
/* sanity check system clock against root filesystem timestamp */
inittodr(mp->mnt_time);
}
if (mp != NULL)
vfs_unbusy(mp, curproc);
}
return(error);
}
@ -318,8 +320,6 @@ setrootbyname(char *name)
if (cp != NULL) {
name = cp + 1;
}
if (*name == 'r')
name++;
cp = name;
while (cp != '\0' && (*cp < '0' || *cp > '9'))
cp++;

View file

@ -186,7 +186,9 @@ vfs_mountroot_try(char *mountfrom)
goto done;
/* allocate a root mount */
if ((error = vfs_rootmountalloc(vfsname, ROOTNAME, &mp))) {
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);
goto done;
@ -201,7 +203,6 @@ vfs_mountroot_try(char *mountfrom)
if (devsw(rootdev) && (devsw(rootdev)->d_flags & D_MEMDISK))
mp->mnt_flag &= ~MNT_RDONLY;
strcpy(mp->mnt_stat.f_mntfromname, path);
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
done:
@ -210,8 +211,10 @@ vfs_mountroot_try(char *mountfrom)
if (path != NULL)
free(path, M_MOUNT);
if (error != 0) {
if (mp != NULL)
if (mp != NULL) {
vfs_unbusy(mp, curproc);
free(mp, M_MOUNT);
}
printf("Root mount failed: %d\n", error);
} else {
@ -222,9 +225,8 @@ vfs_mountroot_try(char *mountfrom)
/* sanity check system clock against root filesystem timestamp */
inittodr(mp->mnt_time);
}
if (mp != NULL)
vfs_unbusy(mp, curproc);
}
return(error);
}
@ -318,8 +320,6 @@ setrootbyname(char *name)
if (cp != NULL) {
name = cp + 1;
}
if (*name == 'r')
name++;
cp = name;
while (cp != '\0' && (*cp < '0' || *cp > '9'))
cp++;