xref: /original-bsd/sys/kern/vfs_conf.c (revision 27393bdf)
1 /*
2  * Copyright (c) 1989, 1993, 1995
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)vfs_conf.c	8.10 (Berkeley) 03/30/95
8  */
9 
10 #include <sys/param.h>
11 #include <sys/mount.h>
12 #include <sys/vnode.h>
13 
14 #ifdef FFS
15 #include <ufs/ufs/dinode.h>
16 #include <ufs/ffs/ffs_extern.h>
17 
18 /*
19  * This specifies the filesystem used to mount the root.
20  * This specification should be done by /etc/config.
21  */
22 int (*mountroot)() = ffs_mountroot;
23 #endif
24 
25 /*
26  * These define the root filesystem and device.
27  */
28 struct mount *rootfs;
29 struct vnode *rootvnode;
30 
31 extern	struct vfsops ufs_vfsops;
32 extern	struct vfsops lfs_vfsops;
33 extern	struct vfsops mfs_vfsops;
34 extern	struct vfsops cd9660_vfsops;
35 extern	struct vfsops msdos_vfsops;
36 extern	struct vfsops adosfs_vfsops;
37 extern	struct vfsops nfs_vfsops;
38 extern	struct vfsops afs_vfsops;
39 extern	struct vfsops procfs_vfsops;
40 extern	struct vfsops null_vfsops;
41 extern	struct vfsops union_vfsops;
42 extern	struct vfsops umap_vfsops;
43 extern	struct vfsops portal_vfsops;
44 extern	struct vfsops fdesc_vfsops;
45 extern	struct vfsops kernfs_vfsops;
46 
47 /*
48  * Set up the filesystem operations for vnodes.
49  */
50 static struct vfsconf vfsconflist[] = {
51 
52 	/* Fast Filesystem */
53 #ifdef FFS
54 	{ &ufs_vfsops, "ufs", 1, 0, MNT_LOCAL, NULL },
55 #endif
56 
57 	/* Log-based Filesystem */
58 #ifdef LFS
59 	{ &lfs_vfsops, "lfs", 5, 0, MNT_LOCAL, NULL },
60 #endif
61 
62 	/* Memory-based Filesystem */
63 #ifdef MFS
64 	{ &mfs_vfsops, "mfs", 3, 0, MNT_LOCAL, NULL },
65 #endif
66 
67 	/* ISO9660 (aka CDROM) Filesystem */
68 #ifdef CD9660
69 	{ &cd9660_vfsops, "cd9660", 14, 0, MNT_LOCAL, NULL },
70 #endif
71 
72 	/* MSDOS Filesystem */
73 #ifdef MSDOS
74 	{ &msdos_vfsops, "msdos", 4, 0, MNT_LOCAL, NULL },
75 #endif
76 
77 	/* AmigaDOS Filesystem */
78 #ifdef ADOSFS
79 	{ &adosfs_vfsops, "adosfs", 16, 0, MNT_LOCAL, NULL },
80 #endif
81 
82 	/* Sun-compatible Network Filesystem */
83 #ifdef NFS
84 	{ &nfs_vfsops, "nfs", 2, 0, 0, NULL },
85 #endif
86 
87 	/* Andrew Filesystem */
88 #ifdef AFS
89 	{ &afs_vfsops, "andrewfs", 13, 0, 0, NULL },
90 #endif
91 
92 	/* /proc Filesystem */
93 #ifdef PROCFS
94 	{ &procfs_vfsops, "procfs", 12, 0, 0, NULL },
95 #endif
96 
97 	/* Loopback (Minimal) Filesystem Layer */
98 #ifdef NULLFS
99 	{ &null_vfsops, "loopback", 9, 0, 0, NULL },
100 #endif
101 
102 	/* Union (translucent) Filesystem */
103 #ifdef UNION
104 	{ &union_vfsops, "union", 15, 0, 0, NULL },
105 #endif
106 
107 	/* User/Group Identifer Remapping Filesystem */
108 #ifdef UMAPFS
109 	{ &umap_vfsops, "umap", 10, 0, 0, NULL },
110 #endif
111 
112 	/* Portal Filesystem */
113 #ifdef PORTAL
114 	{ &portal_vfsops, "portal", 8, 0, 0, NULL },
115 #endif
116 
117 	/* File Descriptor Filesystem */
118 #ifdef FDESC
119 	{ &fdesc_vfsops, "fdesc", 7, 0, 0, NULL },
120 #endif
121 
122 	/* Kernel Information Filesystem */
123 #ifdef KERNFS
124 	{ &kernfs_vfsops, "kernfs", 11, 0, 0, NULL },
125 #endif
126 
127 };
128 
129 /*
130  * Initially the size of the list, vfs_init will set maxvfsconf
131  * to the highest defined type number.
132  */
133 int maxvfsconf = sizeof(vfsconflist) / sizeof (struct vfsconf);
134 struct vfsconf *vfsconf = vfsconflist;
135 
136 /*
137  *
138  * vfs_opv_descs enumerates the list of vnode classes, each with it's own
139  * vnode operation vector.  It is consulted at system boot to build operation
140  * vectors.  It is NULL terminated.
141  *
142  */
143 extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
144 extern struct vnodeopv_desc ffs_specop_opv_desc;
145 extern struct vnodeopv_desc ffs_fifoop_opv_desc;
146 extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
147 extern struct vnodeopv_desc lfs_specop_opv_desc;
148 extern struct vnodeopv_desc lfs_fifoop_opv_desc;
149 extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
150 extern struct vnodeopv_desc dead_vnodeop_opv_desc;
151 extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
152 extern struct vnodeopv_desc spec_vnodeop_opv_desc;
153 extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
154 extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
155 extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
156 extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
157 extern struct vnodeopv_desc portal_vnodeop_opv_desc;
158 extern struct vnodeopv_desc null_vnodeop_opv_desc;
159 extern struct vnodeopv_desc umap_vnodeop_opv_desc;
160 extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
161 extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
162 extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
163 extern struct vnodeopv_desc cd9660_specop_opv_desc;
164 extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
165 extern struct vnodeopv_desc union_vnodeop_opv_desc;
166 
167 struct vnodeopv_desc *vfs_opv_descs[] = {
168 	&ffs_vnodeop_opv_desc,
169 	&ffs_specop_opv_desc,
170 #ifdef FIFO
171 	&ffs_fifoop_opv_desc,
172 #endif
173 	&dead_vnodeop_opv_desc,
174 #ifdef FIFO
175 	&fifo_vnodeop_opv_desc,
176 #endif
177 	&spec_vnodeop_opv_desc,
178 #ifdef LFS
179 	&lfs_vnodeop_opv_desc,
180 	&lfs_specop_opv_desc,
181 #ifdef FIFO
182 	&lfs_fifoop_opv_desc,
183 #endif
184 #endif
185 #ifdef MFS
186 	&mfs_vnodeop_opv_desc,
187 #endif
188 #ifdef NFS
189 	&nfsv2_vnodeop_opv_desc,
190 	&spec_nfsv2nodeop_opv_desc,
191 #ifdef FIFO
192 	&fifo_nfsv2nodeop_opv_desc,
193 #endif
194 #endif
195 #ifdef FDESC
196 	&fdesc_vnodeop_opv_desc,
197 #endif
198 #ifdef PORTAL
199 	&portal_vnodeop_opv_desc,
200 #endif
201 #ifdef NULLFS
202 	&null_vnodeop_opv_desc,
203 #endif
204 #ifdef UMAPFS
205 	&umap_vnodeop_opv_desc,
206 #endif
207 #ifdef KERNFS
208 	&kernfs_vnodeop_opv_desc,
209 #endif
210 #ifdef PROCFS
211 	&procfs_vnodeop_opv_desc,
212 #endif
213 #ifdef CD9660
214 	&cd9660_vnodeop_opv_desc,
215 	&cd9660_specop_opv_desc,
216 #ifdef FIFO
217 	&cd9660_fifoop_opv_desc,
218 #endif
219 #endif
220 #ifdef UNION
221 	&union_vnodeop_opv_desc,
222 #endif
223 	NULL
224 };
225