3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved.
23 */
24
25 /*
26 * Configure root, swap and dump devices.
27 */
28
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/sysmacros.h>
32 #include <sys/signal.h>
33 #include <sys/cred.h>
34 #include <sys/proc.h>
35 #include <sys/user.h>
36 #include <sys/conf.h>
37 #include <sys/buf.h>
38 #include <sys/systm.h>
39 #include <sys/vm.h>
40 #include <sys/reboot.h>
41 #include <sys/file.h>
42 #include <sys/vfs.h>
615
616 /*
617 * Get the name of the root or swap filesystem type, and return
618 * the corresponding entry in the vfs switch.
619 *
620 * If we're not asking the user, and we're trying to find the
621 * root filesystem type, we ask boot for the filesystem
622 * type that it came from and use that. Similarly, if we're
623 * trying to find the swap filesystem, we try and derive it from
624 * the root filesystem type.
625 *
626 * If we are booting via NFS we currently have these options:
627 * nfs - dynamically choose NFS V2. V3, or V4 (default)
628 * nfs2 - force NFS V2
629 * nfs3 - force NFS V3
630 * nfs4 - force NFS V4
631 * Because we need to maintain backward compatibility with the naming
632 * convention that the NFS V2 filesystem name is "nfs" (see vfs_conf.c)
633 * we need to map "nfs" => "nfsdyn" and "nfs2" => "nfs". The dynamic
634 * nfs module will map the type back to either "nfs", "nfs3", or "nfs4".
635 * This is only for root filesystems, all other uses such as cachefs
636 * will expect that "nfs" == NFS V2.
637 *
638 * If the filesystem isn't already loaded, vfs_getvfssw() will load
639 * it for us, but if (at the time we call it) modrootloaded is
640 * still not set, it won't run the filesystems _init routine (and
641 * implicitly it won't run the filesystems vsw_init() entry either).
642 * We do that explicitly in rootconf().
643 */
644 static struct vfssw *
645 getfstype(char *askfor, char *fsname, size_t fsnamelen)
646 {
647 struct vfssw *vsw;
648 static char defaultfs[BO_MAXFSNAME];
649 int root = 0;
650
651 if (strcmp(askfor, "root") == 0) {
652 (void) get_fstype_prop(defaultfs);
653 root++;
654 } else {
655 (void) strcpy(defaultfs, "swapfs");
656 }
|
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright (c) 1982, 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 */
25
26 /*
27 * Configure root, swap and dump devices.
28 */
29
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/sysmacros.h>
33 #include <sys/signal.h>
34 #include <sys/cred.h>
35 #include <sys/proc.h>
36 #include <sys/user.h>
37 #include <sys/conf.h>
38 #include <sys/buf.h>
39 #include <sys/systm.h>
40 #include <sys/vm.h>
41 #include <sys/reboot.h>
42 #include <sys/file.h>
43 #include <sys/vfs.h>
616
617 /*
618 * Get the name of the root or swap filesystem type, and return
619 * the corresponding entry in the vfs switch.
620 *
621 * If we're not asking the user, and we're trying to find the
622 * root filesystem type, we ask boot for the filesystem
623 * type that it came from and use that. Similarly, if we're
624 * trying to find the swap filesystem, we try and derive it from
625 * the root filesystem type.
626 *
627 * If we are booting via NFS we currently have these options:
628 * nfs - dynamically choose NFS V2. V3, or V4 (default)
629 * nfs2 - force NFS V2
630 * nfs3 - force NFS V3
631 * nfs4 - force NFS V4
632 * Because we need to maintain backward compatibility with the naming
633 * convention that the NFS V2 filesystem name is "nfs" (see vfs_conf.c)
634 * we need to map "nfs" => "nfsdyn" and "nfs2" => "nfs". The dynamic
635 * nfs module will map the type back to either "nfs", "nfs3", or "nfs4".
636 * This is only for root filesystems, all other uses will expect
637 * that "nfs" == NFS V2.
638 *
639 * If the filesystem isn't already loaded, vfs_getvfssw() will load
640 * it for us, but if (at the time we call it) modrootloaded is
641 * still not set, it won't run the filesystems _init routine (and
642 * implicitly it won't run the filesystems vsw_init() entry either).
643 * We do that explicitly in rootconf().
644 */
645 static struct vfssw *
646 getfstype(char *askfor, char *fsname, size_t fsnamelen)
647 {
648 struct vfssw *vsw;
649 static char defaultfs[BO_MAXFSNAME];
650 int root = 0;
651
652 if (strcmp(askfor, "root") == 0) {
653 (void) get_fstype_prop(defaultfs);
654 root++;
655 } else {
656 (void) strcpy(defaultfs, "swapfs");
657 }
|