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