xref: /original-bsd/sys/kern/vfs_conf.c (revision f737e041)
1 /*
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)vfs_conf.c	8.7 (Berkeley) 01/28/94
8  */
9 
10 #include <sys/param.h>
11 #include <sys/mount.h>
12 #include <sys/vnode.h>
13 
14 #ifdef FFS
15 #include <ufs/ffs/ffs_extern.h>
16 
17 /*
18  * This specifies the filesystem used to mount the root.
19  * This specification should be done by /etc/config.
20  */
21 int (*mountroot)() = ffs_mountroot;
22 #endif
23 
24 /*
25  * These define the root filesystem and device.
26  */
27 struct mount *rootfs;
28 struct vnode *rootvnode;
29 
30 /*
31  * Set up the filesystem operations for vnodes.
32  * The types are defined in mount.h.
33  */
34 #ifdef FFS
35 extern	struct vfsops ufs_vfsops;
36 #define	UFS_VFSOPS	&ufs_vfsops
37 #else
38 #define	UFS_VFSOPS	NULL
39 #endif
40 
41 #ifdef LFS
42 extern	struct vfsops lfs_vfsops;
43 #define	LFS_VFSOPS	&lfs_vfsops
44 #else
45 #define	LFS_VFSOPS	NULL
46 #endif
47 
48 #ifdef MFS
49 extern	struct vfsops mfs_vfsops;
50 #define	MFS_VFSOPS	&mfs_vfsops
51 #else
52 #define	MFS_VFSOPS	NULL
53 #endif
54 
55 #ifdef NFS
56 extern	struct vfsops nfs_vfsops;
57 #define	NFS_VFSOPS	&nfs_vfsops
58 #else
59 #define	NFS_VFSOPS	NULL
60 #endif
61 
62 #ifdef LOFS
63 extern	struct vfsops lofs_vfsops;
64 #define	LOFS_VFSOPS	&lofs_vfsops
65 #else
66 #define	LOFS_VFSOPS	NULL
67 #endif
68 
69 #ifdef FDESC
70 extern	struct vfsops fdesc_vfsops;
71 #define	FDESC_VFSOPS	&fdesc_vfsops
72 #else
73 #define	FDESC_VFSOPS	NULL
74 #endif
75 
76 #ifdef PORTAL
77 extern	struct vfsops portal_vfsops;
78 #define	PORTAL_VFSOPS	&portal_vfsops
79 #else
80 #define	PORTAL_VFSOPS	NULL
81 #endif
82 
83 #ifdef NULLFS
84 extern	struct vfsops null_vfsops;
85 #define NULL_VFSOPS	&null_vfsops
86 #else
87 #define NULL_VFSOPS	NULL
88 #endif
89 
90 #ifdef UMAPFS
91 extern	struct vfsops umap_vfsops;
92 #define UMAP_VFSOPS	&umap_vfsops
93 #else
94 #define UMAP_VFSOPS	NULL
95 #endif
96 
97 #ifdef KERNFS
98 extern	struct vfsops kernfs_vfsops;
99 #define KERNFS_VFSOPS	&kernfs_vfsops
100 #else
101 #define KERNFS_VFSOPS	NULL
102 #endif
103 
104 #ifdef PROCFS
105 extern	struct vfsops procfs_vfsops;
106 #define PROCFS_VFSOPS	&procfs_vfsops
107 #else
108 #define PROCFS_VFSOPS	NULL
109 #endif
110 
111 #ifdef AFS
112 extern	struct vfsops afs_vfsops;
113 #define AFS_VFSOPS	&afs_vfsops
114 #else
115 #define AFS_VFSOPS	NULL
116 #endif
117 
118 #ifdef CD9660
119 extern	struct vfsops cd9660_vfsops;
120 #define CD9660_VFSOPS	&cd9660_vfsops
121 #else
122 #define CD9660_VFSOPS	NULL
123 #endif
124 
125 #ifdef UNION
126 extern	struct vfsops union_vfsops;
127 #define	UNION_VFSOPS	&union_vfsops
128 #else
129 #define	UNION_VFSOPS	NULL
130 #endif
131 
132 struct vfsops *vfssw[] = {
133 	NULL,			/* 0 = MOUNT_NONE */
134 	UFS_VFSOPS,		/* 1 = MOUNT_UFS */
135 	NFS_VFSOPS,		/* 2 = MOUNT_NFS */
136 	MFS_VFSOPS,		/* 3 = MOUNT_MFS */
137 	NULL,			/* 4 = MOUNT_PC */
138 	LFS_VFSOPS,		/* 5 = MOUNT_LFS */
139 	LOFS_VFSOPS,		/* 6 = MOUNT_LOFS */
140 	FDESC_VFSOPS,		/* 7 = MOUNT_FDESC */
141 	PORTAL_VFSOPS,		/* 8 = MOUNT_PORTAL */
142 	NULL_VFSOPS,		/* 9 = MOUNT_NULL */
143 	UMAP_VFSOPS,		/* 10 = MOUNT_UMAP */
144 	KERNFS_VFSOPS,		/* 11 = MOUNT_KERNFS */
145 	PROCFS_VFSOPS,		/* 12 = MOUNT_PROCFS */
146 	AFS_VFSOPS,		/* 13 = MOUNT_AFS */
147 	CD9660_VFSOPS,		/* 14 = MOUNT_CD9660 */
148 	UNION_VFSOPS,		/* 15 = MOUNT_UNION */
149 	0
150 };
151 
152 
153 /*
154  *
155  * vfs_opv_descs enumerates the list of vnode classes, each with it's own
156  * vnode operation vector.  It is consulted at system boot to build operation
157  * vectors.  It is NULL terminated.
158  *
159  */
160 extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
161 extern struct vnodeopv_desc ffs_specop_opv_desc;
162 extern struct vnodeopv_desc ffs_fifoop_opv_desc;
163 extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
164 extern struct vnodeopv_desc lfs_specop_opv_desc;
165 extern struct vnodeopv_desc lfs_fifoop_opv_desc;
166 extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
167 extern struct vnodeopv_desc dead_vnodeop_opv_desc;
168 extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
169 extern struct vnodeopv_desc spec_vnodeop_opv_desc;
170 extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
171 extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
172 extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
173 extern struct vnodeopv_desc lofs_vnodeop_opv_desc;
174 extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
175 extern struct vnodeopv_desc portal_vnodeop_opv_desc;
176 extern struct vnodeopv_desc null_vnodeop_opv_desc;
177 extern struct vnodeopv_desc umap_vnodeop_opv_desc;
178 extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
179 extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
180 extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
181 extern struct vnodeopv_desc cd9660_specop_opv_desc;
182 extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
183 extern struct vnodeopv_desc union_vnodeop_opv_desc;
184 
185 struct vnodeopv_desc *vfs_opv_descs[] = {
186 	&ffs_vnodeop_opv_desc,
187 	&ffs_specop_opv_desc,
188 #ifdef FIFO
189 	&ffs_fifoop_opv_desc,
190 #endif
191 	&dead_vnodeop_opv_desc,
192 #ifdef FIFO
193 	&fifo_vnodeop_opv_desc,
194 #endif
195 	&spec_vnodeop_opv_desc,
196 #ifdef LFS
197 	&lfs_vnodeop_opv_desc,
198 	&lfs_specop_opv_desc,
199 #ifdef FIFO
200 	&lfs_fifoop_opv_desc,
201 #endif
202 #endif
203 #ifdef MFS
204 	&mfs_vnodeop_opv_desc,
205 #endif
206 #ifdef NFS
207 	&nfsv2_vnodeop_opv_desc,
208 	&spec_nfsv2nodeop_opv_desc,
209 #ifdef FIFO
210 	&fifo_nfsv2nodeop_opv_desc,
211 #endif
212 #endif
213 #ifdef LOFS
214 	&lofs_vnodeop_opv_desc,
215 #endif
216 #ifdef FDESC
217 	&fdesc_vnodeop_opv_desc,
218 #endif
219 #ifdef PORTAL
220 	&portal_vnodeop_opv_desc,
221 #endif
222 #ifdef NULLFS
223 	&null_vnodeop_opv_desc,
224 #endif
225 #ifdef UMAPFS
226 	&umap_vnodeop_opv_desc,
227 #endif
228 #ifdef KERNFS
229 	&kernfs_vnodeop_opv_desc,
230 #endif
231 #ifdef PROCFS
232 	&procfs_vnodeop_opv_desc,
233 #endif
234 #ifdef CD9660
235 	&cd9660_vnodeop_opv_desc,
236 	&cd9660_specop_opv_desc,
237 #ifdef FIFO
238 	&cd9660_fifoop_opv_desc,
239 #endif
240 #endif
241 #ifdef UNION
242 	&union_vnodeop_opv_desc,
243 #endif
244 	NULL
245 };
246