xref: /freebsd/sys/kern/vfs_default.c (revision 17d6c636720d00f77e5d098daf4c278f89d84f7b)
1 /*
2  * Copyright (c) 1989, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * This code is derived from software contributed
6  * to Berkeley by John Heidemann of the UCLA Ficus project.
7  *
8  * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the University of
21  *	California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  *
39  * $FreeBSD$
40  */
41 
42 #include <sys/param.h>
43 #include <sys/systm.h>
44 #include <sys/bio.h>
45 #include <sys/buf.h>
46 #include <sys/conf.h>
47 #include <sys/kernel.h>
48 #include <sys/lock.h>
49 #include <sys/malloc.h>
50 #include <sys/mount.h>
51 #include <sys/mutex.h>
52 #include <sys/unistd.h>
53 #include <sys/vnode.h>
54 #include <sys/poll.h>
55 
56 #include <machine/limits.h>
57 
58 #include <vm/vm.h>
59 #include <vm/vm_object.h>
60 #include <vm/vm_extern.h>
61 #include <vm/pmap.h>
62 #include <vm/vm_map.h>
63 #include <vm/vm_page.h>
64 #include <vm/vm_pager.h>
65 #include <vm/vnode_pager.h>
66 #include <vm/vm_zone.h>
67 
68 static int	vop_nolookup __P((struct vop_lookup_args *));
69 static int	vop_nostrategy __P((struct vop_strategy_args *));
70 
71 /*
72  * This vnode table stores what we want to do if the filesystem doesn't
73  * implement a particular VOP.
74  *
75  * If there is no specific entry here, we will return EOPNOTSUPP.
76  *
77  */
78 
79 vop_t **default_vnodeop_p;
80 static struct vnodeopv_entry_desc default_vnodeop_entries[] = {
81 	{ &vop_default_desc,		(vop_t *) vop_eopnotsupp },
82 	{ &vop_advlock_desc,		(vop_t *) vop_einval },
83 	{ &vop_bmap_desc,		(vop_t *) vop_stdbmap },
84 	{ &vop_close_desc,		(vop_t *) vop_null },
85 	{ &vop_createvobject_desc,	(vop_t *) vop_stdcreatevobject },
86 	{ &vop_destroyvobject_desc,	(vop_t *) vop_stddestroyvobject },
87 	{ &vop_fsync_desc,		(vop_t *) vop_null },
88 	{ &vop_getpages_desc,		(vop_t *) vop_stdgetpages },
89 	{ &vop_getvobject_desc,		(vop_t *) vop_stdgetvobject },
90 	{ &vop_inactive_desc,		(vop_t *) vop_stdinactive },
91 	{ &vop_ioctl_desc,		(vop_t *) vop_enotty },
92 	{ &vop_islocked_desc,		(vop_t *) vop_noislocked },
93 	{ &vop_lease_desc,		(vop_t *) vop_null },
94 	{ &vop_lock_desc,		(vop_t *) vop_nolock },
95 	{ &vop_lookup_desc,		(vop_t *) vop_nolookup },
96 	{ &vop_open_desc,		(vop_t *) vop_null },
97 	{ &vop_pathconf_desc,		(vop_t *) vop_einval },
98 	{ &vop_putpages_desc,		(vop_t *) vop_stdputpages },
99 	{ &vop_poll_desc,		(vop_t *) vop_nopoll },
100 	{ &vop_readlink_desc,		(vop_t *) vop_einval },
101 	{ &vop_revoke_desc,		(vop_t *) vop_revoke },
102 	{ &vop_strategy_desc,		(vop_t *) vop_nostrategy },
103 	{ &vop_unlock_desc,		(vop_t *) vop_nounlock },
104 	{ NULL, NULL }
105 };
106 
107 static struct vnodeopv_desc default_vnodeop_opv_desc =
108         { &default_vnodeop_p, default_vnodeop_entries };
109 
110 VNODEOP_SET(default_vnodeop_opv_desc);
111 
112 int
113 vop_eopnotsupp(struct vop_generic_args *ap)
114 {
115 	/*
116 	printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name);
117 	*/
118 
119 	return (EOPNOTSUPP);
120 }
121 
122 int
123 vop_ebadf(struct vop_generic_args *ap)
124 {
125 
126 	return (EBADF);
127 }
128 
129 int
130 vop_enotty(struct vop_generic_args *ap)
131 {
132 
133 	return (ENOTTY);
134 }
135 
136 int
137 vop_einval(struct vop_generic_args *ap)
138 {
139 
140 	return (EINVAL);
141 }
142 
143 int
144 vop_null(struct vop_generic_args *ap)
145 {
146 
147 	return (0);
148 }
149 
150 int
151 vop_defaultop(struct vop_generic_args *ap)
152 {
153 
154 	return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap));
155 }
156 
157 int
158 vop_panic(struct vop_generic_args *ap)
159 {
160 
161 	panic("filesystem goof: vop_panic[%s]", ap->a_desc->vdesc_name);
162 }
163 
164 static int
165 vop_nolookup(ap)
166 	struct vop_lookup_args /* {
167 		struct vnode *a_dvp;
168 		struct vnode **a_vpp;
169 		struct componentname *a_cnp;
170 	} */ *ap;
171 {
172 
173 	*ap->a_vpp = NULL;
174 	return (ENOTDIR);
175 }
176 
177 /*
178  *	vop_nostrategy:
179  *
180  *	Strategy routine for VFS devices that have none.
181  *
182  *	BIO_ERROR and B_INVAL must be cleared prior to calling any strategy
183  *	routine.  Typically this is done for a BIO_READ strategy call.
184  *	Typically B_INVAL is assumed to already be clear prior to a write
185  *	and should not be cleared manually unless you just made the buffer
186  *	invalid.  BIO_ERROR should be cleared either way.
187  */
188 
189 static int
190 vop_nostrategy (struct vop_strategy_args *ap)
191 {
192 	printf("No strategy for buffer at %p\n", ap->a_bp);
193 	vprint("", ap->a_vp);
194 	vprint("", ap->a_bp->b_vp);
195 	ap->a_bp->b_ioflags |= BIO_ERROR;
196 	ap->a_bp->b_error = EOPNOTSUPP;
197 	bufdone(ap->a_bp);
198 	return (EOPNOTSUPP);
199 }
200 
201 int
202 vop_stdpathconf(ap)
203 	struct vop_pathconf_args /* {
204 	struct vnode *a_vp;
205 	int a_name;
206 	int *a_retval;
207 	} */ *ap;
208 {
209 
210 	switch (ap->a_name) {
211 		case _PC_LINK_MAX:
212 			*ap->a_retval = LINK_MAX;
213 			return (0);
214 		case _PC_MAX_CANON:
215 			*ap->a_retval = MAX_CANON;
216 			return (0);
217 		case _PC_MAX_INPUT:
218 			*ap->a_retval = MAX_INPUT;
219 			return (0);
220 		case _PC_PIPE_BUF:
221 			*ap->a_retval = PIPE_BUF;
222 			return (0);
223 		case _PC_CHOWN_RESTRICTED:
224 			*ap->a_retval = 1;
225 			return (0);
226 		case _PC_VDISABLE:
227 			*ap->a_retval = _POSIX_VDISABLE;
228 			return (0);
229 		default:
230 			return (EINVAL);
231 	}
232 	/* NOTREACHED */
233 }
234 
235 /*
236  * Standard lock, unlock and islocked functions.
237  *
238  * These depend on the lock structure being the first element in the
239  * inode, ie: vp->v_data points to the the lock!
240  */
241 int
242 vop_stdlock(ap)
243 	struct vop_lock_args /* {
244 		struct vnode *a_vp;
245 		int a_flags;
246 		struct thread *a_td;
247 	} */ *ap;
248 {
249 	struct vnode *vp = ap->a_vp;
250 
251 #ifndef	DEBUG_LOCKS
252 	return (lockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock, ap->a_td));
253 #else
254 	return (debuglockmgr(&vp->v_lock, ap->a_flags, &vp->v_interlock,
255 	    ap->a_td, "vop_stdlock", vp->filename, vp->line));
256 #endif
257 }
258 
259 int
260 vop_stdunlock(ap)
261 	struct vop_unlock_args /* {
262 		struct vnode *a_vp;
263 		int a_flags;
264 		struct thread *a_td;
265 	} */ *ap;
266 {
267 	struct vnode *vp = ap->a_vp;
268 
269 	return (lockmgr(&vp->v_lock, ap->a_flags | LK_RELEASE, &vp->v_interlock,
270 	    ap->a_td));
271 }
272 
273 int
274 vop_stdislocked(ap)
275 	struct vop_islocked_args /* {
276 		struct vnode *a_vp;
277 		struct thread *a_td;
278 	} */ *ap;
279 {
280 
281 	return (lockstatus(&ap->a_vp->v_lock, ap->a_td));
282 }
283 
284 int
285 vop_stdinactive(ap)
286 	struct vop_inactive_args /* {
287 		struct vnode *a_vp;
288 		struct thread *a_td;
289 	} */ *ap;
290 {
291 
292 	VOP_UNLOCK(ap->a_vp, 0, ap->a_td);
293 	return (0);
294 }
295 
296 /*
297  * Return true for select/poll.
298  */
299 int
300 vop_nopoll(ap)
301 	struct vop_poll_args /* {
302 		struct vnode *a_vp;
303 		int  a_events;
304 		struct ucred *a_cred;
305 		struct thread *a_td;
306 	} */ *ap;
307 {
308 	/*
309 	 * Return true for read/write.  If the user asked for something
310 	 * special, return POLLNVAL, so that clients have a way of
311 	 * determining reliably whether or not the extended
312 	 * functionality is present without hard-coding knowledge
313 	 * of specific filesystem implementations.
314 	 */
315 	if (ap->a_events & ~POLLSTANDARD)
316 		return (POLLNVAL);
317 
318 	return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
319 }
320 
321 /*
322  * Implement poll for local filesystems that support it.
323  */
324 int
325 vop_stdpoll(ap)
326 	struct vop_poll_args /* {
327 		struct vnode *a_vp;
328 		int  a_events;
329 		struct ucred *a_cred;
330 		struct thread *a_td;
331 	} */ *ap;
332 {
333 	if (ap->a_events & ~POLLSTANDARD)
334 		return (vn_pollrecord(ap->a_vp, ap->a_td, ap->a_events));
335 	return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
336 }
337 
338 /*
339  * Stubs to use when there is no locking to be done on the underlying object.
340  * A minimal shared lock is necessary to ensure that the underlying object
341  * is not revoked while an operation is in progress. So, an active shared
342  * count is maintained in an auxillary vnode lock structure.
343  */
344 int
345 vop_sharedlock(ap)
346 	struct vop_lock_args /* {
347 		struct vnode *a_vp;
348 		int a_flags;
349 		struct thread *a_td;
350 	} */ *ap;
351 {
352 	/*
353 	 * This code cannot be used until all the non-locking filesystems
354 	 * (notably NFS) are converted to properly lock and release nodes.
355 	 * Also, certain vnode operations change the locking state within
356 	 * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
357 	 * and symlink). Ideally these operations should not change the
358 	 * lock state, but should be changed to let the caller of the
359 	 * function unlock them. Otherwise all intermediate vnode layers
360 	 * (such as union, umapfs, etc) must catch these functions to do
361 	 * the necessary locking at their layer. Note that the inactive
362 	 * and lookup operations also change their lock state, but this
363 	 * cannot be avoided, so these two operations will always need
364 	 * to be handled in intermediate layers.
365 	 */
366 	struct vnode *vp = ap->a_vp;
367 	int vnflags, flags = ap->a_flags;
368 
369 	switch (flags & LK_TYPE_MASK) {
370 	case LK_DRAIN:
371 		vnflags = LK_DRAIN;
372 		break;
373 	case LK_EXCLUSIVE:
374 #ifdef DEBUG_VFS_LOCKS
375 		/*
376 		 * Normally, we use shared locks here, but that confuses
377 		 * the locking assertions.
378 		 */
379 		vnflags = LK_EXCLUSIVE;
380 		break;
381 #endif
382 	case LK_SHARED:
383 		vnflags = LK_SHARED;
384 		break;
385 	case LK_UPGRADE:
386 	case LK_EXCLUPGRADE:
387 	case LK_DOWNGRADE:
388 		return (0);
389 	case LK_RELEASE:
390 	default:
391 		panic("vop_sharedlock: bad operation %d", flags & LK_TYPE_MASK);
392 	}
393 	if (flags & LK_INTERLOCK)
394 		vnflags |= LK_INTERLOCK;
395 #ifndef	DEBUG_LOCKS
396 	return (lockmgr(&vp->v_lock, vnflags, &vp->v_interlock, ap->a_td));
397 #else
398 	return (debuglockmgr(&vp->v_lock, vnflags, &vp->v_interlock, ap->a_td,
399 	    "vop_sharedlock", vp->filename, vp->line));
400 #endif
401 }
402 
403 /*
404  * Stubs to use when there is no locking to be done on the underlying object.
405  * A minimal shared lock is necessary to ensure that the underlying object
406  * is not revoked while an operation is in progress. So, an active shared
407  * count is maintained in an auxillary vnode lock structure.
408  */
409 int
410 vop_nolock(ap)
411 	struct vop_lock_args /* {
412 		struct vnode *a_vp;
413 		int a_flags;
414 		struct thread *a_td;
415 	} */ *ap;
416 {
417 #ifdef notyet
418 	/*
419 	 * This code cannot be used until all the non-locking filesystems
420 	 * (notably NFS) are converted to properly lock and release nodes.
421 	 * Also, certain vnode operations change the locking state within
422 	 * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
423 	 * and symlink). Ideally these operations should not change the
424 	 * lock state, but should be changed to let the caller of the
425 	 * function unlock them. Otherwise all intermediate vnode layers
426 	 * (such as union, umapfs, etc) must catch these functions to do
427 	 * the necessary locking at their layer. Note that the inactive
428 	 * and lookup operations also change their lock state, but this
429 	 * cannot be avoided, so these two operations will always need
430 	 * to be handled in intermediate layers.
431 	 */
432 	struct vnode *vp = ap->a_vp;
433 	int vnflags, flags = ap->a_flags;
434 
435 	switch (flags & LK_TYPE_MASK) {
436 	case LK_DRAIN:
437 		vnflags = LK_DRAIN;
438 		break;
439 	case LK_EXCLUSIVE:
440 	case LK_SHARED:
441 		vnflags = LK_SHARED;
442 		break;
443 	case LK_UPGRADE:
444 	case LK_EXCLUPGRADE:
445 	case LK_DOWNGRADE:
446 		return (0);
447 	case LK_RELEASE:
448 	default:
449 		panic("vop_nolock: bad operation %d", flags & LK_TYPE_MASK);
450 	}
451 	if (flags & LK_INTERLOCK)
452 		vnflags |= LK_INTERLOCK;
453 	return(lockmgr(&vp->v_lock, vnflags, &vp->v_interlock, ap->a_td));
454 #else /* for now */
455 	/*
456 	 * Since we are not using the lock manager, we must clear
457 	 * the interlock here.
458 	 */
459 	if (ap->a_flags & LK_INTERLOCK)
460 		mtx_unlock(&ap->a_vp->v_interlock);
461 	return (0);
462 #endif
463 }
464 
465 /*
466  * Do the inverse of vop_nolock, handling the interlock in a compatible way.
467  */
468 int
469 vop_nounlock(ap)
470 	struct vop_unlock_args /* {
471 		struct vnode *a_vp;
472 		int a_flags;
473 		struct thread *a_td;
474 	} */ *ap;
475 {
476 
477 	/*
478 	 * Since we are not using the lock manager, we must clear
479 	 * the interlock here.
480 	 */
481 	if (ap->a_flags & LK_INTERLOCK)
482 		mtx_unlock(&ap->a_vp->v_interlock);
483 	return (0);
484 }
485 
486 /*
487  * Return whether or not the node is in use.
488  */
489 int
490 vop_noislocked(ap)
491 	struct vop_islocked_args /* {
492 		struct vnode *a_vp;
493 		struct thread *a_td;
494 	} */ *ap;
495 {
496 
497 	return (0);
498 }
499 
500 /*
501  * Return our mount point, as we will take charge of the writes.
502  */
503 int
504 vop_stdgetwritemount(ap)
505 	struct vop_getwritemount_args /* {
506 		struct vnode *a_vp;
507 		struct mount **a_mpp;
508 	} */ *ap;
509 {
510 
511 	*(ap->a_mpp) = ap->a_vp->v_mount;
512 	return (0);
513 }
514 
515 int
516 vop_stdcreatevobject(ap)
517 	struct vop_createvobject_args /* {
518 		struct vnode *vp;
519 		struct ucred *cred;
520 		struct thread *td;
521 	} */ *ap;
522 {
523 	struct vnode *vp = ap->a_vp;
524 	struct ucred *cred = ap->a_cred;
525 	struct thread *td = ap->a_td;
526 	struct vattr vat;
527 	vm_object_t object;
528 	int error = 0;
529 
530 	GIANT_REQUIRED;
531 
532 	if (!vn_isdisk(vp, NULL) && vn_canvmio(vp) == FALSE)
533 		return (0);
534 
535 retry:
536 	if ((object = vp->v_object) == NULL) {
537 		if (vp->v_type == VREG || vp->v_type == VDIR) {
538 			if ((error = VOP_GETATTR(vp, &vat, cred, td)) != 0)
539 				goto retn;
540 			object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
541 		} else if (devsw(vp->v_rdev) != NULL) {
542 			/*
543 			 * This simply allocates the biggest object possible
544 			 * for a disk vnode.  This should be fixed, but doesn't
545 			 * cause any problems (yet).
546 			 */
547 			object = vnode_pager_alloc(vp, IDX_TO_OFF(INT_MAX), 0, 0);
548 		} else {
549 			goto retn;
550 		}
551 		/*
552 		 * Dereference the reference we just created.  This assumes
553 		 * that the object is associated with the vp.
554 		 */
555 		object->ref_count--;
556 		vp->v_usecount--;
557 	} else {
558 		if (object->flags & OBJ_DEAD) {
559 			VOP_UNLOCK(vp, 0, td);
560 			tsleep(object, PVM, "vodead", 0);
561 			vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
562 			goto retry;
563 		}
564 	}
565 
566 	KASSERT(vp->v_object != NULL, ("vfs_object_create: NULL object"));
567 	vp->v_flag |= VOBJBUF;
568 
569 retn:
570 	return (error);
571 }
572 
573 int
574 vop_stddestroyvobject(ap)
575 	struct vop_destroyvobject_args /* {
576 		struct vnode *vp;
577 	} */ *ap;
578 {
579 	struct vnode *vp = ap->a_vp;
580 	vm_object_t obj = vp->v_object;
581 
582 	GIANT_REQUIRED;
583 
584 	if (vp->v_object == NULL)
585 		return (0);
586 
587 	if (obj->ref_count == 0) {
588 		/*
589 		 * vclean() may be called twice. The first time
590 		 * removes the primary reference to the object,
591 		 * the second time goes one further and is a
592 		 * special-case to terminate the object.
593 		 *
594 		 * don't double-terminate the object
595 		 */
596 		if ((obj->flags & OBJ_DEAD) == 0)
597 			vm_object_terminate(obj);
598 	} else {
599 		/*
600 		 * Woe to the process that tries to page now :-).
601 		 */
602 		vm_pager_deallocate(obj);
603 	}
604 	return (0);
605 }
606 
607 /*
608  * Return the underlying VM object.  This routine may be called with or
609  * without the vnode interlock held.  If called without, the returned
610  * object is not guarenteed to be valid.  The syncer typically gets the
611  * object without holding the interlock in order to quickly test whether
612  * it might be dirty before going heavy-weight.  vm_object's use zalloc
613  * and thus stable-storage, so this is safe.
614  */
615 int
616 vop_stdgetvobject(ap)
617 	struct vop_getvobject_args /* {
618 		struct vnode *vp;
619 		struct vm_object **objpp;
620 	} */ *ap;
621 {
622 	struct vnode *vp = ap->a_vp;
623 	struct vm_object **objpp = ap->a_objpp;
624 
625 	if (objpp)
626 		*objpp = vp->v_object;
627 	return (vp->v_object ? 0 : EINVAL);
628 }
629 
630 int
631 vop_stdbmap(ap)
632 	struct vop_bmap_args /* {
633 		struct vnode *a_vp;
634 		daddr_t  a_bn;
635 		struct vnode **a_vpp;
636 		daddr_t *a_bnp;
637 		int *a_runp;
638 		int *a_runb;
639 	} */ *ap;
640 {
641 
642 	if (ap->a_vpp != NULL)
643 		*ap->a_vpp = ap->a_vp;
644 	if (ap->a_bnp != NULL)
645 		*ap->a_bnp = ap->a_bn * btodb(ap->a_vp->v_mount->mnt_stat.f_iosize);
646 	if (ap->a_runp != NULL)
647 		*ap->a_runp = 0;
648 	if (ap->a_runb != NULL)
649 		*ap->a_runb = 0;
650 	return (0);
651 }
652 
653 int
654 vop_stdgetpages(ap)
655 	struct vop_getpages_args /* {
656 		struct vnode *a_vp;
657 		vm_page_t *a_m;
658 		int a_count;
659 		int a_reqpage;
660 		vm_ooffset_t a_offset;
661 	} */ *ap;
662 {
663 
664 	return vnode_pager_generic_getpages(ap->a_vp, ap->a_m,
665 	    ap->a_count, ap->a_reqpage);
666 }
667 
668 int
669 vop_stdputpages(ap)
670 	struct vop_putpages_args /* {
671 		struct vnode *a_vp;
672 		vm_page_t *a_m;
673 		int a_count;
674 		int a_sync;
675 		int *a_rtvals;
676 		vm_ooffset_t a_offset;
677 	} */ *ap;
678 {
679 
680 	return vnode_pager_generic_putpages(ap->a_vp, ap->a_m, ap->a_count,
681 	     ap->a_sync, ap->a_rtvals);
682 }
683 
684 
685 
686 /*
687  * vfs default ops
688  * used to fill the vfs fucntion table to get reasonable default return values.
689  */
690 int
691 vfs_stdmount (mp, path, data, ndp, td)
692 	struct mount *mp;
693 	char *path;
694 	caddr_t data;
695 	struct nameidata *ndp;
696 	struct thread *td;
697 {
698 	return (0);
699 }
700 
701 int
702 vfs_stdunmount (mp, mntflags, td)
703 	struct mount *mp;
704 	int mntflags;
705 	struct thread *td;
706 {
707 	return (0);
708 }
709 
710 int
711 vfs_stdroot (mp, vpp)
712 	struct mount *mp;
713 	struct vnode **vpp;
714 {
715 	return (EOPNOTSUPP);
716 }
717 
718 int
719 vfs_stdstatfs (mp, sbp, td)
720 	struct mount *mp;
721 	struct statfs *sbp;
722 	struct thread *td;
723 {
724 	return (EOPNOTSUPP);
725 }
726 
727 int
728 vfs_stdvptofh (vp, fhp)
729 	struct vnode *vp;
730 	struct fid *fhp;
731 {
732 	return (EOPNOTSUPP);
733 }
734 
735 int
736 vfs_stdstart (mp, flags, td)
737 	struct mount *mp;
738 	int flags;
739 	struct thread *td;
740 {
741 	return (0);
742 }
743 
744 int
745 vfs_stdquotactl (mp, cmds, uid, arg, td)
746 	struct mount *mp;
747 	int cmds;
748 	uid_t uid;
749 	caddr_t arg;
750 	struct thread *td;
751 {
752 	return (EOPNOTSUPP);
753 }
754 
755 int
756 vfs_stdsync (mp, waitfor, cred, td)
757 	struct mount *mp;
758 	int waitfor;
759 	struct ucred *cred;
760 	struct thread *td;
761 {
762 	return (0);
763 }
764 
765 int
766 vfs_stdvget (mp, ino, vpp)
767 	struct mount *mp;
768 	ino_t ino;
769 	struct vnode **vpp;
770 {
771 	return (EOPNOTSUPP);
772 }
773 
774 int
775 vfs_stdfhtovp (mp, fhp, vpp)
776 	struct mount *mp;
777 	struct fid *fhp;
778 	struct vnode **vpp;
779 {
780 	return (EOPNOTSUPP);
781 }
782 
783 int
784 vfs_stdinit (vfsp)
785 	struct vfsconf *vfsp;
786 {
787 	return (0);
788 }
789 
790 int
791 vfs_stduninit (vfsp)
792 	struct vfsconf *vfsp;
793 {
794 	return(0);
795 }
796 
797 int
798 vfs_stdextattrctl(mp, cmd, filename_vp, attrnamespace, attrname, td)
799 	struct mount *mp;
800 	int cmd;
801 	struct vnode *filename_vp;
802 	int attrnamespace;
803 	const char *attrname;
804 	struct thread *td;
805 {
806 	return(EOPNOTSUPP);
807 }
808 
809 /* end of vfs default ops */
810