]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
2d21ac55 | 2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. |
5d5c5d0d | 3 | * |
2d21ac55 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
2d21ac55 A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. The rights granted to you under the License | |
10 | * may not be used to create, or enable the creation or redistribution of, | |
11 | * unlawful or unlicensed copies of an Apple operating system, or to | |
12 | * circumvent, violate, or enable the circumvention or violation of, any | |
13 | * terms of an Apple operating system software license agreement. | |
8f6c56a5 | 14 | * |
2d21ac55 A |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. | |
17 | * | |
18 | * The Original Code and all software distributed under the License are | |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
8f6c56a5 A |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
2d21ac55 A |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and | |
24 | * limitations under the License. | |
8f6c56a5 | 25 | * |
2d21ac55 | 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
1c79356b A |
27 | */ |
28 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
29 | /* | |
30 | * Copyright (c) 1989, 1993, 1995 | |
31 | * The Regents of the University of California. All rights reserved. | |
32 | * | |
33 | * Redistribution and use in source and binary forms, with or without | |
34 | * modification, are permitted provided that the following conditions | |
35 | * are met: | |
36 | * 1. Redistributions of source code must retain the above copyright | |
37 | * notice, this list of conditions and the following disclaimer. | |
38 | * 2. Redistributions in binary form must reproduce the above copyright | |
39 | * notice, this list of conditions and the following disclaimer in the | |
40 | * documentation and/or other materials provided with the distribution. | |
41 | * 3. All advertising materials mentioning features or use of this software | |
42 | * must display the following acknowledgement: | |
43 | * This product includes software developed by the University of | |
44 | * California, Berkeley and its contributors. | |
45 | * 4. Neither the name of the University nor the names of its contributors | |
46 | * may be used to endorse or promote products derived from this software | |
47 | * without specific prior written permission. | |
48 | * | |
49 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
50 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
51 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
59 | * SUCH DAMAGE. | |
60 | * | |
61 | * @(#)vfs_conf.c 8.11 (Berkeley) 5/10/95 | |
62 | */ | |
2d21ac55 A |
63 | /* |
64 | * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce | |
65 | * support for mandatory and extensible security protections. This notice | |
66 | * is included in support of clause 2.2 (b) of the Apple Public License, | |
67 | * Version 2.0. | |
68 | */ | |
1c79356b A |
69 | |
70 | #include <sys/param.h> | |
71 | #include <sys/systm.h> | |
91447636 A |
72 | #include <sys/mount_internal.h> |
73 | #include <sys/vnode_internal.h> | |
1c79356b | 74 | |
b0d623f7 A |
75 | #ifndef __LP64__ |
76 | #define VFS_THREAD_SAFE_FLAG VFC_VFSTHREADSAFE /* This is only defined for 32-bit */ | |
77 | #else | |
78 | #define VFS_THREAD_SAFE_FLAG 0 | |
79 | #endif /* __LP64__ */ | |
80 | ||
81 | ||
1c79356b A |
82 | /* |
83 | * These define the root filesystem, device, and root filesystem type. | |
84 | */ | |
85 | struct mount *rootfs; | |
86 | struct vnode *rootvnode; | |
b7266188 A |
87 | |
88 | #ifdef CONFIG_IMGSRC_ACCESS | |
6d2010ae A |
89 | struct vnode *imgsrc_rootvnodes[MAX_IMAGEBOOT_NESTING]; /* [0] -> source volume, [1] -> first disk image */ |
90 | #endif /* CONFIG_IMGSRC_ACCESS */ | |
b7266188 | 91 | |
2d21ac55 | 92 | int (*mountroot)(void) = NULL; |
1c79356b A |
93 | |
94 | /* | |
95 | * Set up the initial array of known filesystem types. | |
96 | */ | |
1c79356b | 97 | extern struct vfsops mfs_vfsops; |
2d21ac55 | 98 | extern int mfs_mountroot(mount_t, vnode_t, vfs_context_t); /* dead */ |
1c79356b | 99 | extern struct vfsops hfs_vfsops; |
2d21ac55 | 100 | extern int hfs_mountroot(mount_t, vnode_t, vfs_context_t); |
1c79356b | 101 | extern struct vfsops nfs_vfsops; |
2d21ac55 | 102 | extern int nfs_mountroot(void); |
1c79356b | 103 | extern struct vfsops afs_vfsops; |
1c79356b | 104 | extern struct vfsops null_vfsops; |
1c79356b A |
105 | extern struct vfsops devfs_vfsops; |
106 | ||
2d21ac55 A |
107 | /* |
108 | * For nfs_mountroot(void) cast. nfs_mountroot ignores its parameters, if | |
109 | * invoked through this table. | |
110 | */ | |
111 | typedef int (*mountroot_t)(mount_t, vnode_t, vfs_context_t); | |
112 | ||
1c79356b A |
113 | /* |
114 | * Set up the filesystem operations for vnodes. | |
115 | */ | |
6601e61a | 116 | static struct vfstable vfstbllist[] = { |
1c79356b A |
117 | /* HFS/HFS+ Filesystem */ |
118 | #if HFS | |
6d2010ae | 119 | { &hfs_vfsops, "hfs", 17, 0, (MNT_LOCAL | MNT_DOVOLFS), hfs_mountroot, NULL, 0, 0, VFC_VFSLOCALARGS | VFC_VFSREADDIR_EXTENDED | VFS_THREAD_SAFE_FLAG | VFC_VFS64BITREADY | VFC_VFSVNOP_PAGEOUTV2 | VFC_VFSVNOP_PAGEINV2, NULL, 0}, |
1c79356b A |
120 | #endif |
121 | ||
1c79356b | 122 | /* Memory-based Filesystem */ |
b0d623f7 A |
123 | |
124 | #ifndef __LP64__ | |
1c79356b | 125 | #if MFS |
b0d623f7 | 126 | { &mfs_vfsops, "mfs", 3, 0, MNT_LOCAL, mfs_mountroot, NULL, 0, 0, VFC_VFSGENERICARGS, NULL, 0}, |
1c79356b | 127 | #endif |
b0d623f7 | 128 | #endif /* __LP64__ */ |
1c79356b A |
129 | |
130 | /* Sun-compatible Network Filesystem */ | |
131 | #if NFSCLIENT | |
b0d623f7 | 132 | { &nfs_vfsops, "nfs", 2, 0, 0, NULL, NULL, 0, 0, VFC_VFSGENERICARGS | VFC_VFSPREFLIGHT | VFS_THREAD_SAFE_FLAG | VFC_VFS64BITREADY | VFC_VFSREADDIR_EXTENDED, NULL, 0}, |
1c79356b A |
133 | #endif |
134 | ||
135 | /* Andrew Filesystem */ | |
b0d623f7 | 136 | #ifndef __LP64__ |
1c79356b | 137 | #if AFS |
b0d623f7 | 138 | { &afs_vfsops, "andrewfs", 13, 0, 0, afs_mountroot, NULL, 0, 0, VFC_VFSGENERICARGS , NULL, 0}, |
1c79356b | 139 | #endif |
b0d623f7 | 140 | #endif /* __LP64__ */ |
1c79356b | 141 | |
1c79356b A |
142 | /* Device Filesystem */ |
143 | #if DEVFS | |
2d21ac55 | 144 | #if CONFIG_MACF |
b0d623f7 | 145 | { &devfs_vfsops, "devfs", 19, 0, (MNT_DONTBROWSE | MNT_MULTILABEL), NULL, NULL, 0, 0, VFC_VFSGENERICARGS | VFS_THREAD_SAFE_FLAG | VFC_VFS64BITREADY, NULL, 0}, |
2d21ac55 | 146 | #else |
b0d623f7 | 147 | { &devfs_vfsops, "devfs", 19, 0, MNT_DONTBROWSE, NULL, NULL, 0, 0, VFC_VFSGENERICARGS | VFS_THREAD_SAFE_FLAG | VFC_VFS64BITREADY, NULL, 0}, |
2d21ac55 | 148 | #endif /* MAC */ |
1c79356b | 149 | #endif |
9bccf70c | 150 | |
b0d623f7 A |
151 | #ifndef __LP64__ |
152 | #endif /* __LP64__ */ | |
2d21ac55 | 153 | |
b0d623f7 A |
154 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, |
155 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
156 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
157 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
158 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
159 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
160 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
161 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
162 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
163 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
164 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
165 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
166 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
167 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0}, | |
168 | {NULL, "<unassigned>", 0, 0, 0, NULL, NULL, 0, 0, 0, NULL, 0} | |
1c79356b A |
169 | }; |
170 | ||
171 | /* | |
172 | * Initially the size of the list, vfs_init will set maxvfsconf | |
173 | * to the highest defined type number. | |
174 | */ | |
6601e61a | 175 | int maxvfsslots = sizeof(vfstbllist) / sizeof (struct vfstable); |
1c79356b | 176 | int numused_vfsslots = 0; |
6601e61a A |
177 | int maxvfsconf = sizeof(vfstbllist) / sizeof (struct vfstable); |
178 | struct vfstable *vfsconf = vfstbllist; | |
1c79356b A |
179 | |
180 | /* | |
181 | * | |
182 | * vfs_opv_descs enumerates the list of vnode classes, each with it's own | |
183 | * vnode operation vector. It is consulted at system boot to build operation | |
184 | * vectors. It is NULL terminated. | |
185 | * | |
186 | */ | |
1c79356b A |
187 | extern struct vnodeopv_desc mfs_vnodeop_opv_desc; |
188 | extern struct vnodeopv_desc dead_vnodeop_opv_desc; | |
2d21ac55 | 189 | #if FIFO && SOCKETS |
1c79356b | 190 | extern struct vnodeopv_desc fifo_vnodeop_opv_desc; |
2d21ac55 | 191 | #endif /* SOCKETS */ |
1c79356b A |
192 | extern struct vnodeopv_desc spec_vnodeop_opv_desc; |
193 | extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc; | |
194 | extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc; | |
195 | extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc; | |
2d21ac55 A |
196 | extern struct vnodeopv_desc nfsv4_vnodeop_opv_desc; |
197 | extern struct vnodeopv_desc spec_nfsv4nodeop_opv_desc; | |
198 | extern struct vnodeopv_desc fifo_nfsv4nodeop_opv_desc; | |
1c79356b | 199 | extern struct vnodeopv_desc null_vnodeop_opv_desc; |
1c79356b | 200 | extern struct vnodeopv_desc hfs_vnodeop_opv_desc; |
b0d623f7 | 201 | extern struct vnodeopv_desc hfs_std_vnodeop_opv_desc; |
1c79356b A |
202 | extern struct vnodeopv_desc hfs_specop_opv_desc; |
203 | extern struct vnodeopv_desc hfs_fifoop_opv_desc; | |
1c79356b A |
204 | extern struct vnodeopv_desc devfs_vnodeop_opv_desc; |
205 | extern struct vnodeopv_desc devfs_spec_vnodeop_opv_desc; | |
b0d623f7 A |
206 | #if FDESC |
207 | extern struct vnodeopv_desc devfs_devfd_vnodeop_opv_desc; | |
208 | extern struct vnodeopv_desc devfs_fdesc_vnodeop_opv_desc; | |
209 | #endif /* FDESC */ | |
1c79356b A |
210 | |
211 | struct vnodeopv_desc *vfs_opv_descs[] = { | |
1c79356b | 212 | &dead_vnodeop_opv_desc, |
2d21ac55 | 213 | #if FIFO && SOCKETS |
1c79356b A |
214 | &fifo_vnodeop_opv_desc, |
215 | #endif | |
216 | &spec_vnodeop_opv_desc, | |
1c79356b A |
217 | #if MFS |
218 | &mfs_vnodeop_opv_desc, | |
219 | #endif | |
220 | #if NFSCLIENT | |
221 | &nfsv2_vnodeop_opv_desc, | |
222 | &spec_nfsv2nodeop_opv_desc, | |
2d21ac55 A |
223 | &nfsv4_vnodeop_opv_desc, |
224 | &spec_nfsv4nodeop_opv_desc, | |
1c79356b A |
225 | #if FIFO |
226 | &fifo_nfsv2nodeop_opv_desc, | |
2d21ac55 | 227 | &fifo_nfsv4nodeop_opv_desc, |
1c79356b A |
228 | #endif |
229 | #endif | |
1c79356b A |
230 | #if HFS |
231 | &hfs_vnodeop_opv_desc, | |
b0d623f7 | 232 | &hfs_std_vnodeop_opv_desc, |
1c79356b A |
233 | &hfs_specop_opv_desc, |
234 | #if FIFO | |
235 | &hfs_fifoop_opv_desc, | |
236 | #endif | |
237 | #endif | |
1c79356b A |
238 | #if DEVFS |
239 | &devfs_vnodeop_opv_desc, | |
240 | &devfs_spec_vnodeop_opv_desc, | |
b0d623f7 A |
241 | #if FDESC |
242 | &devfs_devfd_vnodeop_opv_desc, | |
243 | &devfs_fdesc_vnodeop_opv_desc, | |
244 | #endif /* FDESC */ | |
245 | #endif /* DEVFS */ | |
1c79356b A |
246 | NULL |
247 | }; |