xref: /csrg-svn/sys/kern/vfs_conf.c (revision 65147)
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.3 (Berkeley) 12/15/93
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 struct vfsops *vfssw[] = {
112 	NULL,			/* 0 = MOUNT_NONE */
113 	UFS_VFSOPS,		/* 1 = MOUNT_UFS */
114 	NFS_VFSOPS,		/* 2 = MOUNT_NFS */
115 	MFS_VFSOPS,		/* 3 = MOUNT_MFS */
116 	NULL,			/* 4 = MOUNT_PC */
117 	LFS_VFSOPS,		/* 5 = MOUNT_LFS */
118 	LOFS_VFSOPS,		/* 6 = MOUNT_LOFS */
119 	FDESC_VFSOPS,		/* 7 = MOUNT_FDESC */
120 	PORTAL_VFSOPS,		/* 8 = MOUNT_PORTAL */
121 	NULL_VFSOPS,		/* 9 = MOUNT_NULL */
122 	UMAP_VFSOPS,		/* 10 = MOUNT_UMAP */
123 	KERNFS_VFSOPS,		/* 11 = MOUNT_KERNFS */
124 	PROCFS_VFSOPS,		/* 12 = MOUNT_PROCFS */
125 	0
126 };
127 
128 
129 /*
130  *
131  * vfs_opv_descs enumerates the list of vnode classes, each with it's own
132  * vnode operation vector.  It is consulted at system boot to build operation
133  * vectors.  It is NULL terminated.
134  *
135  */
136 extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
137 extern struct vnodeopv_desc ffs_specop_opv_desc;
138 extern struct vnodeopv_desc ffs_fifoop_opv_desc;
139 extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
140 extern struct vnodeopv_desc lfs_specop_opv_desc;
141 extern struct vnodeopv_desc lfs_fifoop_opv_desc;
142 extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
143 extern struct vnodeopv_desc dead_vnodeop_opv_desc;
144 extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
145 extern struct vnodeopv_desc spec_vnodeop_opv_desc;
146 extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
147 extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
148 extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
149 extern struct vnodeopv_desc lofs_vnodeop_opv_desc;
150 extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
151 extern struct vnodeopv_desc portal_vnodeop_opv_desc;
152 extern struct vnodeopv_desc null_vnodeop_opv_desc;
153 extern struct vnodeopv_desc umap_vnodeop_opv_desc;
154 extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
155 extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
156 
157 struct vnodeopv_desc *vfs_opv_descs[] = {
158 	&ffs_vnodeop_opv_desc,
159 	&ffs_specop_opv_desc,
160 #ifdef FIFO
161 	&ffs_fifoop_opv_desc,
162 #endif
163 	&dead_vnodeop_opv_desc,
164 #ifdef FIFO
165 	&fifo_vnodeop_opv_desc,
166 #endif
167 	&spec_vnodeop_opv_desc,
168 #ifdef LFS
169 	&lfs_vnodeop_opv_desc,
170 	&lfs_specop_opv_desc,
171 #ifdef FIFO
172 	&lfs_fifoop_opv_desc,
173 #endif
174 #endif
175 #ifdef MFS
176 	&mfs_vnodeop_opv_desc,
177 #endif
178 #ifdef NFS
179 	&nfsv2_vnodeop_opv_desc,
180 	&spec_nfsv2nodeop_opv_desc,
181 #ifdef FIFO
182 	&fifo_nfsv2nodeop_opv_desc,
183 #endif
184 #endif
185 #ifdef LOFS
186 	&lofs_vnodeop_opv_desc,
187 #endif
188 #ifdef FDESC
189 	&fdesc_vnodeop_opv_desc,
190 #endif
191 #ifdef PORTAL
192 	&portal_vnodeop_opv_desc,
193 #endif
194 #ifdef NULLFS
195 	&null_vnodeop_opv_desc,
196 #endif
197 #ifdef UMAPFS
198 	&umap_vnodeop_opv_desc,
199 #endif
200 #ifdef KERNFS
201 	&kernfs_vnodeop_opv_desc,
202 #endif
203 #ifdef PROCFS
204 	&procfs_vnodeop_opv_desc,
205 #endif
206 	NULL
207 };
208