vfs_mount.c revision 2152
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.2 1994/08/02 07:43:19 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 UNION
142extern	struct vfsops union_vfsops;
143#define	UNION_VFSOPS	&union_vfsops
144#else
145#define	UNION_VFSOPS	NULL
146#endif
147
148struct vfsops *vfssw[] = {
149	NULL,			/* 0 = MOUNT_NONE */
150	UFS_VFSOPS,		/* 1 = MOUNT_UFS */
151	NFS_VFSOPS,		/* 2 = MOUNT_NFS */
152	MFS_VFSOPS,		/* 3 = MOUNT_MFS */
153	NULL,			/* 4 = MOUNT_PC */
154	LFS_VFSOPS,		/* 5 = MOUNT_LFS */
155	NULL,			/* 6 = MOUNT_LOFS */
156	FDESC_VFSOPS,		/* 7 = MOUNT_FDESC */
157	PORTAL_VFSOPS,		/* 8 = MOUNT_PORTAL */
158	NULL_VFSOPS,		/* 9 = MOUNT_NULL */
159	UMAP_VFSOPS,		/* 10 = MOUNT_UMAP */
160	KERNFS_VFSOPS,		/* 11 = MOUNT_KERNFS */
161	PROCFS_VFSOPS,		/* 12 = MOUNT_PROCFS */
162	AFS_VFSOPS,		/* 13 = MOUNT_AFS */
163	CD9660_VFSOPS,		/* 14 = MOUNT_CD9660 */
164	UNION_VFSOPS,		/* 15 = MOUNT_UNION */
165	0
166};
167
168
169/*
170 *
171 * vfs_opv_descs enumerates the list of vnode classes, each with it's own
172 * vnode operation vector.  It is consulted at system boot to build operation
173 * vectors.  It is NULL terminated.
174 *
175 */
176extern struct vnodeopv_desc ffs_vnodeop_opv_desc;
177extern struct vnodeopv_desc ffs_specop_opv_desc;
178extern struct vnodeopv_desc ffs_fifoop_opv_desc;
179extern struct vnodeopv_desc lfs_vnodeop_opv_desc;
180extern struct vnodeopv_desc lfs_specop_opv_desc;
181extern struct vnodeopv_desc lfs_fifoop_opv_desc;
182extern struct vnodeopv_desc mfs_vnodeop_opv_desc;
183extern struct vnodeopv_desc dead_vnodeop_opv_desc;
184extern struct vnodeopv_desc fifo_vnodeop_opv_desc;
185extern struct vnodeopv_desc spec_vnodeop_opv_desc;
186extern struct vnodeopv_desc nfsv2_vnodeop_opv_desc;
187extern struct vnodeopv_desc spec_nfsv2nodeop_opv_desc;
188extern struct vnodeopv_desc fifo_nfsv2nodeop_opv_desc;
189extern struct vnodeopv_desc fdesc_vnodeop_opv_desc;
190extern struct vnodeopv_desc portal_vnodeop_opv_desc;
191extern struct vnodeopv_desc null_vnodeop_opv_desc;
192extern struct vnodeopv_desc umap_vnodeop_opv_desc;
193extern struct vnodeopv_desc kernfs_vnodeop_opv_desc;
194extern struct vnodeopv_desc procfs_vnodeop_opv_desc;
195extern struct vnodeopv_desc cd9660_vnodeop_opv_desc;
196extern struct vnodeopv_desc cd9660_specop_opv_desc;
197extern struct vnodeopv_desc cd9660_fifoop_opv_desc;
198extern struct vnodeopv_desc union_vnodeop_opv_desc;
199
200struct vnodeopv_desc *vfs_opv_descs[] = {
201	&ffs_vnodeop_opv_desc,
202	&ffs_specop_opv_desc,
203#ifdef FIFO
204	&ffs_fifoop_opv_desc,
205#endif
206	&dead_vnodeop_opv_desc,
207#ifdef FIFO
208	&fifo_vnodeop_opv_desc,
209#endif
210	&spec_vnodeop_opv_desc,
211#ifdef LFS
212	&lfs_vnodeop_opv_desc,
213	&lfs_specop_opv_desc,
214#ifdef FIFO
215	&lfs_fifoop_opv_desc,
216#endif
217#endif
218#ifdef MFS
219	&mfs_vnodeop_opv_desc,
220#endif
221#ifdef NFS
222	&nfsv2_vnodeop_opv_desc,
223	&spec_nfsv2nodeop_opv_desc,
224#ifdef FIFO
225	&fifo_nfsv2nodeop_opv_desc,
226#endif
227#endif
228#ifdef FDESC
229	&fdesc_vnodeop_opv_desc,
230#endif
231#ifdef PORTAL
232	&portal_vnodeop_opv_desc,
233#endif
234#ifdef NULLFS
235	&null_vnodeop_opv_desc,
236#endif
237#ifdef UMAPFS
238	&umap_vnodeop_opv_desc,
239#endif
240#ifdef KERNFS
241	&kernfs_vnodeop_opv_desc,
242#endif
243#ifdef PROCFS
244	&procfs_vnodeop_opv_desc,
245#endif
246#ifdef CD9660
247	&cd9660_vnodeop_opv_desc,
248	&cd9660_specop_opv_desc,
249#ifdef FIFO
250	&cd9660_fifoop_opv_desc,
251#endif
252#endif
253#ifdef UNION
254	&union_vnodeop_opv_desc,
255#endif
256	NULL
257};
258