vfs_mount.c revision 2893
1/*
2 * Copyright (c) 1989, 1993
3 *	The Regents of the University of California.  All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 *    must display the following acknowledgement:
15 *	This product includes software developed by the University of
16 *	California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 *    may be used to endorse or promote products derived from this software
19 *    without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 *	@(#)vfs_conf.c	8.8 (Berkeley) 3/31/94
34 * $Id: vfs_conf.c,v 1.3 1994/08/20 16:03:12 davidg Exp $
35 */
36
37#include <sys/param.h>
38#include <sys/mount.h>
39#include <sys/vnode.h>
40
41#ifdef FFS
42#include <ufs/ffs/ffs_extern.h>
43
44/*
45 * This specifies the filesystem used to mount the root.
46 * This specification should be done by /etc/config.
47 */
48int (*mountroot)() = ffs_mountroot;
49#endif
50
51struct vnode *rootvnode;
52
53/*
54 * Set up the filesystem operations for vnodes.
55 * The types are defined in mount.h.
56 */
57#ifdef FFS
58extern	struct vfsops ufs_vfsops;
59#define	UFS_VFSOPS	&ufs_vfsops
60#else
61#define	UFS_VFSOPS	NULL
62#endif
63
64#ifdef LFS
65extern	struct vfsops lfs_vfsops;
66#define	LFS_VFSOPS	&lfs_vfsops
67#else
68#define	LFS_VFSOPS	NULL
69#endif
70
71#ifdef MFS
72extern	struct vfsops mfs_vfsops;
73#define	MFS_VFSOPS	&mfs_vfsops
74#else
75#define	MFS_VFSOPS	NULL
76#endif
77
78#ifdef NFS
79extern	struct vfsops nfs_vfsops;
80#define	NFS_VFSOPS	&nfs_vfsops
81#else
82#define	NFS_VFSOPS	NULL
83#endif
84
85#ifdef FDESC
86extern	struct vfsops fdesc_vfsops;
87#define	FDESC_VFSOPS	&fdesc_vfsops
88#else
89#define	FDESC_VFSOPS	NULL
90#endif
91
92#ifdef PORTAL
93extern	struct vfsops portal_vfsops;
94#define	PORTAL_VFSOPS	&portal_vfsops
95#else
96#define	PORTAL_VFSOPS	NULL
97#endif
98
99#ifdef NULLFS
100extern	struct vfsops null_vfsops;
101#define NULL_VFSOPS	&null_vfsops
102#else
103#define NULL_VFSOPS	NULL
104#endif
105
106#ifdef UMAPFS
107extern	struct vfsops umap_vfsops;
108#define UMAP_VFSOPS	&umap_vfsops
109#else
110#define UMAP_VFSOPS	NULL
111#endif
112
113#ifdef KERNFS
114extern	struct vfsops kernfs_vfsops;
115#define KERNFS_VFSOPS	&kernfs_vfsops
116#else
117#define KERNFS_VFSOPS	NULL
118#endif
119
120#ifdef PROCFS
121extern	struct vfsops procfs_vfsops;
122#define PROCFS_VFSOPS	&procfs_vfsops
123#else
124#define PROCFS_VFSOPS	NULL
125#endif
126
127#ifdef AFS
128extern	struct vfsops afs_vfsops;
129#define AFS_VFSOPS	&afs_vfsops
130#else
131#define AFS_VFSOPS	NULL
132#endif
133
134#ifdef CD9660
135extern	struct vfsops cd9660_vfsops;
136#define CD9660_VFSOPS	&cd9660_vfsops
137#else
138#define CD9660_VFSOPS	NULL
139#endif
140
141#ifdef MSDOSFS
142extern	struct vfsops msdosfs_vfsops;
143#define MSDOSFS_VFSOPS	&msdosfs_vfsops
144#else
145#define MSDOSFS_VFSOPS	NULL
146#endif
147
148#ifdef UNION
149extern	struct vfsops union_vfsops;
150#define	UNION_VFSOPS	&union_vfsops
151#else
152#define	UNION_VFSOPS	NULL
153#endif
154
155struct vfsops *vfssw[] = {
156	NULL,			/* 0 = MOUNT_NONE */
157	UFS_VFSOPS,		/* 1 = MOUNT_UFS */
158	NFS_VFSOPS,		/* 2 = MOUNT_NFS */
159	MFS_VFSOPS,		/* 3 = MOUNT_MFS */
160	MSDOSFS_VFSOPS,		/* 4 = MOUNT_MSDOS */
161	LFS_VFSOPS,		/* 5 = MOUNT_LFS */
162	NULL,			/* 6 = MOUNT_LOFS */
163	FDESC_VFSOPS,		/* 7 = MOUNT_FDESC */
164	PORTAL_VFSOPS,		/* 8 = MOUNT_PORTAL */
165	NULL_VFSOPS,		/* 9 = MOUNT_NULL */
166	UMAP_VFSOPS,		/* 10 = MOUNT_UMAP */
167	KERNFS_VFSOPS,		/* 11 = MOUNT_KERNFS */
168	PROCFS_VFSOPS,		/* 12 = MOUNT_PROCFS */
169	AFS_VFSOPS,		/* 13 = MOUNT_AFS */
170	CD9660_VFSOPS,		/* 14 = MOUNT_CD9660 */
171	UNION_VFSOPS,		/* 15 = MOUNT_UNION */
172	0
173};
174
175
176/*
177 *
178 * vfs_opv_descs enumerates the list of vnode classes, each with it's own
179 * vnode operation vector.  It is consulted at system boot to build operation
180 * vectors.  It is NULL terminated.
181 *
182 */
183extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
184extern struct vnodeopv_desc ffs_specop_opv_desc;
185extern struct vnodeopv_desc ffs_fifoop_opv_desc;
186extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
187extern struct vnodeopv_desc lfs_specop_opv_desc;
188extern struct vnodeopv_desc lfs_fifoop_opv_desc;
189extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
190extern struct vnodeopv_desc dead_vnodeop_opv_desc;
191extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
192extern struct vnodeopv_desc spec_vnodeop_opv_desc;
193extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
194extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
195extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
196extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
197extern struct vnodeopv_desc portal_vnodeop_opv_desc;
198extern struct vnodeopv_desc null_vnodeop_opv_desc;
199extern struct vnodeopv_desc umap_vnodeop_opv_desc;
200extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
201extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
202extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
203extern struct vnodeopv_desc cd9660_specop_opv_desc;
204extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
205extern struct vnodeopv_desc msdosfs_vnodeop_opv_desc;
206extern struct vnodeopv_desc union_vnodeop_opv_desc;
207
208struct vnodeopv_desc *vfs_opv_descs[] = {
209	&ffs_vnodeop_opv_desc,
210	&ffs_specop_opv_desc,
211#ifdef FIFO
212	&ffs_fifoop_opv_desc,
213#endif
214	&dead_vnodeop_opv_desc,
215#ifdef FIFO
216	&fifo_vnodeop_opv_desc,
217#endif
218	&spec_vnodeop_opv_desc,
219#ifdef LFS
220	&lfs_vnodeop_opv_desc,
221	&lfs_specop_opv_desc,
222#ifdef FIFO
223	&lfs_fifoop_opv_desc,
224#endif
225#endif
226#ifdef MFS
227	&mfs_vnodeop_opv_desc,
228#endif
229#ifdef NFS
230	&nfsv2_vnodeop_opv_desc,
231	&spec_nfsv2nodeop_opv_desc,
232#ifdef FIFO
233	&fifo_nfsv2nodeop_opv_desc,
234#endif
235#endif
236#ifdef FDESC
237	&fdesc_vnodeop_opv_desc,
238#endif
239#ifdef PORTAL
240	&portal_vnodeop_opv_desc,
241#endif
242#ifdef NULLFS
243	&null_vnodeop_opv_desc,
244#endif
245#ifdef UMAPFS
246	&umap_vnodeop_opv_desc,
247#endif
248#ifdef KERNFS
249	&kernfs_vnodeop_opv_desc,
250#endif
251#ifdef PROCFS
252	&procfs_vnodeop_opv_desc,
253#endif
254#ifdef CD9660
255	&cd9660_vnodeop_opv_desc,
256	&cd9660_specop_opv_desc,
257#ifdef FIFO
258	&cd9660_fifoop_opv_desc,
259#endif
260#endif
261#ifdef MSDOSFS
262	&msdosfs_vnodeop_opv_desc,
263#endif
264#ifdef UNION
265	&union_vnodeop_opv_desc,
266#endif
267	NULL
268};
269