Deleted Added
full compact
vfs_mount.c (122567) vfs_mount.c (122640)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 34 unchanged lines hidden (view full) ---

43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 34 unchanged lines hidden (view full) ---

43 * Redistribution and use in source and binary forms, with or without
44 * modification, are permitted provided that the following conditions
45 * are met:
46 * 1. Redistributions of source code must retain the above copyright
47 * notice, this list of conditions and the following disclaimer.
48 * 2. Redistributions in binary form must reproduce the above copyright
49 * notice, this list of conditions and the following disclaimer in the
50 * documentation and/or other materials provided with the distribution.
51 *
51 *
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 */
64
65#include <sys/cdefs.h>
52 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
53 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
55 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
56 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
58 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
59 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
60 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
61 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * SUCH DAMAGE.
63 */
64
65#include <sys/cdefs.h>
66__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 122567 2003-11-12 17:09:12Z peter $");
66__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 122640 2003-11-14 05:27:41Z kan $");
67
68#include <sys/param.h>
69#include <sys/conf.h>
70#include <sys/cons.h>
71#include <sys/kernel.h>
72#include <sys/linker.h>
73#include <sys/mac.h>
74#include <sys/malloc.h>

--- 17 unchanged lines hidden (view full) ---

92#include "opt_rootdevname.h"
93#include "opt_ddb.h"
94#include "opt_mac.h"
95
96#ifdef DDB
97#include <ddb/ddb.h>
98#endif
99
67
68#include <sys/param.h>
69#include <sys/conf.h>
70#include <sys/cons.h>
71#include <sys/kernel.h>
72#include <sys/linker.h>
73#include <sys/mac.h>
74#include <sys/malloc.h>

--- 17 unchanged lines hidden (view full) ---

92#include "opt_rootdevname.h"
93#include "opt_ddb.h"
94#include "opt_mac.h"
95
96#ifdef DDB
97#include <ddb/ddb.h>
98#endif
99
100#define ROOTNAME "root_device"
100#define ROOTNAME "root_device"
101#define VFS_MOUNTARG_SIZE_MAX (1024 * 64)
101
102static void checkdirs(struct vnode *olddp, struct vnode *newdp);
102
103static void checkdirs(struct vnode *olddp, struct vnode *newdp);
103static int vfs_nmount(struct thread *td, int, struct uio *);
104static int vfs_mountroot_try(char *mountfrom);
105static int vfs_mountroot_ask(void);
106static int vfs_mount_alloc(struct vnode *, struct vfsconf *,
107 const char *, struct thread *, struct mount **);
108static int vfs_domount(struct thread *, const char *, char *,
109 int fsflags, void *fsdata, int compat);
110static void gets(char *cp);
104static void gets(char *cp);
105static int vfs_domount(struct thread *td, const char *fstype,
106 char *fspath, int fsflags, void *fsdata, int compat);
107static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp,
108 const char *fspath, struct thread *td, struct mount **mpp);
109static int vfs_mountroot_ask(void);
110static int vfs_mountroot_try(char *mountfrom);
111static int vfs_nmount(struct thread *td, int fsflags, struct uio *fsopts);
111
112static int usermount = 0; /* if 1, non-root can mount fs. */
113SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, "");
114
115MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount structure");
116
117/* List of mounted filesystems. */
118struct mntlist mountlist = TAILQ_HEAD_INITIALIZER(mountlist);

--- 13 unchanged lines hidden (view full) ---

132 *
133 * <vfsname>:[<path>]
134 * vfsname := the name of a VFS known to the kernel and capable
135 * of being mounted as root
136 * path := disk device name or other data used by the filesystem
137 * to locate its physical store
138 */
139
112
113static int usermount = 0; /* if 1, non-root can mount fs. */
114SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, "");
115
116MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount structure");
117
118/* List of mounted filesystems. */
119struct mntlist mountlist = TAILQ_HEAD_INITIALIZER(mountlist);

--- 13 unchanged lines hidden (view full) ---

133 *
134 * <vfsname>:[<path>]
135 * vfsname := the name of a VFS known to the kernel and capable
136 * of being mounted as root
137 * path := disk device name or other data used by the filesystem
138 * to locate its physical store
139 */
140
140/*
141/*
141 * The root specifiers we will try if RB_CDROM is specified.
142 */
143static char *cdrom_rootdevnames[] = {
144 "cd9660:cd0",
145 "cd9660:acd0",
146 NULL
147};
148

