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