xref: /csrg-svn/sys/kern/vfs_conf.c (revision 54724)
1 /*
2  * Copyright (c) 1989 The Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)vfs_conf.c	7.14 (Berkeley) 07/06/92
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 struct vfsops *vfssw[] = {
84 	NULL,			/* 0 = MOUNT_NONE */
85 	UFS_VFSOPS,		/* 1 = MOUNT_UFS */
86 	NFS_VFSOPS,		/* 2 = MOUNT_NFS */
87 	MFS_VFSOPS,		/* 3 = MOUNT_MFS */
88 	NULL,			/* 4 = MOUNT_PC */
89 	LFS_VFSOPS,		/* 5 = MOUNT_LFS */
90 	LOFS_VFSOPS,		/* 6 = MOUNT_LOFS */
91 	FDESC_VFSOPS,		/* 7 = MOUNT_FDESC */
92 	PORTAL_VFSOPS,		/* 8 = MOUNT_PORTAL */
93 };
94 
95 
96 /*
97  *
98  * vfs_opv_descs enumerates the list of vnode classes, each with it's own
99  * vnode operation vector.  It is consulted at system boot to build operation
100  * vectors.  It is NULL terminated.
101  *
102  * Out-of-kernel, someone else (more knowlegable about what file systems live
103  * in this address space) must specify this table.
104  */
105 extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
106 extern struct vnodeopv_desc ffs_specop_opv_desc;
107 extern struct vnodeopv_desc ffs_fifoop_opv_desc;
108 extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
109 extern struct vnodeopv_desc lfs_specop_opv_desc;
110 extern struct vnodeopv_desc lfs_fifoop_opv_desc;
111 extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
112 extern struct vnodeopv_desc dead_vnodeop_opv_desc;
113 extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
114 extern struct vnodeopv_desc spec_vnodeop_opv_desc;
115 extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
116 extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
117 extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
118 extern struct vnodeopv_desc lofs_vnodeop_opv_desc;
119 extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
120 extern struct vnodeopv_desc portal_vnodeop_opv_desc;
121 
122 struct vnodeopv_desc *vfs_opv_descs[] = {
123 	&ffs_vnodeop_opv_desc,
124 	&ffs_specop_opv_desc,
125 #ifdef FIFO
126 	&ffs_fifoop_opv_desc,
127 #endif
128 	&dead_vnodeop_opv_desc,
129 #ifdef FIFO
130 	&fifo_vnodeop_opv_desc,
131 #endif
132 	&spec_vnodeop_opv_desc,
133 #ifdef LFS
134 	&lfs_vnodeop_opv_desc,
135 	&lfs_specop_opv_desc,
136 #ifdef FIFO
137 	&lfs_fifoop_opv_desc,
138 #endif
139 #endif
140 #ifdef MFS
141 	&mfs_vnodeop_opv_desc,
142 #endif
143 #ifdef NFS
144 	&nfsv2_vnodeop_opv_desc,
145 	&spec_nfsv2nodeop_opv_desc,
146 #ifdef FIFO
147 	&fifo_nfsv2nodeop_opv_desc,
148 #endif
149 #endif
150 #ifdef LOFS
151 	&lofs_vnodeop_opv_desc,
152 #endif
153 #ifdef FDESC
154 	&fdesc_vnodeop_opv_desc,
155 #endif
156 #ifdef PORTAL
157 	&portal_vnodeop_opv_desc,
158 #endif
159 	NULL
160 };
161