]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
5d5c5d0d A |
2 | * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved. |
3 | * | |
8f6c56a5 | 4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
1c79356b | 5 | * |
8f6c56a5 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. | |
14 | * | |
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 | |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
23 | * Please see the License for the specific language governing rights and | |
8ad349bb | 24 | * limitations under the License. |
8f6c56a5 A |
25 | * |
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 | */ | |
63 | ||
64 | #include <sys/param.h> | |
65 | #include <sys/systm.h> | |
91447636 A |
66 | #include <sys/mount_internal.h> |
67 | #include <sys/vnode_internal.h> | |
1c79356b A |
68 | |
69 | /* | |
70 | * These define the root filesystem, device, and root filesystem type. | |
71 | */ | |
72 | struct mount *rootfs; | |
73 | struct vnode *rootvnode; | |
74 | int (*mountroot)() = NULL; | |
75 | ||
76 | /* | |
77 | * Set up the initial array of known filesystem types. | |
78 | */ | |
79 | extern struct vfsops ufs_vfsops; | |
91447636 | 80 | #if FFS |
1c79356b | 81 | extern int ffs_mountroot(); |
91447636 | 82 | #endif |
1c79356b A |
83 | extern struct vfsops mfs_vfsops; |
84 | extern int mfs_mountroot(); | |
85 | extern struct vfsops hfs_vfsops; | |
86 | extern int hfs_mountroot(); | |
87 | extern struct vfsops volfs_vfsops; | |
88 | extern struct vfsops cd9660_vfsops; | |
89 | extern int cd9660_mountroot(); | |
90 | extern struct vfsops nfs_vfsops; | |
91 | extern int nfs_mountroot(); | |
92 | extern struct vfsops afs_vfsops; | |
1c79356b A |
93 | extern struct vfsops null_vfsops; |
94 | extern struct vfsops union_vfsops; | |
1c79356b | 95 | extern struct vfsops fdesc_vfsops; |
1c79356b A |
96 | extern struct vfsops devfs_vfsops; |
97 | ||
98 | /* | |
99 | * Set up the filesystem operations for vnodes. | |
100 | */ | |
91447636 | 101 | static struct vfstable vfsconflist[] = { |
1c79356b A |
102 | /* HFS/HFS+ Filesystem */ |
103 | #if HFS | |
91447636 | 104 | { &hfs_vfsops, "hfs", 17, 0, MNT_LOCAL | MNT_DOVOLFS, hfs_mountroot, NULL, 0, {0}, VFC_VFSLOCALARGS, 0, 0 }, |
1c79356b A |
105 | #endif |
106 | ||
107 | /* Fast Filesystem */ | |
108 | #if FFS | |
91447636 | 109 | { &ufs_vfsops, "ufs", 1, 0, MNT_LOCAL, ffs_mountroot, NULL, 0, {0}, VFC_VFSLOCALARGS, 0, 0 }, |
1c79356b A |
110 | #endif |
111 | ||
112 | /* ISO9660 (aka CDROM) Filesystem */ | |
113 | #if CD9660 | |
91447636 | 114 | { &cd9660_vfsops, "cd9660", 14, 0, MNT_LOCAL, cd9660_mountroot, NULL, 0, {0}, VFC_VFSLOCALARGS, 0, 0 }, |
1c79356b A |
115 | #endif |
116 | ||
1c79356b A |
117 | /* Memory-based Filesystem */ |
118 | #if MFS | |
91447636 | 119 | { &mfs_vfsops, "mfs", 3, 0, MNT_LOCAL, mfs_mountroot, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
120 | #endif |
121 | ||
122 | /* Sun-compatible Network Filesystem */ | |
123 | #if NFSCLIENT | |
91447636 | 124 | { &nfs_vfsops, "nfs", 2, 0, 0, nfs_mountroot, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
125 | #endif |
126 | ||
127 | /* Andrew Filesystem */ | |
128 | #if AFS | |
91447636 | 129 | { &afs_vfsops, "andrewfs", 13, 0, 0, afs_mountroot, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
130 | #endif |
131 | ||
1c79356b A |
132 | /* Loopback (Minimal) Filesystem Layer */ |
133 | #if NULLFS | |
91447636 | 134 | { &null_vfsops, "loopback", 9, 0, 0, NULL, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
135 | #endif |
136 | ||
137 | /* Union (translucent) Filesystem */ | |
138 | #if UNION | |
91447636 | 139 | { &union_vfsops, "union", 15, 0, 0, NULL, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
140 | #endif |
141 | ||
1c79356b A |
142 | /* File Descriptor Filesystem */ |
143 | #if FDESC | |
91447636 | 144 | { &fdesc_vfsops, "fdesc", 7, 0, 0, NULL, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b A |
145 | #endif |
146 | ||
1c79356b A |
147 | /* Volume ID Filesystem */ |
148 | #if VOLFS | |
91447636 | 149 | { &volfs_vfsops, "volfs", 18, 0, 0, NULL, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b | 150 | #endif |
9bccf70c | 151 | |
1c79356b A |
152 | /* Device Filesystem */ |
153 | #if DEVFS | |
91447636 | 154 | { &devfs_vfsops, "devfs", 19, 0, 0, NULL, NULL, 0, {0}, VFC_VFSGENERICARGS , 0, 0}, |
1c79356b | 155 | #endif |
9bccf70c A |
156 | |
157 | {0}, | |
158 | {0}, | |
159 | {0}, | |
160 | {0}, | |
1c79356b A |
161 | {0}, |
162 | {0}, | |
163 | {0}, | |
164 | {0}, | |
165 | {0}, | |
166 | {0}, | |
167 | {0}, | |
168 | {0}, | |
169 | {0}, | |
170 | {0} | |
171 | }; | |
172 | ||
173 | /* | |
174 | * Initially the size of the list, vfs_init will set maxvfsconf | |
175 | * to the highest defined type number. | |
176 | */ | |
177 | int maxvfsslots = sizeof(vfsconflist) / sizeof (struct vfsconf); | |
178 | int numused_vfsslots = 0; | |
179 | int maxvfsconf = sizeof(vfsconflist) / sizeof (struct vfsconf); | |
91447636 | 180 | struct vfstable *vfsconf = vfsconflist; |
1c79356b A |
181 | |
182 | /* | |
183 | * | |
184 | * vfs_opv_descs enumerates the list of vnode classes, each with it's own | |
185 | * vnode operation vector. It is consulted at system boot to build operation | |
186 | * vectors. It is NULL terminated. | |
187 | * | |
188 | */ | |
91447636 | 189 | #if FFS |
1c79356b A |
190 | extern struct vnodeopv_desc ffs_vnodeop_opv_desc; |
191 | extern struct vnodeopv_desc ffs_specop_opv_desc; | |
192 | extern struct vnodeopv_desc ffs_fifoop_opv_desc; | |
91447636 | 193 | #endif |
1c79356b A |
194 | extern struct vnodeopv_desc mfs_vnodeop_opv_desc; |
195 | extern struct vnodeopv_desc dead_vnodeop_opv_desc; | |
196 | extern struct vnodeopv_desc fifo_vnodeop_opv_desc; | |
197 | extern struct vnodeopv_desc spec_vnodeop_opv_desc; | |
198 | extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc; | |
199 | extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc; | |
200 | extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc; | |
201 | extern struct vnodeopv_desc fdesc_vnodeop_opv_desc; | |
1c79356b | 202 | extern struct vnodeopv_desc null_vnodeop_opv_desc; |
1c79356b A |
203 | extern struct vnodeopv_desc hfs_vnodeop_opv_desc; |
204 | extern struct vnodeopv_desc hfs_specop_opv_desc; | |
205 | extern struct vnodeopv_desc hfs_fifoop_opv_desc; | |
206 | extern struct vnodeopv_desc volfs_vnodeop_opv_desc; | |
207 | extern struct vnodeopv_desc cd9660_vnodeop_opv_desc; | |
55e303ae | 208 | extern struct vnodeopv_desc cd9660_cdxaop_opv_desc; |
1c79356b A |
209 | extern struct vnodeopv_desc cd9660_specop_opv_desc; |
210 | extern struct vnodeopv_desc cd9660_fifoop_opv_desc; | |
211 | extern struct vnodeopv_desc union_vnodeop_opv_desc; | |
1c79356b A |
212 | extern struct vnodeopv_desc devfs_vnodeop_opv_desc; |
213 | extern struct vnodeopv_desc devfs_spec_vnodeop_opv_desc; | |
214 | ||
215 | struct vnodeopv_desc *vfs_opv_descs[] = { | |
91447636 | 216 | #if FFS |
1c79356b A |
217 | &ffs_vnodeop_opv_desc, |
218 | &ffs_specop_opv_desc, | |
219 | #if FIFO | |
220 | &ffs_fifoop_opv_desc, | |
91447636 | 221 | #endif |
1c79356b A |
222 | #endif |
223 | &dead_vnodeop_opv_desc, | |
224 | #if FIFO | |
225 | &fifo_vnodeop_opv_desc, | |
226 | #endif | |
227 | &spec_vnodeop_opv_desc, | |
1c79356b A |
228 | #if MFS |
229 | &mfs_vnodeop_opv_desc, | |
230 | #endif | |
231 | #if NFSCLIENT | |
232 | &nfsv2_vnodeop_opv_desc, | |
233 | &spec_nfsv2nodeop_opv_desc, | |
234 | #if FIFO | |
235 | &fifo_nfsv2nodeop_opv_desc, | |
236 | #endif | |
237 | #endif | |
238 | #if FDESC | |
239 | &fdesc_vnodeop_opv_desc, | |
240 | #endif | |
1c79356b A |
241 | #if NULLFS |
242 | &null_vnodeop_opv_desc, | |
243 | #endif | |
1c79356b A |
244 | #if HFS |
245 | &hfs_vnodeop_opv_desc, | |
246 | &hfs_specop_opv_desc, | |
247 | #if FIFO | |
248 | &hfs_fifoop_opv_desc, | |
249 | #endif | |
250 | #endif | |
251 | #if CD9660 | |
252 | &cd9660_vnodeop_opv_desc, | |
55e303ae | 253 | &cd9660_cdxaop_opv_desc, |
1c79356b A |
254 | &cd9660_specop_opv_desc, |
255 | #if FIFO | |
256 | &cd9660_fifoop_opv_desc, | |
257 | #endif | |
258 | #endif | |
259 | #if UNION | |
260 | &union_vnodeop_opv_desc, | |
261 | #endif | |
262 | #if VOLFS | |
263 | &volfs_vnodeop_opv_desc, | |
264 | #endif | |
265 | #if DEVFS | |
266 | &devfs_vnodeop_opv_desc, | |
267 | &devfs_spec_vnodeop_opv_desc, | |
268 | #endif | |
269 | NULL | |
270 | }; |