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