--- 86 unchanged lines hidden (view full) ---

235 }
236 }
237 }
238}
239
240/*
241 * Build a linked list of mount options from a struct uio.
242 */
142 * The root specifiers we will try if RB_CDROM is specified.
143 */
144static char *cdrom_rootdevnames[] = {
145 "cd9660:cd0",
146 "cd9660:acd0",
147 NULL
148};
149

--- 86 unchanged lines hidden (view full) ---

236 }
237 }
238 }
239}
240
241/*
242 * Build a linked list of mount options from a struct uio.
243 */
243#define VFS_MOUNTARG_SIZE_MAX (1024*64)
244
245static int
246vfs_buildopts(struct uio *auio, struct vfsoptlist **options)
247{
248 struct vfsoptlist *opts;
249 struct vfsopt *opt;
244static int
245vfs_buildopts(struct uio *auio, struct vfsoptlist **options)
246{
247 struct vfsoptlist *opts;
248 struct vfsopt *opt;
249 size_t memused;
250 unsigned int i, iovcnt;
251 int error, namelen, optlen;
250 unsigned int i, iovcnt;
251 int error, namelen, optlen;
252 size_t memused = 0;
253
252
254 iovcnt = auio->uio_iovcnt;
255 opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
256 TAILQ_INIT(opts);
253 opts = malloc(sizeof(struct vfsoptlist), M_MOUNT, M_WAITOK);
254 TAILQ_INIT(opts);
255 memused = 0;
256 iovcnt = auio->uio_iovcnt;
257 for (i = 0; i < iovcnt; i += 2) {
258 opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK);
259 namelen = auio->uio_iov[i].iov_len;
260 optlen = auio->uio_iov[i + 1].iov_len;
261 opt->name = malloc(namelen, M_MOUNT, M_WAITOK);
262 opt->value = NULL;
263 opt->len = optlen;
264
265 /*
266 * Do this early, so jumps to "bad" will free the current
257 for (i = 0; i < iovcnt; i += 2) {
258 opt = malloc(sizeof(struct vfsopt), M_MOUNT, M_WAITOK);
259 namelen = auio->uio_iov[i].iov_len;
260 optlen = auio->uio_iov[i + 1].iov_len;
261 opt->name = malloc(namelen, M_MOUNT, M_WAITOK);
262 opt->value = NULL;
263 opt->len = optlen;
264
265 /*
266 * Do this early, so jumps to "bad" will free the current
267 * option
267 * option.
268 */
269 TAILQ_INSERT_TAIL(opts, opt, link);
268 */
269 TAILQ_INSERT_TAIL(opts, opt, link);
270 memused += sizeof (struct vfsopt) + optlen + namelen;
270 memused += sizeof(struct vfsopt) + optlen + namelen;
271
272 /*
273 * Avoid consuming too much memory, and attempts to overflow
271
272 /*
273 * Avoid consuming too much memory, and attempts to overflow
274 * memused
274 * memused.
275 */
276 if (memused > VFS_MOUNTARG_SIZE_MAX ||
277 optlen > VFS_MOUNTARG_SIZE_MAX ||
278 namelen > VFS_MOUNTARG_SIZE_MAX) {
279 error = EINVAL;
280 goto bad;
281 }
282
283 if (auio->uio_segflg == UIO_SYSSPACE) {
284 bcopy(auio->uio_iov[i].iov_base, opt->name, namelen);
285 } else {
286 error = copyin(auio->uio_iov[i].iov_base, opt->name,
287 namelen);
288 if (error)
289 goto bad;
290 }
275 */
276 if (memused > VFS_MOUNTARG_SIZE_MAX ||
277 optlen > VFS_MOUNTARG_SIZE_MAX ||
278 namelen > VFS_MOUNTARG_SIZE_MAX) {
279 error = EINVAL;
280 goto bad;
281 }
282
283 if (auio->uio_segflg == UIO_SYSSPACE) {
284 bcopy(auio->uio_iov[i].iov_base, opt->name, namelen);
285 } else {
286 error = copyin(auio->uio_iov[i].iov_base, opt->name,
287 namelen);
288 if (error)
289 goto bad;
290 }
291 /* Ensure names are null-terminated strings */
291 /* Ensure names are null-terminated strings. */
292 if (opt->name[namelen - 1] != '\0') {
292 if (opt->name[namelen - 1] != '\0') {
293 error = EINVAL;
294 goto bad;
293 error = EINVAL;
294 goto bad;
295 }
296 if (optlen != 0) {
297 opt->value = malloc(optlen, M_MOUNT, M_WAITOK);
298 if (auio->uio_segflg == UIO_SYSSPACE) {
299 bcopy(auio->uio_iov[i + 1].iov_base, opt->value,
300 optlen);
301 } else {
302 error = copyin(auio->uio_iov[i + 1].iov_base,

--- 207 unchanged lines hidden (view full) ---

510#ifdef MAC
511 mac_init_mount(mp);
512 mac_create_mount(td->td_ucred, mp);
513#endif
514 *mpp = mp;
515 return (0);
516}
517
295 }
296 if (optlen != 0) {
297 opt->value = malloc(optlen, M_MOUNT, M_WAITOK);
298 if (auio->uio_segflg == UIO_SYSSPACE) {
299 bcopy(auio->uio_iov[i + 1].iov_base, opt->value,
300 optlen);
301 } else {
302 error = copyin(auio->uio_iov[i + 1].iov_base,

--- 207 unchanged lines hidden (view full) ---

510#ifdef MAC
511 mac_init_mount(mp);
512 mac_create_mount(td->td_ucred, mp);
513#endif
514 *mpp = mp;
515 return (0);
516}
517
518/*
519 * Destroy the mount struct previously allocated by vfs_mount_alloc().
520 */
518void
519vfs_mount_destroy(struct mount *mp, struct thread *td)
520{
521
522 mp->mnt_vfc->vfc_refcount--;
523 if (!TAILQ_EMPTY(&mp->mnt_nvnodelist))
524 panic("unmount: dangling vnode");
525 vfs_unbusy(mp,td);

--- 10 unchanged lines hidden (view full) ---

536 free(mp, M_MOUNT);
537}
538
539static int
540vfs_nmount(struct thread *td, int fsflags, struct uio *fsoptions)
541{
542 struct vfsoptlist *optlist;
543 char *fstype, *fspath;
521void
522vfs_mount_destroy(struct mount *mp, struct thread *td)
523{
524
525 mp->mnt_vfc->vfc_refcount--;
526 if (!TAILQ_EMPTY(&mp->mnt_nvnodelist))
527 panic("unmount: dangling vnode");
528 vfs_unbusy(mp,td);

--- 10 unchanged lines hidden (view full) ---

539 free(mp, M_MOUNT);
540}
541
542static int
543vfs_nmount(struct thread *td, int fsflags, struct uio *fsoptions)
544{
545 struct vfsoptlist *optlist;
546 char *fstype, *fspath;
544 int fstypelen, fspathlen;
545 int error;
547 int error, fstypelen, fspathlen;
546
547 error = vfs_buildopts(fsoptions, &optlist);
548 if (error)
549 return (error);
550
551 /*
552 * We need these two options before the others,
553 * and they are mandatory for any filesystem.

--- 78 unchanged lines hidden (view full) ---

632 *
633 * This routine is designed to be a "generic" entry point for routines
634 * that wish to mount a filesystem. All parameters except `fsdata' are
635 * pointers into kernel space. `fsdata' is currently still a pointer
636 * into userspace.
637 */
638int
639vfs_mount(td, fstype, fspath, fsflags, fsdata)
548
549 error = vfs_buildopts(fsoptions, &optlist);
550 if (error)
551 return (error);
552
553 /*
554 * We need these two options before the others,
555 * and they are mandatory for any filesystem.

--- 78 unchanged lines hidden (view full) ---

634 *
635 * This routine is designed to be a "generic" entry point for routines
636 * that wish to mount a filesystem. All parameters except `fsdata' are
637 * pointers into kernel space. `fsdata' is currently still a pointer
638 * into userspace.
639 */
640int
641vfs_mount(td, fstype, fspath, fsflags, fsdata)
640 struct thread *td;
641 const char *fstype;
642 char *fspath;
643 int fsflags;
644 void *fsdata;
642 struct thread *td;
643 const char *fstype;
644 char *fspath;
645 int fsflags;
646 void *fsdata;
645{
647{
646 return (vfs_domount(td,fstype, fspath, fsflags, fsdata, 1));
648
649 return (vfs_domount(td, fstype, fspath, fsflags, fsdata, 1));
647}
648
649/*
650 * vfs_domount(): actually attempt a filesystem mount.
651 */
652static int
653vfs_domount(
650}
651
652/*
653 * vfs_domount(): actually attempt a filesystem mount.
654 */
655static int
656vfs_domount(
654 struct thread *td,
655 const char *fstype,
656 char *fspath,
657 int fsflags,
658 void *fsdata,
659 int compat)
657 struct thread *td, /* Flags common to all filesystems. */
658 const char *fstype, /* Filesystem type. */
659 char *fspath, /* Mount path. */
660 int fsflags, /* Flags common to all filesystems. */
661 void *fsdata, /* Options local to the filesystem. */
662 int compat /* Invocation from compat syscall. */
663 )
660{
661 linker_file_t lf;
662 struct vnode *vp;
663 struct mount *mp;
664 struct vfsconf *vfsp;
665 int error, flag = 0, kern_flag = 0;
666 struct vattr va;
667 struct nameidata nd;
668
669 /*
670 * Be ultra-paranoid about making sure the type and fspath
671 * variables will fit in our mp buffers, including the
672 * terminating NUL.
673 */
674 if (strlen(fstype) >= MFSNAMELEN || strlen(fspath) >= MNAMELEN)
675 return (ENAMETOOLONG);
676
677 if (usermount == 0) {
664{
665 linker_file_t lf;
666 struct vnode *vp;
667 struct mount *mp;
668 struct vfsconf *vfsp;
669 int error, flag = 0, kern_flag = 0;
670 struct vattr va;
671 struct nameidata nd;
672
673 /*
674 * Be ultra-paranoid about making sure the type and fspath
675 * variables will fit in our mp buffers, including the
676 * terminating NUL.
677 */
678 if (strlen(fstype) >= MFSNAMELEN || strlen(fspath) >= MNAMELEN)
679 return (ENAMETOOLONG);
680
681 if (usermount == 0) {
678 error = suser(td);
682 error = suser(td);
679 if (error)
680 return (error);
681 }
682 /*
683 * Do not allow NFS export by non-root users.
684 */
685 if (fsflags & MNT_EXPORTED) {
686 error = suser(td);

--- 174 unchanged lines hidden (view full) ---

861 mp->mnt_flag &=~ MNT_UPDATEMASK;
862 mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE);
863 /*
864 * Mount the filesystem.
865 * XXX The final recipients of VFS_MOUNT just overwrite the ndp they
866 * get. No freeing of cn_pnbuf.
867 */
868 error = compat? VFS_MOUNT(mp, fspath, fsdata, &nd, td) :
683 if (error)
684 return (error);
685 }
686 /*
687 * Do not allow NFS export by non-root users.
688 */
689 if (fsflags & MNT_EXPORTED) {
690 error = suser(td);

--- 174 unchanged lines hidden (view full) ---

865 mp->mnt_flag &=~ MNT_UPDATEMASK;
866 mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE);
867 /*
868 * Mount the filesystem.
869 * XXX The final recipients of VFS_MOUNT just overwrite the ndp they
870 * get. No freeing of cn_pnbuf.
871 */
872 error = compat? VFS_MOUNT(mp, fspath, fsdata, &nd, td) :
869 VFS_NMOUNT(mp, &nd, td);
873 VFS_NMOUNT(mp, &nd, td);
870 if (!error) {
871 if (mp->mnt_opt != NULL)
872 vfs_freeopts(mp->mnt_opt);
873 mp->mnt_opt = mp->mnt_optnew;
874 }
875 /*
874 if (!error) {
875 if (mp->mnt_opt != NULL)
876 vfs_freeopts(mp->mnt_opt);
877 mp->mnt_opt = mp->mnt_optnew;
878 }
879 /*
876 * Prevent external consumers of mount
877 * options to read mnt_optnew.
878 */
880 * Prevent external consumers of mount options from reading
881 * mnt_optnew.
882 */
879 mp->mnt_optnew = NULL;
880 if (mp->mnt_flag & MNT_UPDATE) {
881 if (mp->mnt_kern_flag & MNTK_WANTRDWR)
882 mp->mnt_flag &= ~MNT_RDONLY;
883 mp->mnt_flag &=~
884 (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | MNT_SNAPSHOT);
885 mp->mnt_kern_flag &=~ MNTK_WANTRDWR;
886 if (error) {

--- 39 unchanged lines hidden (view full) ---

926 error = vfs_allocate_syncvnode(mp);
927 vfs_unbusy(mp, td);
928 if ((error = VFS_START(mp, 0, td)) != 0)
929 vrele(vp);
930 } else {
931 VI_LOCK(vp);
932 vp->v_iflag &= ~VI_MOUNT;
933 VI_UNLOCK(vp);
883 mp->mnt_optnew = NULL;
884 if (mp->mnt_flag & MNT_UPDATE) {
885 if (mp->mnt_kern_flag & MNTK_WANTRDWR)
886 mp->mnt_flag &= ~MNT_RDONLY;
887 mp->mnt_flag &=~
888 (MNT_UPDATE | MNT_RELOAD | MNT_FORCE | MNT_SNAPSHOT);
889 mp->mnt_kern_flag &=~ MNTK_WANTRDWR;
890 if (error) {

--- 39 unchanged lines hidden (view full) ---

930 error = vfs_allocate_syncvnode(mp);
931 vfs_unbusy(mp, td);
932 if ((error = VFS_START(mp, 0, td)) != 0)
933 vrele(vp);
934 } else {
935 VI_LOCK(vp);
936 vp->v_iflag &= ~VI_MOUNT;
937 VI_UNLOCK(vp);
934
935 vfs_mount_destroy(mp, td);
936 vput(vp);
937 }
938 return (error);
939}
940
941/*
942 * Scan all active processes to see if any of them have a current

--- 232 unchanged lines hidden (view full) ---

1175
1176 if (fstypename == NULL)
1177 return (ENODEV);
1178 for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
1179 if (!strcmp(vfsp->vfc_name, fstypename))
1180 break;
1181 if (vfsp == NULL)
1182 return (ENODEV);
938 vfs_mount_destroy(mp, td);
939 vput(vp);
940 }
941 return (error);
942}
943
944/*
945 * Scan all active processes to see if any of them have a current

--- 232 unchanged lines hidden (view full) ---

1178
1179 if (fstypename == NULL)
1180 return (ENODEV);
1181 for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
1182 if (!strcmp(vfsp->vfc_name, fstypename))
1183 break;
1184 if (vfsp == NULL)
1185 return (ENODEV);
1183
1184 error = vfs_mount_alloc(NULLVP, vfsp, "/", td, &mp);
1185 if (error)
1186 return (error);
1186 error = vfs_mount_alloc(NULLVP, vfsp, "/", td, &mp);
1187 if (error)
1188 return (error);
1187
1188 mp->mnt_flag |= MNT_RDONLY | MNT_ROOTFS;
1189 strlcpy(mp->mnt_stat.f_mntfromname, devname, MNAMELEN);
1189 mp->mnt_flag |= MNT_RDONLY | MNT_ROOTFS;
1190 strlcpy(mp->mnt_stat.f_mntfromname, devname, MNAMELEN);
1190
1191 *mpp = mp;
1192 return (0);
1193}
1194
1195/*
1196 * Find and mount the root filesystem
1197 */
1198void
1199vfs_mountroot(void)
1200{
1191 *mpp = mp;
1192 return (0);
1193}
1194
1195/*
1196 * Find and mount the root filesystem
1197 */
1198void
1199vfs_mountroot(void)
1200{
1201 char *cp;
1202 int i, error;
1201 char *cp;
1202 int error, i;
1203
1204 g_waitidle();
1205
1206 /*
1207 * The root filesystem information is compiled in, and we are
1208 * booted with instructions to use it.
1209 */
1210#ifdef ROOTDEVNAME
1203
1204 g_waitidle();
1205
1206 /*
1207 * The root filesystem information is compiled in, and we are
1208 * booted with instructions to use it.
1209 */
1210#ifdef ROOTDEVNAME
1211 if ((boothowto & RB_DFLTROOT) &&
1212 !vfs_mountroot_try(ROOTDEVNAME))
1211 if ((boothowto & RB_DFLTROOT) && !vfs_mountroot_try(ROOTDEVNAME))
1213 return;
1214#endif
1215 /*
1216 * We are booted with instructions to prompt for the root filesystem,
1217 * or to use the compiled-in default when it doesn't exist.
1218 */
1219 if (boothowto & (RB_DFLTROOT | RB_ASKNAME)) {
1220 if (!vfs_mountroot_ask())

--- 321 unchanged lines hidden ---
1212 return;
1213#endif
1214 /*
1215 * We are booted with instructions to prompt for the root filesystem,
1216 * or to use the compiled-in default when it doesn't exist.
1217 */
1218 if (boothowto & (RB_DFLTROOT | RB_ASKNAME)) {
1219 if (!vfs_mountroot_ask())

--- 321 unchanged lines hidden ---