vfs_init.c revision 1.37 1 1.37 ad /* $NetBSD: vfs_init.c,v 1.37 2008/01/16 12:34:51 ad Exp $ */
2 1.9 thorpej
3 1.9 thorpej /*-
4 1.16 thorpej * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
5 1.9 thorpej * All rights reserved.
6 1.9 thorpej *
7 1.9 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.9 thorpej * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 1.9 thorpej * NASA Ames Research Center.
10 1.9 thorpej *
11 1.9 thorpej * Redistribution and use in source and binary forms, with or without
12 1.9 thorpej * modification, are permitted provided that the following conditions
13 1.9 thorpej * are met:
14 1.9 thorpej * 1. Redistributions of source code must retain the above copyright
15 1.9 thorpej * notice, this list of conditions and the following disclaimer.
16 1.9 thorpej * 2. Redistributions in binary form must reproduce the above copyright
17 1.9 thorpej * notice, this list of conditions and the following disclaimer in the
18 1.9 thorpej * documentation and/or other materials provided with the distribution.
19 1.9 thorpej * 3. All advertising materials mentioning features or use of this software
20 1.9 thorpej * must display the following acknowledgement:
21 1.9 thorpej * This product includes software developed by the NetBSD
22 1.9 thorpej * Foundation, Inc. and its contributors.
23 1.9 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.9 thorpej * contributors may be used to endorse or promote products derived
25 1.9 thorpej * from this software without specific prior written permission.
26 1.9 thorpej *
27 1.9 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.9 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.9 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.9 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.9 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.9 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.9 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.9 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.9 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.9 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.9 thorpej * POSSIBILITY OF SUCH DAMAGE.
38 1.9 thorpej */
39 1.2 cgd
40 1.1 mycroft /*
41 1.1 mycroft * Copyright (c) 1989, 1993
42 1.1 mycroft * The Regents of the University of California. All rights reserved.
43 1.1 mycroft *
44 1.1 mycroft * This code is derived from software contributed
45 1.1 mycroft * to Berkeley by John Heidemann of the UCLA Ficus project.
46 1.1 mycroft *
47 1.1 mycroft * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project
48 1.1 mycroft *
49 1.1 mycroft * Redistribution and use in source and binary forms, with or without
50 1.1 mycroft * modification, are permitted provided that the following conditions
51 1.1 mycroft * are met:
52 1.1 mycroft * 1. Redistributions of source code must retain the above copyright
53 1.1 mycroft * notice, this list of conditions and the following disclaimer.
54 1.1 mycroft * 2. Redistributions in binary form must reproduce the above copyright
55 1.1 mycroft * notice, this list of conditions and the following disclaimer in the
56 1.1 mycroft * documentation and/or other materials provided with the distribution.
57 1.24 agc * 3. Neither the name of the University nor the names of its contributors
58 1.1 mycroft * may be used to endorse or promote products derived from this software
59 1.1 mycroft * without specific prior written permission.
60 1.1 mycroft *
61 1.1 mycroft * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
62 1.1 mycroft * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63 1.1 mycroft * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64 1.1 mycroft * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
65 1.1 mycroft * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
66 1.1 mycroft * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
67 1.1 mycroft * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
68 1.1 mycroft * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
69 1.1 mycroft * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
70 1.1 mycroft * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
71 1.1 mycroft * SUCH DAMAGE.
72 1.1 mycroft *
73 1.10 fvdl * @(#)vfs_init.c 8.5 (Berkeley) 5/11/95
74 1.1 mycroft */
75 1.20 lukem
76 1.20 lukem #include <sys/cdefs.h>
77 1.37 ad __KERNEL_RCSID(0, "$NetBSD: vfs_init.c,v 1.37 2008/01/16 12:34:51 ad Exp $");
78 1.1 mycroft
79 1.1 mycroft #include <sys/param.h>
80 1.1 mycroft #include <sys/mount.h>
81 1.1 mycroft #include <sys/time.h>
82 1.1 mycroft #include <sys/vnode.h>
83 1.1 mycroft #include <sys/stat.h>
84 1.1 mycroft #include <sys/namei.h>
85 1.1 mycroft #include <sys/ucred.h>
86 1.1 mycroft #include <sys/buf.h>
87 1.1 mycroft #include <sys/errno.h>
88 1.1 mycroft #include <sys/malloc.h>
89 1.5 christos #include <sys/systm.h>
90 1.37 ad #include <sys/module.h>
91 1.1 mycroft
92 1.1 mycroft /*
93 1.1 mycroft * Sigh, such primitive tools are these...
94 1.1 mycroft */
95 1.1 mycroft #if 0
96 1.1 mycroft #define DODEBUG(A) A
97 1.1 mycroft #else
98 1.1 mycroft #define DODEBUG(A)
99 1.1 mycroft #endif
100 1.1 mycroft
101 1.9 thorpej /*
102 1.9 thorpej * The global list of vnode operations.
103 1.9 thorpej */
104 1.17 jdolecek extern const struct vnodeop_desc * const vfs_op_descs[];
105 1.9 thorpej
106 1.9 thorpej /*
107 1.9 thorpej * These vnodeopv_descs are listed here because they are not
108 1.9 thorpej * associated with any particular file system, and thus cannot
109 1.9 thorpej * be initialized by vfs_attach().
110 1.9 thorpej */
111 1.18 jdolecek extern const struct vnodeopv_desc dead_vnodeop_opv_desc;
112 1.18 jdolecek extern const struct vnodeopv_desc fifo_vnodeop_opv_desc;
113 1.18 jdolecek extern const struct vnodeopv_desc spec_vnodeop_opv_desc;
114 1.18 jdolecek extern const struct vnodeopv_desc sync_vnodeop_opv_desc;
115 1.9 thorpej
116 1.18 jdolecek const struct vnodeopv_desc * const vfs_special_vnodeopv_descs[] = {
117 1.9 thorpej &dead_vnodeop_opv_desc,
118 1.9 thorpej &fifo_vnodeop_opv_desc,
119 1.9 thorpej &spec_vnodeop_opv_desc,
120 1.15 fvdl &sync_vnodeop_opv_desc,
121 1.9 thorpej NULL,
122 1.9 thorpej };
123 1.9 thorpej
124 1.34 pooka struct vfs_list_head vfs_list = /* vfs list */
125 1.34 pooka LIST_HEAD_INITIALIZER(vfs_list);
126 1.34 pooka
127 1.1 mycroft /*
128 1.1 mycroft * This code doesn't work if the defn is **vnodop_defns with cc.
129 1.1 mycroft * The problem is because of the compiler sometimes putting in an
130 1.1 mycroft * extra level of indirection for arrays. It's an interesting
131 1.1 mycroft * "feature" of C.
132 1.1 mycroft */
133 1.25 junyoung typedef int (*PFI)(void *);
134 1.5 christos
135 1.1 mycroft /*
136 1.1 mycroft * A miscellaneous routine.
137 1.1 mycroft * A generic "default" routine that just returns an error.
138 1.1 mycroft */
139 1.5 christos /*ARGSUSED*/
140 1.1 mycroft int
141 1.32 yamt vn_default_error(void *v)
142 1.1 mycroft {
143 1.1 mycroft
144 1.1 mycroft return (EOPNOTSUPP);
145 1.1 mycroft }
146 1.1 mycroft
147 1.1 mycroft /*
148 1.1 mycroft * vfs_init.c
149 1.1 mycroft *
150 1.1 mycroft * Allocate and fill in operations vectors.
151 1.1 mycroft *
152 1.1 mycroft * An undocumented feature of this approach to defining operations is that
153 1.1 mycroft * there can be multiple entries in vfs_opv_descs for the same operations
154 1.1 mycroft * vector. This allows third parties to extend the set of operations
155 1.1 mycroft * supported by another layer in a binary compatibile way. For example,
156 1.1 mycroft * assume that NFS needed to be modified to support Ficus. NFS has an entry
157 1.1 mycroft * (probably nfs_vnopdeop_decls) declaring all the operations NFS supports by
158 1.1 mycroft * default. Ficus could add another entry (ficus_nfs_vnodeop_decl_entensions)
159 1.1 mycroft * listing those new operations Ficus adds to NFS, all without modifying the
160 1.1 mycroft * NFS code. (Of couse, the OTW NFS protocol still needs to be munged, but
161 1.1 mycroft * that is a(whole)nother story.) This is a feature.
162 1.1 mycroft */
163 1.3 mycroft
164 1.3 mycroft /*
165 1.9 thorpej * Init the vector, if it needs it.
166 1.3 mycroft * Also handle backwards compatibility.
167 1.3 mycroft */
168 1.17 jdolecek static void
169 1.28 thorpej vfs_opv_init_explicit(const struct vnodeopv_desc *vfs_opv_desc)
170 1.1 mycroft {
171 1.25 junyoung int (**opv_desc_vector)(void *);
172 1.18 jdolecek const struct vnodeopv_entry_desc *opve_descp;
173 1.1 mycroft
174 1.3 mycroft opv_desc_vector = *(vfs_opv_desc->opv_desc_vector_p);
175 1.3 mycroft
176 1.3 mycroft for (opve_descp = vfs_opv_desc->opv_desc_ops;
177 1.3 mycroft opve_descp->opve_op;
178 1.3 mycroft opve_descp++) {
179 1.1 mycroft /*
180 1.3 mycroft * Sanity check: is this operation listed
181 1.3 mycroft * in the list of operations? We check this
182 1.23 mjl * by seeing if its offset is zero. Since
183 1.3 mycroft * the default routine should always be listed
184 1.3 mycroft * first, it should be the only one with a zero
185 1.3 mycroft * offset. Any other operation with a zero
186 1.3 mycroft * offset is probably not listed in
187 1.3 mycroft * vfs_op_descs, and so is probably an error.
188 1.3 mycroft *
189 1.3 mycroft * A panic here means the layer programmer
190 1.3 mycroft * has committed the all-too common bug
191 1.3 mycroft * of adding a new operation to the layer's
192 1.3 mycroft * list of vnode operations but
193 1.3 mycroft * not adding the operation to the system-wide
194 1.3 mycroft * list of supported operations.
195 1.1 mycroft */
196 1.3 mycroft if (opve_descp->opve_op->vdesc_offset == 0 &&
197 1.3 mycroft opve_descp->opve_op->vdesc_offset != VOFFSET(vop_default)) {
198 1.8 christos printf("operation %s not listed in %s.\n",
199 1.3 mycroft opve_descp->opve_op->vdesc_name, "vfs_op_descs");
200 1.3 mycroft panic ("vfs_opv_init: bad operation");
201 1.1 mycroft }
202 1.3 mycroft
203 1.3 mycroft /*
204 1.3 mycroft * Fill in this entry.
205 1.3 mycroft */
206 1.3 mycroft opv_desc_vector[opve_descp->opve_op->vdesc_offset] =
207 1.3 mycroft opve_descp->opve_impl;
208 1.1 mycroft }
209 1.3 mycroft }
210 1.3 mycroft
211 1.17 jdolecek static void
212 1.28 thorpej vfs_opv_init_default(const struct vnodeopv_desc *vfs_opv_desc)
213 1.3 mycroft {
214 1.3 mycroft int j;
215 1.25 junyoung int (**opv_desc_vector)(void *);
216 1.3 mycroft
217 1.3 mycroft opv_desc_vector = *(vfs_opv_desc->opv_desc_vector_p);
218 1.3 mycroft
219 1.3 mycroft /*
220 1.3 mycroft * Force every operations vector to have a default routine.
221 1.3 mycroft */
222 1.3 mycroft if (opv_desc_vector[VOFFSET(vop_default)] == NULL)
223 1.3 mycroft panic("vfs_opv_init: operation vector without default routine.");
224 1.3 mycroft
225 1.17 jdolecek for (j = 0; j < VNODE_OPS_COUNT; j++)
226 1.3 mycroft if (opv_desc_vector[j] == NULL)
227 1.26 perry opv_desc_vector[j] =
228 1.3 mycroft opv_desc_vector[VOFFSET(vop_default)];
229 1.3 mycroft }
230 1.3 mycroft
231 1.3 mycroft void
232 1.28 thorpej vfs_opv_init(const struct vnodeopv_desc * const *vopvdpp)
233 1.3 mycroft {
234 1.25 junyoung int (**opv_desc_vector)(void *);
235 1.3 mycroft int i;
236 1.3 mycroft
237 1.3 mycroft /*
238 1.9 thorpej * Allocate the vectors.
239 1.3 mycroft */
240 1.9 thorpej for (i = 0; vopvdpp[i] != NULL; i++) {
241 1.9 thorpej /* XXX - shouldn't be M_VNODE */
242 1.9 thorpej opv_desc_vector =
243 1.17 jdolecek malloc(VNODE_OPS_COUNT * sizeof(PFI), M_VNODE, M_WAITOK);
244 1.17 jdolecek memset(opv_desc_vector, 0, VNODE_OPS_COUNT * sizeof(PFI));
245 1.9 thorpej *(vopvdpp[i]->opv_desc_vector_p) = opv_desc_vector;
246 1.9 thorpej DODEBUG(printf("vector at %p allocated\n",
247 1.9 thorpej opv_desc_vector_p));
248 1.9 thorpej }
249 1.9 thorpej
250 1.9 thorpej /*
251 1.9 thorpej * ...and fill them in.
252 1.9 thorpej */
253 1.9 thorpej for (i = 0; vopvdpp[i] != NULL; i++)
254 1.9 thorpej vfs_opv_init_explicit(vopvdpp[i]);
255 1.3 mycroft
256 1.1 mycroft /*
257 1.1 mycroft * Finally, go back and replace unfilled routines
258 1.3 mycroft * with their default.
259 1.1 mycroft */
260 1.9 thorpej for (i = 0; vopvdpp[i] != NULL; i++)
261 1.9 thorpej vfs_opv_init_default(vopvdpp[i]);
262 1.9 thorpej }
263 1.9 thorpej
264 1.9 thorpej void
265 1.28 thorpej vfs_opv_free(const struct vnodeopv_desc * const *vopvdpp)
266 1.9 thorpej {
267 1.9 thorpej int i;
268 1.9 thorpej
269 1.9 thorpej /*
270 1.9 thorpej * Free the vectors allocated in vfs_opv_init().
271 1.9 thorpej */
272 1.9 thorpej for (i = 0; vopvdpp[i] != NULL; i++) {
273 1.9 thorpej /* XXX - shouldn't be M_VNODE */
274 1.9 thorpej free(*(vopvdpp[i]->opv_desc_vector_p), M_VNODE);
275 1.9 thorpej *(vopvdpp[i]->opv_desc_vector_p) = NULL;
276 1.9 thorpej }
277 1.1 mycroft }
278 1.1 mycroft
279 1.17 jdolecek #ifdef DEBUG
280 1.17 jdolecek static void
281 1.28 thorpej vfs_op_check(void)
282 1.1 mycroft {
283 1.1 mycroft int i;
284 1.1 mycroft
285 1.8 christos DODEBUG(printf("Vnode_interface_init.\n"));
286 1.17 jdolecek
287 1.1 mycroft /*
288 1.17 jdolecek * Check offset of each op.
289 1.1 mycroft */
290 1.17 jdolecek for (i = 0; vfs_op_descs[i]; i++) {
291 1.17 jdolecek if (vfs_op_descs[i]->vdesc_offset != i)
292 1.17 jdolecek panic("vfs_op_check: vfs_op_desc[] offset mismatch");
293 1.17 jdolecek }
294 1.17 jdolecek
295 1.17 jdolecek if (i != VNODE_OPS_COUNT) {
296 1.17 jdolecek panic("vfs_op_check: vnode ops count mismatch (%d != %d)",
297 1.17 jdolecek i, VNODE_OPS_COUNT);
298 1.1 mycroft }
299 1.17 jdolecek
300 1.17 jdolecek DODEBUG(printf ("vfs_opv_numops=%d\n", VNODE_OPS_COUNT));
301 1.1 mycroft }
302 1.17 jdolecek #endif /* DEBUG */
303 1.1 mycroft
304 1.1 mycroft /*
305 1.1 mycroft * Initialize the vnode structures and initialize each file system type.
306 1.1 mycroft */
307 1.5 christos void
308 1.28 thorpej vfsinit(void)
309 1.1 mycroft {
310 1.27 thorpej __link_set_decl(vfsops, struct vfsops);
311 1.27 thorpej struct vfsops * const *vfsp;
312 1.16 thorpej
313 1.16 thorpej /*
314 1.19 thorpej * Initialize the namei pathname buffer pool and cache.
315 1.16 thorpej */
316 1.36 ad pnbuf_cache = pool_cache_init(MAXPATHLEN, 0, 0, 0, "pnbufpl",
317 1.36 ad NULL, IPL_NONE, NULL, NULL, NULL);
318 1.36 ad KASSERT(pnbuf_cache != NULL);
319 1.1 mycroft
320 1.1 mycroft /*
321 1.1 mycroft * Initialize the vnode table
322 1.1 mycroft */
323 1.1 mycroft vntblinit();
324 1.9 thorpej
325 1.1 mycroft /*
326 1.1 mycroft * Initialize the vnode name cache
327 1.1 mycroft */
328 1.1 mycroft nchinit();
329 1.9 thorpej
330 1.17 jdolecek #ifdef DEBUG
331 1.1 mycroft /*
332 1.17 jdolecek * Check the list of vnode operations.
333 1.1 mycroft */
334 1.17 jdolecek vfs_op_check();
335 1.17 jdolecek #endif
336 1.9 thorpej
337 1.1 mycroft /*
338 1.9 thorpej * Initialize the special vnode operations.
339 1.9 thorpej */
340 1.9 thorpej vfs_opv_init(vfs_special_vnodeopv_descs);
341 1.9 thorpej
342 1.9 thorpej /*
343 1.9 thorpej * Establish each file system which was statically
344 1.9 thorpej * included in the kernel.
345 1.1 mycroft */
346 1.37 ad module_init_class(MODULE_CLASS_VFS);
347 1.27 thorpej __link_set_foreach(vfsp, vfsops) {
348 1.27 thorpej if (vfs_attach(*vfsp)) {
349 1.9 thorpej printf("multiple `%s' file systems",
350 1.27 thorpej (*vfsp)->vfs_name);
351 1.9 thorpej panic("vfsinit");
352 1.9 thorpej }
353 1.1 mycroft }
354 1.1 mycroft }
355 1.34 pooka
356 1.34 pooka /*
357 1.35 ad * Drop a reference to a file system type.
358 1.35 ad */
359 1.35 ad void
360 1.35 ad vfs_delref(struct vfsops *vfs)
361 1.35 ad {
362 1.35 ad
363 1.35 ad mutex_enter(&vfs_list_lock);
364 1.35 ad vfs->vfs_refcount--;
365 1.35 ad mutex_exit(&vfs_list_lock);
366 1.35 ad }
367 1.35 ad
368 1.35 ad /*
369 1.34 pooka * Establish a file system and initialize it.
370 1.34 pooka */
371 1.34 pooka int
372 1.34 pooka vfs_attach(struct vfsops *vfs)
373 1.34 pooka {
374 1.34 pooka struct vfsops *v;
375 1.34 pooka int error = 0;
376 1.34 pooka
377 1.35 ad mutex_enter(&vfs_list_lock);
378 1.34 pooka
379 1.34 pooka /*
380 1.34 pooka * Make sure this file system doesn't already exist.
381 1.34 pooka */
382 1.34 pooka LIST_FOREACH(v, &vfs_list, vfs_list) {
383 1.34 pooka if (strcmp(vfs->vfs_name, v->vfs_name) == 0) {
384 1.34 pooka error = EEXIST;
385 1.34 pooka goto out;
386 1.34 pooka }
387 1.34 pooka }
388 1.34 pooka
389 1.34 pooka /*
390 1.34 pooka * Initialize the vnode operations for this file system.
391 1.34 pooka */
392 1.34 pooka vfs_opv_init(vfs->vfs_opv_descs);
393 1.34 pooka
394 1.34 pooka /*
395 1.34 pooka * Now initialize the file system itself.
396 1.34 pooka */
397 1.34 pooka (*vfs->vfs_init)();
398 1.34 pooka
399 1.34 pooka /*
400 1.34 pooka * ...and link it into the kernel's list.
401 1.34 pooka */
402 1.34 pooka LIST_INSERT_HEAD(&vfs_list, vfs, vfs_list);
403 1.34 pooka
404 1.34 pooka /*
405 1.34 pooka * Sanity: make sure the reference count is 0.
406 1.34 pooka */
407 1.34 pooka vfs->vfs_refcount = 0;
408 1.34 pooka out:
409 1.35 ad mutex_exit(&vfs_list_lock);
410 1.34 pooka return (error);
411 1.34 pooka }
412 1.34 pooka
413 1.34 pooka /*
414 1.34 pooka * Remove a file system from the kernel.
415 1.34 pooka */
416 1.34 pooka int
417 1.34 pooka vfs_detach(struct vfsops *vfs)
418 1.34 pooka {
419 1.34 pooka struct vfsops *v;
420 1.35 ad int error = 0;
421 1.35 ad
422 1.35 ad mutex_enter(&vfs_list_lock);
423 1.34 pooka
424 1.34 pooka /*
425 1.34 pooka * Make sure no one is using the filesystem.
426 1.34 pooka */
427 1.35 ad if (vfs->vfs_refcount != 0) {
428 1.35 ad error = EBUSY;
429 1.35 ad goto out;
430 1.35 ad }
431 1.34 pooka
432 1.34 pooka /*
433 1.34 pooka * ...and remove it from the kernel's list.
434 1.34 pooka */
435 1.34 pooka LIST_FOREACH(v, &vfs_list, vfs_list) {
436 1.34 pooka if (v == vfs) {
437 1.34 pooka LIST_REMOVE(v, vfs_list);
438 1.34 pooka break;
439 1.34 pooka }
440 1.34 pooka }
441 1.34 pooka
442 1.35 ad if (v == NULL) {
443 1.35 ad error = ESRCH;
444 1.35 ad goto out;
445 1.35 ad }
446 1.34 pooka
447 1.34 pooka /*
448 1.34 pooka * Now run the file system-specific cleanups.
449 1.34 pooka */
450 1.34 pooka (*vfs->vfs_done)();
451 1.34 pooka
452 1.34 pooka /*
453 1.34 pooka * Free the vnode operations vector.
454 1.34 pooka */
455 1.34 pooka vfs_opv_free(vfs->vfs_opv_descs);
456 1.35 ad out:
457 1.35 ad mutex_exit(&vfs_list_lock);
458 1.35 ad return (error);
459 1.34 pooka }
460 1.34 pooka
461 1.34 pooka void
462 1.34 pooka vfs_reinit(void)
463 1.34 pooka {
464 1.34 pooka struct vfsops *vfs;
465 1.34 pooka
466 1.35 ad mutex_enter(&vfs_list_lock);
467 1.34 pooka LIST_FOREACH(vfs, &vfs_list, vfs_list) {
468 1.34 pooka if (vfs->vfs_reinit) {
469 1.35 ad vfs->vfs_refcount++;
470 1.35 ad mutex_exit(&vfs_list_lock);
471 1.34 pooka (*vfs->vfs_reinit)();
472 1.35 ad mutex_enter(&vfs_list_lock);
473 1.35 ad vfs->vfs_refcount--;
474 1.34 pooka }
475 1.34 pooka }
476 1.35 ad mutex_exit(&vfs_list_lock);
477 1.34 pooka }
478