]>
Commit | Line | Data |
---|---|---|
1c79356b | 1 | /* |
55e303ae | 2 | * Copyright (c) 2000-2003 Apple Computer, Inc. All rights reserved. |
1c79356b A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
43866e37 | 6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. |
1c79356b | 7 | * |
43866e37 A |
8 | * This file contains Original Code and/or Modifications of Original Code |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
1c79356b A |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
43866e37 A |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
1c79356b A |
22 | * |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved */ | |
26 | /* | |
27 | * Copyright (c) 1989, 1993, 1995 | |
28 | * The Regents of the University of California. All rights reserved. | |
29 | * | |
30 | * Redistribution and use in source and binary forms, with or without | |
31 | * modification, are permitted provided that the following conditions | |
32 | * are met: | |
33 | * 1. Redistributions of source code must retain the above copyright | |
34 | * notice, this list of conditions and the following disclaimer. | |
35 | * 2. Redistributions in binary form must reproduce the above copyright | |
36 | * notice, this list of conditions and the following disclaimer in the | |
37 | * documentation and/or other materials provided with the distribution. | |
38 | * 3. All advertising materials mentioning features or use of this software | |
39 | * must display the following acknowledgement: | |
40 | * This product includes software developed by the University of | |
41 | * California, Berkeley and its contributors. | |
42 | * 4. Neither the name of the University nor the names of its contributors | |
43 | * may be used to endorse or promote products derived from this software | |
44 | * without specific prior written permission. | |
45 | * | |
46 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
56 | * SUCH DAMAGE. | |
57 | * | |
58 | * @(#)vfs_conf.c 8.11 (Berkeley) 5/10/95 | |
59 | */ | |
60 | ||
61 | #include <sys/param.h> | |
62 | #include <sys/systm.h> | |
63 | #include <sys/mount.h> | |
64 | #include <sys/vnode.h> | |
65 | ||
66 | /* | |
67 | * These define the root filesystem, device, and root filesystem type. | |
68 | */ | |
69 | struct mount *rootfs; | |
70 | struct vnode *rootvnode; | |
71 | int (*mountroot)() = NULL; | |
72 | ||
73 | /* | |
74 | * Set up the initial array of known filesystem types. | |
75 | */ | |
76 | extern struct vfsops ufs_vfsops; | |
77 | extern int ffs_mountroot(); | |
1c79356b A |
78 | extern struct vfsops mfs_vfsops; |
79 | extern int mfs_mountroot(); | |
80 | extern struct vfsops hfs_vfsops; | |
81 | extern int hfs_mountroot(); | |
82 | extern struct vfsops volfs_vfsops; | |
83 | extern struct vfsops cd9660_vfsops; | |
84 | extern int cd9660_mountroot(); | |
85 | extern struct vfsops nfs_vfsops; | |
86 | extern int nfs_mountroot(); | |
87 | extern struct vfsops afs_vfsops; | |
1c79356b A |
88 | extern struct vfsops null_vfsops; |
89 | extern struct vfsops union_vfsops; | |
1c79356b | 90 | extern struct vfsops fdesc_vfsops; |
1c79356b A |
91 | extern struct vfsops devfs_vfsops; |
92 | ||
93 | /* | |
94 | * Set up the filesystem operations for vnodes. | |
95 | */ | |
96 | static struct vfsconf vfsconflist[] = { | |
97 | /* HFS/HFS+ Filesystem */ | |
98 | #if HFS | |
99 | { &hfs_vfsops, "hfs", 17, 0, MNT_LOCAL | MNT_DOVOLFS, hfs_mountroot, NULL }, | |
100 | #endif | |
101 | ||
102 | /* Fast Filesystem */ | |
103 | #if FFS | |
104 | { &ufs_vfsops, "ufs", 1, 0, MNT_LOCAL, ffs_mountroot, NULL }, | |
105 | #endif | |
106 | ||
107 | /* ISO9660 (aka CDROM) Filesystem */ | |
108 | #if CD9660 | |
55e303ae | 109 | { &cd9660_vfsops, "cd9660", 14, 0, MNT_LOCAL, cd9660_mountroot, NULL }, |
1c79356b A |
110 | #endif |
111 | ||
1c79356b A |
112 | /* Memory-based Filesystem */ |
113 | #if MFS | |
114 | { &mfs_vfsops, "mfs", 3, 0, MNT_LOCAL, mfs_mountroot, NULL }, | |
115 | #endif | |
116 | ||
117 | /* Sun-compatible Network Filesystem */ | |
118 | #if NFSCLIENT | |
119 | { &nfs_vfsops, "nfs", 2, 0, 0, nfs_mountroot, NULL }, | |
120 | #endif | |
121 | ||
122 | /* Andrew Filesystem */ | |
123 | #if AFS | |
124 | { &afs_vfsops, "andrewfs", 13, 0, 0, afs_mountroot, NULL }, | |
125 | #endif | |
126 | ||
1c79356b A |
127 | /* Loopback (Minimal) Filesystem Layer */ |
128 | #if NULLFS | |
129 | { &null_vfsops, "loopback", 9, 0, 0, NULL, NULL }, | |
130 | #endif | |
131 | ||
132 | /* Union (translucent) Filesystem */ | |
133 | #if UNION | |
134 | { &union_vfsops, "union", 15, 0, 0, NULL, NULL }, | |
135 | #endif | |
136 | ||
1c79356b A |
137 | /* File Descriptor Filesystem */ |
138 | #if FDESC | |
139 | { &fdesc_vfsops, "fdesc", 7, 0, 0, NULL, NULL }, | |
140 | #endif | |
141 | ||
1c79356b A |
142 | /* Volume ID Filesystem */ |
143 | #if VOLFS | |
144 | { &volfs_vfsops, "volfs", 18, 0, 0, NULL, NULL }, | |
145 | #endif | |
9bccf70c | 146 | |
1c79356b A |
147 | /* Device Filesystem */ |
148 | #if DEVFS | |
149 | { &devfs_vfsops, "devfs", 19, 0, 0, NULL, NULL }, | |
150 | #endif | |
9bccf70c A |
151 | |
152 | {0}, | |
153 | {0}, | |
154 | {0}, | |
155 | {0}, | |
1c79356b A |
156 | {0}, |
157 | {0}, | |
158 | {0}, | |
159 | {0}, | |
160 | {0}, | |
161 | {0}, | |
162 | {0}, | |
163 | {0}, | |
164 | {0}, | |
165 | {0} | |
166 | }; | |
167 | ||
168 | /* | |
169 | * Initially the size of the list, vfs_init will set maxvfsconf | |
170 | * to the highest defined type number. | |
171 | */ | |
172 | int maxvfsslots = sizeof(vfsconflist) / sizeof (struct vfsconf); | |
173 | int numused_vfsslots = 0; | |
174 | int maxvfsconf = sizeof(vfsconflist) / sizeof (struct vfsconf); | |
175 | struct vfsconf *vfsconf = vfsconflist; | |
176 | ||
177 | /* | |
178 | * | |
179 | * vfs_opv_descs enumerates the list of vnode classes, each with it's own | |
180 | * vnode operation vector. It is consulted at system boot to build operation | |
181 | * vectors. It is NULL terminated. | |
182 | * | |
183 | */ | |
184 | extern struct vnodeopv_desc ffs_vnodeop_opv_desc; | |
185 | extern struct vnodeopv_desc ffs_specop_opv_desc; | |
186 | extern struct vnodeopv_desc ffs_fifoop_opv_desc; | |
1c79356b A |
187 | extern struct vnodeopv_desc mfs_vnodeop_opv_desc; |
188 | extern struct vnodeopv_desc dead_vnodeop_opv_desc; | |
189 | extern struct vnodeopv_desc fifo_vnodeop_opv_desc; | |
190 | extern struct vnodeopv_desc spec_vnodeop_opv_desc; | |
191 | extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc; | |
192 | extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc; | |
193 | extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc; | |
194 | extern struct vnodeopv_desc fdesc_vnodeop_opv_desc; | |
1c79356b | 195 | extern struct vnodeopv_desc null_vnodeop_opv_desc; |
1c79356b A |
196 | extern struct vnodeopv_desc hfs_vnodeop_opv_desc; |
197 | extern struct vnodeopv_desc hfs_specop_opv_desc; | |
198 | extern struct vnodeopv_desc hfs_fifoop_opv_desc; | |
199 | extern struct vnodeopv_desc volfs_vnodeop_opv_desc; | |
200 | extern struct vnodeopv_desc cd9660_vnodeop_opv_desc; | |
55e303ae | 201 | extern struct vnodeopv_desc cd9660_cdxaop_opv_desc; |
1c79356b A |
202 | extern struct vnodeopv_desc cd9660_specop_opv_desc; |
203 | extern struct vnodeopv_desc cd9660_fifoop_opv_desc; | |
204 | extern struct vnodeopv_desc union_vnodeop_opv_desc; | |
1c79356b A |
205 | extern struct vnodeopv_desc devfs_vnodeop_opv_desc; |
206 | extern struct vnodeopv_desc devfs_spec_vnodeop_opv_desc; | |
207 | ||
208 | struct vnodeopv_desc *vfs_opv_descs[] = { | |
209 | &ffs_vnodeop_opv_desc, | |
210 | &ffs_specop_opv_desc, | |
211 | #if FIFO | |
212 | &ffs_fifoop_opv_desc, | |
213 | #endif | |
214 | &dead_vnodeop_opv_desc, | |
215 | #if FIFO | |
216 | &fifo_vnodeop_opv_desc, | |
217 | #endif | |
218 | &spec_vnodeop_opv_desc, | |
1c79356b A |
219 | #if MFS |
220 | &mfs_vnodeop_opv_desc, | |
221 | #endif | |
222 | #if NFSCLIENT | |
223 | &nfsv2_vnodeop_opv_desc, | |
224 | &spec_nfsv2nodeop_opv_desc, | |
225 | #if FIFO | |
226 | &fifo_nfsv2nodeop_opv_desc, | |
227 | #endif | |
228 | #endif | |
229 | #if FDESC | |
230 | &fdesc_vnodeop_opv_desc, | |
231 | #endif | |
1c79356b A |
232 | #if NULLFS |
233 | &null_vnodeop_opv_desc, | |
234 | #endif | |
1c79356b A |
235 | #if HFS |
236 | &hfs_vnodeop_opv_desc, | |
237 | &hfs_specop_opv_desc, | |
238 | #if FIFO | |
239 | &hfs_fifoop_opv_desc, | |
240 | #endif | |
241 | #endif | |
242 | #if CD9660 | |
243 | &cd9660_vnodeop_opv_desc, | |
55e303ae | 244 | &cd9660_cdxaop_opv_desc, |
1c79356b A |
245 | &cd9660_specop_opv_desc, |
246 | #if FIFO | |
247 | &cd9660_fifoop_opv_desc, | |
248 | #endif | |
249 | #endif | |
250 | #if UNION | |
251 | &union_vnodeop_opv_desc, | |
252 | #endif | |
253 | #if VOLFS | |
254 | &volfs_vnodeop_opv_desc, | |
255 | #endif | |
256 | #if DEVFS | |
257 | &devfs_vnodeop_opv_desc, | |
258 | &devfs_spec_vnodeop_opv_desc, | |
259 | #endif | |
260 | NULL | |
261 | }; |