Annotation of sys/kern/vfs_conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: vfs_conf.c,v 1.33 2007/06/01 05:37:14 deraadt Exp $ */
2: /* $NetBSD: vfs_conf.c,v 1.21.4.1 1995/11/01 00:06:26 jtc Exp $ */
3:
4: /*
5: * Copyright (c) 1989, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * Redistribution and use in source and binary forms, with or without
9: * modification, are permitted provided that the following conditions
10: * are met:
11: * 1. Redistributions of source code must retain the above copyright
12: * notice, this list of conditions and the following disclaimer.
13: * 2. Redistributions in binary form must reproduce the above copyright
14: * notice, this list of conditions and the following disclaimer in the
15: * documentation and/or other materials provided with the distribution.
16: * 3. Neither the name of the University nor the names of its contributors
17: * may be used to endorse or promote products derived from this software
18: * without specific prior written permission.
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30: * SUCH DAMAGE.
31: *
32: * @(#)vfs_conf.c 8.8 (Berkeley) 3/31/94
33: */
34:
35: #include <sys/param.h>
36: #include <sys/mount.h>
37: #include <sys/vnode.h>
38:
39: #ifdef FFS
40: #include <ufs/ufs/quota.h>
41: #include <ufs/ufs/inode.h>
42: #include <ufs/ffs/ffs_extern.h>
43: #endif
44:
45: #ifdef EXT2FS
46: #include <ufs/ext2fs/ext2fs_extern.h>
47: #endif
48:
49: #ifdef CD9660
50: #include <isofs/cd9660/iso.h>
51: #include <isofs/cd9660/cd9660_extern.h>
52: #endif
53:
54: #ifdef MFS
55: #include <ufs/mfs/mfs_extern.h>
56: #endif
57:
58: #ifdef NFSCLIENT
59: #include <sys/rwlock.h> /* XXX*/
60: #include <nfs/rpcv2.h>
61: #include <nfs/nfsproto.h>
62: #include <nfs/nfsnode.h>
63: #include <nfs/nfs.h>
64: #include <nfs/nfsmount.h>
65: #endif
66:
67: /*
68: * This defines the root filesystem.
69: */
70: struct vnode *rootvnode;
71:
72: /*
73: * Set up the filesystem operations for vnodes.
74: * The types are defined in mount.h.
75: */
76:
77:
78: #ifdef FFS
79: extern const struct vfsops ffs_vfsops;
80: #endif
81:
82: #ifdef MFS
83: extern const struct vfsops mfs_vfsops;
84: #endif
85:
86: #ifdef MSDOSFS
87: extern const struct vfsops msdosfs_vfsops;
88: #endif
89:
90: #ifdef NFSCLIENT
91: extern const struct vfsops nfs_vfsops;
92: #endif
93:
94: #ifdef PORTAL
95: extern const struct vfsops portal_vfsops;
96: #endif
97:
98: #ifdef PROCFS
99: extern const struct vfsops procfs_vfsops;
100: #endif
101:
102: #ifdef CD9660
103: extern const struct vfsops cd9660_vfsops;
104: #endif
105:
106: #ifdef EXT2FS
107: extern const struct vfsops ext2fs_vfsops;
108: #endif
109:
110: #ifdef XFS
111: extern const struct vfsops xfs_vfsops;
112: #endif
113:
114: #ifdef NTFS
115: extern const struct vfsops ntfs_vfsops;
116: #endif
117:
118: #ifdef UDF
119: extern const struct vfsops udf_vfsops;
120: #endif
121:
122: /*
123: * Set up the filesystem operations for vnodes.
124: */
125: static struct vfsconf vfsconflist[] = {
126:
127: /* Fast Filesystem */
128: #ifdef FFS
129: { &ffs_vfsops, MOUNT_FFS, 1, 0, MNT_LOCAL, ffs_mountroot, NULL },
130: #endif
131:
132: /* Memory-based Filesystem */
133: #ifdef MFS
134: { &mfs_vfsops, MOUNT_MFS, 3, 0, MNT_LOCAL, mfs_mountroot, NULL },
135: #endif
136:
137: #ifdef EXT2FS
138: { &ext2fs_vfsops, MOUNT_EXT2FS, 17, 0, MNT_LOCAL, ext2fs_mountroot, NULL },
139: #endif
140: /* ISO9660 (aka CDROM) Filesystem */
141: #ifdef CD9660
142: { &cd9660_vfsops, MOUNT_CD9660, 14, 0, MNT_LOCAL, cd9660_mountroot, NULL },
143: #endif
144:
145: /* MSDOS Filesystem */
146: #ifdef MSDOSFS
147: { &msdosfs_vfsops, MOUNT_MSDOS, 4, 0, MNT_LOCAL, NULL, NULL },
148: #endif
149:
150: /* Sun-compatible Network Filesystem */
151: #ifdef NFSCLIENT
152: { &nfs_vfsops, MOUNT_NFS, 2, 0, 0, nfs_mountroot, NULL },
153: #endif
154:
155: /* XFS */
156: #ifdef XFS
157: { &xfs_vfsops, MOUNT_XFS, 21, 0, 0, NULL, NULL },
158: #endif
159:
160: /* /proc Filesystem */
161: #ifdef PROCFS
162: { &procfs_vfsops, MOUNT_PROCFS, 12, 0, 0, NULL, NULL },
163: #endif
164:
165: /* Portal Filesystem */
166: #ifdef PORTAL
167: { &portal_vfsops, MOUNT_PORTAL, 8, 0, 0, NULL, NULL },
168: #endif
169:
170: /* NTFS Filesystem */
171: #ifdef NTFS
172: { &ntfs_vfsops, MOUNT_NTFS, 6, 0, MNT_LOCAL, NULL, NULL },
173: #endif
174:
175: /* UDF Filesystem */
176: #ifdef UDF
177: { &udf_vfsops, MOUNT_UDF, 13, 0, MNT_LOCAL, NULL, NULL },
178: #endif
179:
180: };
181:
182:
183: /*
184: * Initially the size of the list, vfs_init will set maxvfsconf
185: * to the highest defined type number.
186: */
187: int maxvfsconf = sizeof(vfsconflist) / sizeof(struct vfsconf);
188: struct vfsconf *vfsconf = vfsconflist;
189:
190:
191: /*
192: * vfs_opv_descs enumerates the list of vnode classes, each with its own
193: * vnode operation vector. It is consulted at system boot to build operation
194: * vectors. It is NULL terminated.
195: */
196: extern struct vnodeopv_desc sync_vnodeop_opv_desc;
197: extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
198: extern struct vnodeopv_desc ffs_specop_opv_desc;
199: extern struct vnodeopv_desc ffs_fifoop_opv_desc;
200: extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
201: extern struct vnodeopv_desc dead_vnodeop_opv_desc;
202: extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
203: extern struct vnodeopv_desc spec_vnodeop_opv_desc;
204: extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
205: extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
206: extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
207: extern struct vnodeopv_desc portal_vnodeop_opv_desc;
208: extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
209: extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
210: extern struct vnodeopv_desc cd9660_specop_opv_desc;
211: extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
212: extern struct vnodeopv_desc msdosfs_vnodeop_opv_desc;
213: extern struct vnodeopv_desc ext2fs_vnodeop_opv_desc;
214: extern struct vnodeopv_desc ext2fs_specop_opv_desc;
215: extern struct vnodeopv_desc ext2fs_fifoop_opv_desc;
216: extern struct vnodeopv_desc xfs_vnodeop_opv_desc;
217: extern struct vnodeopv_desc ntfs_vnodeop_opv_desc;
218: extern struct vnodeopv_desc udf_vnodeop_opv_desc;
219:
220: struct vnodeopv_desc *vfs_opv_descs[] = {
221: &sync_vnodeop_opv_desc,
222: #ifdef FFS
223: &ffs_vnodeop_opv_desc,
224: &ffs_specop_opv_desc,
225: #ifdef FIFO
226: &ffs_fifoop_opv_desc,
227: #endif
228: #endif
229: &dead_vnodeop_opv_desc,
230: #ifdef FIFO
231: &fifo_vnodeop_opv_desc,
232: #endif
233: &spec_vnodeop_opv_desc,
234: #ifdef MFS
235: &mfs_vnodeop_opv_desc,
236: #endif
237: #ifdef NFSCLIENT
238: &nfsv2_vnodeop_opv_desc,
239: &spec_nfsv2nodeop_opv_desc,
240: #ifdef FIFO
241: &fifo_nfsv2nodeop_opv_desc,
242: #endif
243: #endif
244: #ifdef PORTAL
245: &portal_vnodeop_opv_desc,
246: #endif
247: #ifdef PROCFS
248: &procfs_vnodeop_opv_desc,
249: #endif
250: #ifdef CD9660
251: &cd9660_vnodeop_opv_desc,
252: &cd9660_specop_opv_desc,
253: #ifdef FIFO
254: &cd9660_fifoop_opv_desc,
255: #endif
256: #endif
257: #ifdef MSDOSFS
258: &msdosfs_vnodeop_opv_desc,
259: #endif
260: #ifdef EXT2FS
261: &ext2fs_vnodeop_opv_desc,
262: &ext2fs_specop_opv_desc,
263: #ifdef FIFO
264: &ext2fs_fifoop_opv_desc,
265: #endif
266: #endif
267: #ifdef XFS
268: &xfs_vnodeop_opv_desc,
269: #endif
270: #ifdef NTFS
271: &ntfs_vnodeop_opv_desc,
272: #endif
273: #ifdef UDF
274: &udf_vnodeop_opv_desc,
275: #endif
276:
277: NULL
278: };
CVSweb