vfs_default.c revision 56272
130489Sphk/*
230489Sphk * Copyright (c) 1989, 1993
330489Sphk *	The Regents of the University of California.  All rights reserved.
430489Sphk *
530489Sphk * This code is derived from software contributed
630489Sphk * to Berkeley by John Heidemann of the UCLA Ficus project.
730489Sphk *
830489Sphk * Source: * @(#)i405_init.c 2.10 92/04/27 UCLA Ficus project
930489Sphk *
1030489Sphk * Redistribution and use in source and binary forms, with or without
1130489Sphk * modification, are permitted provided that the following conditions
1230489Sphk * are met:
1330489Sphk * 1. Redistributions of source code must retain the above copyright
1430489Sphk *    notice, this list of conditions and the following disclaimer.
1530489Sphk * 2. Redistributions in binary form must reproduce the above copyright
1630489Sphk *    notice, this list of conditions and the following disclaimer in the
1730489Sphk *    documentation and/or other materials provided with the distribution.
1830489Sphk * 3. All advertising materials mentioning features or use of this software
1930489Sphk *    must display the following acknowledgement:
2030489Sphk *	This product includes software developed by the University of
2130489Sphk *	California, Berkeley and its contributors.
2230489Sphk * 4. Neither the name of the University nor the names of its contributors
2330489Sphk *    may be used to endorse or promote products derived from this software
2430489Sphk *    without specific prior written permission.
2530489Sphk *
2630489Sphk * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2730489Sphk * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2830489Sphk * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2930489Sphk * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
3030489Sphk * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
3130489Sphk * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
3230489Sphk * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
3330489Sphk * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
3430489Sphk * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
3530489Sphk * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
3630489Sphk * SUCH DAMAGE.
3730489Sphk *
3847989Sgpalmer *
3950477Speter * $FreeBSD: head/sys/kern/vfs_default.c 56272 2000-01-19 06:07:34Z rwatson $
4030489Sphk */
4130489Sphk
4230489Sphk#include <sys/param.h>
4330489Sphk#include <sys/systm.h>
4444272Sbde#include <sys/buf.h>
4530489Sphk#include <sys/kernel.h>
4631561Sbde#include <sys/lock.h>
4730743Sphk#include <sys/malloc.h>
4851068Salfred#include <sys/mount.h>
4930492Sphk#include <sys/unistd.h>
5030489Sphk#include <sys/vnode.h>
5130743Sphk#include <sys/poll.h>
5230489Sphk
5330489Sphkstatic int vop_nostrategy __P((struct vop_strategy_args *));
5430489Sphk
5530489Sphk/*
5630489Sphk * This vnode table stores what we want to do if the filesystem doesn't
5730489Sphk * implement a particular VOP.
5830489Sphk *
5930489Sphk * If there is no specific entry here, we will return EOPNOTSUPP.
6030489Sphk *
6130489Sphk */
6230489Sphk
6330489Sphkvop_t **default_vnodeop_p;
6430489Sphkstatic struct vnodeopv_entry_desc default_vnodeop_entries[] = {
6530492Sphk	{ &vop_default_desc,		(vop_t *) vop_eopnotsupp },
6630492Sphk	{ &vop_advlock_desc,		(vop_t *) vop_einval },
6730743Sphk	{ &vop_bwrite_desc,		(vop_t *) vop_stdbwrite },
6830492Sphk	{ &vop_close_desc,		(vop_t *) vop_null },
6930492Sphk	{ &vop_fsync_desc,		(vop_t *) vop_null },
7030492Sphk	{ &vop_ioctl_desc,		(vop_t *) vop_enotty },
7130496Sphk	{ &vop_islocked_desc,		(vop_t *) vop_noislocked },
7230739Sphk	{ &vop_lease_desc,		(vop_t *) vop_null },
7330496Sphk	{ &vop_lock_desc,		(vop_t *) vop_nolock },
7430492Sphk	{ &vop_mmap_desc,		(vop_t *) vop_einval },
7530492Sphk	{ &vop_open_desc,		(vop_t *) vop_null },
7630492Sphk	{ &vop_pathconf_desc,		(vop_t *) vop_einval },
7730489Sphk	{ &vop_poll_desc,		(vop_t *) vop_nopoll },
7830492Sphk	{ &vop_readlink_desc,		(vop_t *) vop_einval },
7930492Sphk	{ &vop_reallocblks_desc,	(vop_t *) vop_eopnotsupp },
8030489Sphk	{ &vop_revoke_desc,		(vop_t *) vop_revoke },
8130489Sphk	{ &vop_strategy_desc,		(vop_t *) vop_nostrategy },
8230496Sphk	{ &vop_unlock_desc,		(vop_t *) vop_nounlock },
8354803Srwatson	{ &vop_getacl_desc,		(vop_t *) vop_eopnotsupp },
8454803Srwatson	{ &vop_setacl_desc,		(vop_t *) vop_eopnotsupp },
8554803Srwatson	{ &vop_aclcheck_desc,		(vop_t *) vop_eopnotsupp },
8654803Srwatson	{ &vop_getextattr_desc,		(vop_t *) vop_eopnotsupp },
8754803Srwatson	{ &vop_setextattr_desc,		(vop_t *) vop_eopnotsupp },
8830489Sphk	{ NULL, NULL }
8930489Sphk};
9030489Sphk
9130489Sphkstatic struct vnodeopv_desc default_vnodeop_opv_desc =
9230489Sphk        { &default_vnodeop_p, default_vnodeop_entries };
9330489Sphk
9430489SphkVNODEOP_SET(default_vnodeop_opv_desc);
9530489Sphk
9630489Sphkint
9730492Sphkvop_eopnotsupp(struct vop_generic_args *ap)
9830489Sphk{
9930489Sphk	/*
10030492Sphk	printf("vop_notsupp[%s]\n", ap->a_desc->vdesc_name);
10130489Sphk	*/
10230489Sphk
10330489Sphk	return (EOPNOTSUPP);
10430489Sphk}
10530489Sphk
10630489Sphkint
10730492Sphkvop_ebadf(struct vop_generic_args *ap)
10830489Sphk{
10930489Sphk
11030492Sphk	return (EBADF);
11130492Sphk}
11230492Sphk
11330492Sphkint
11430492Sphkvop_enotty(struct vop_generic_args *ap)
11530492Sphk{
11630492Sphk
11730492Sphk	return (ENOTTY);
11830492Sphk}
11930492Sphk
12030492Sphkint
12130492Sphkvop_einval(struct vop_generic_args *ap)
12230492Sphk{
12330492Sphk
12430492Sphk	return (EINVAL);
12530492Sphk}
12630492Sphk
12730492Sphkint
12830492Sphkvop_null(struct vop_generic_args *ap)
12930492Sphk{
13030492Sphk
13130492Sphk	return (0);
13230492Sphk}
13330492Sphk
13430492Sphkint
13530492Sphkvop_defaultop(struct vop_generic_args *ap)
13630492Sphk{
13730492Sphk
13830489Sphk	return (VOCALL(default_vnodeop_p, ap->a_desc->vdesc_offset, ap));
13930489Sphk}
14030489Sphk
14141056Speterint
14241056Spetervop_panic(struct vop_generic_args *ap)
14341056Speter{
14441056Speter
14552970Sphk	printf("vop_panic[%s]\n", ap->a_desc->vdesc_name);
14652970Sphk	panic("Filesystem goof");
14752970Sphk	return (0);
14841056Speter}
14941056Speter
15046349Salc/*
15146349Salc *	vop_nostrategy:
15246349Salc *
15346349Salc *	Strategy routine for VFS devices that have none.
15446349Salc *
15546349Salc *	B_ERROR and B_INVAL must be cleared prior to calling any strategy
15646349Salc *	routine.  Typically this is done for a B_READ strategy call.  Typically
15746349Salc *	B_INVAL is assumed to already be clear prior to a write and should not
15846349Salc *	be cleared manually unless you just made the buffer invalid.  B_ERROR
15946349Salc *	should be cleared either way.
16046349Salc */
16146349Salc
16230489Sphkstatic int
16330489Sphkvop_nostrategy (struct vop_strategy_args *ap)
16430489Sphk{
16530489Sphk	printf("No strategy for buffer at %p\n", ap->a_bp);
16637384Sjulian	vprint("", ap->a_vp);
16730489Sphk	vprint("", ap->a_bp->b_vp);
16830489Sphk	ap->a_bp->b_flags |= B_ERROR;
16930489Sphk	ap->a_bp->b_error = EOPNOTSUPP;
17030489Sphk	biodone(ap->a_bp);
17130489Sphk	return (EOPNOTSUPP);
17230489Sphk}
17330492Sphk
17430492Sphkint
17530492Sphkvop_stdpathconf(ap)
17630492Sphk	struct vop_pathconf_args /* {
17730492Sphk	struct vnode *a_vp;
17830492Sphk	int a_name;
17930492Sphk	int *a_retval;
18030492Sphk	} */ *ap;
18130492Sphk{
18230492Sphk
18330492Sphk	switch (ap->a_name) {
18430492Sphk		case _PC_LINK_MAX:
18530492Sphk			*ap->a_retval = LINK_MAX;
18630492Sphk			return (0);
18730492Sphk		case _PC_MAX_CANON:
18830492Sphk			*ap->a_retval = MAX_CANON;
18930492Sphk			return (0);
19030492Sphk		case _PC_MAX_INPUT:
19130492Sphk			*ap->a_retval = MAX_INPUT;
19230492Sphk			return (0);
19330492Sphk		case _PC_PIPE_BUF:
19430492Sphk			*ap->a_retval = PIPE_BUF;
19530492Sphk			return (0);
19630492Sphk		case _PC_CHOWN_RESTRICTED:
19730492Sphk			*ap->a_retval = 1;
19830492Sphk			return (0);
19930492Sphk		case _PC_VDISABLE:
20030492Sphk			*ap->a_retval = _POSIX_VDISABLE;
20130492Sphk			return (0);
20230492Sphk		default:
20330492Sphk			return (EINVAL);
20430492Sphk	}
20530492Sphk	/* NOTREACHED */
20630492Sphk}
20730513Sphk
20830513Sphk/*
20930513Sphk * Standard lock, unlock and islocked functions.
21030513Sphk *
21130513Sphk * These depend on the lock structure being the first element in the
21230513Sphk * inode, ie: vp->v_data points to the the lock!
21330513Sphk */
21430513Sphkint
21530513Sphkvop_stdlock(ap)
21630513Sphk	struct vop_lock_args /* {
21730513Sphk		struct vnode *a_vp;
21830513Sphk		int a_flags;
21930513Sphk		struct proc *a_p;
22030513Sphk	} */ *ap;
22130513Sphk{
22232286Sdyson	struct lock *l;
22330513Sphk
22432286Sdyson	if ((l = (struct lock *)ap->a_vp->v_data) == NULL) {
22532286Sdyson		if (ap->a_flags & LK_INTERLOCK)
22632286Sdyson			simple_unlock(&ap->a_vp->v_interlock);
22732286Sdyson		return 0;
22832286Sdyson	}
22932286Sdyson
23042900Seivind#ifndef	DEBUG_LOCKS
23130513Sphk	return (lockmgr(l, ap->a_flags, &ap->a_vp->v_interlock, ap->a_p));
23242900Seivind#else
23342900Seivind	return (debuglockmgr(l, ap->a_flags, &ap->a_vp->v_interlock, ap->a_p,
23442900Seivind	    "vop_stdlock", ap->a_vp->filename, ap->a_vp->line));
23542900Seivind#endif
23630513Sphk}
23730513Sphk
23830513Sphkint
23930513Sphkvop_stdunlock(ap)
24030513Sphk	struct vop_unlock_args /* {
24130513Sphk		struct vnode *a_vp;
24230513Sphk		int a_flags;
24330513Sphk		struct proc *a_p;
24430513Sphk	} */ *ap;
24530513Sphk{
24632286Sdyson	struct lock *l;
24730513Sphk
24832286Sdyson	if ((l = (struct lock *)ap->a_vp->v_data) == NULL) {
24932286Sdyson		if (ap->a_flags & LK_INTERLOCK)
25032286Sdyson			simple_unlock(&ap->a_vp->v_interlock);
25132286Sdyson		return 0;
25232286Sdyson	}
25332286Sdyson
25430513Sphk	return (lockmgr(l, ap->a_flags | LK_RELEASE, &ap->a_vp->v_interlock,
25530513Sphk	    ap->a_p));
25630513Sphk}
25730513Sphk
25830513Sphkint
25930513Sphkvop_stdislocked(ap)
26030513Sphk	struct vop_islocked_args /* {
26130513Sphk		struct vnode *a_vp;
26254444Seivind		struct proc *a_p;
26330513Sphk	} */ *ap;
26430513Sphk{
26532286Sdyson	struct lock *l;
26630513Sphk
26732286Sdyson	if ((l = (struct lock *)ap->a_vp->v_data) == NULL)
26832286Sdyson		return 0;
26932286Sdyson
27054444Seivind	return (lockstatus(l, ap->a_p));
27130513Sphk}
27230513Sphk
27330743Sphk/*
27430743Sphk * Return true for select/poll.
27530743Sphk */
27630743Sphkint
27730743Sphkvop_nopoll(ap)
27830743Sphk	struct vop_poll_args /* {
27930743Sphk		struct vnode *a_vp;
28030743Sphk		int  a_events;
28130743Sphk		struct ucred *a_cred;
28230743Sphk		struct proc *a_p;
28330743Sphk	} */ *ap;
28430743Sphk{
28530743Sphk	/*
28631727Swollman	 * Return true for read/write.  If the user asked for something
28731727Swollman	 * special, return POLLNVAL, so that clients have a way of
28831727Swollman	 * determining reliably whether or not the extended
28931727Swollman	 * functionality is present without hard-coding knowledge
29031727Swollman	 * of specific filesystem implementations.
29130743Sphk	 */
29231727Swollman	if (ap->a_events & ~POLLSTANDARD)
29331727Swollman		return (POLLNVAL);
29431727Swollman
29530743Sphk	return (ap->a_events & (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM));
29630743Sphk}
29730743Sphk
29831727Swollman/*
29931727Swollman * Implement poll for local filesystems that support it.
30031727Swollman */
30130743Sphkint
30231727Swollmanvop_stdpoll(ap)
30331727Swollman	struct vop_poll_args /* {
30431727Swollman		struct vnode *a_vp;
30531727Swollman		int  a_events;
30631727Swollman		struct ucred *a_cred;
30731727Swollman		struct proc *a_p;
30831727Swollman	} */ *ap;
30931727Swollman{
31031811Swollman	if ((ap->a_events & ~POLLSTANDARD) == 0)
31131811Swollman		return (ap->a_events & (POLLRDNORM|POLLWRNORM));
31231727Swollman	return (vn_pollrecord(ap->a_vp, ap->a_p, ap->a_events));
31331727Swollman}
31431727Swollman
31531727Swollmanint
31630743Sphkvop_stdbwrite(ap)
31730743Sphk	struct vop_bwrite_args *ap;
31830743Sphk{
31930743Sphk	return (bwrite(ap->a_bp));
32030743Sphk}
32130743Sphk
32230743Sphk/*
32330743Sphk * Stubs to use when there is no locking to be done on the underlying object.
32430743Sphk * A minimal shared lock is necessary to ensure that the underlying object
32530743Sphk * is not revoked while an operation is in progress. So, an active shared
32630743Sphk * count is maintained in an auxillary vnode lock structure.
32730743Sphk */
32830743Sphkint
32930743Sphkvop_sharedlock(ap)
33030743Sphk	struct vop_lock_args /* {
33130743Sphk		struct vnode *a_vp;
33230743Sphk		int a_flags;
33330743Sphk		struct proc *a_p;
33430743Sphk	} */ *ap;
33530743Sphk{
33630743Sphk	/*
33730743Sphk	 * This code cannot be used until all the non-locking filesystems
33830743Sphk	 * (notably NFS) are converted to properly lock and release nodes.
33930743Sphk	 * Also, certain vnode operations change the locking state within
34030743Sphk	 * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
34130743Sphk	 * and symlink). Ideally these operations should not change the
34230743Sphk	 * lock state, but should be changed to let the caller of the
34330743Sphk	 * function unlock them. Otherwise all intermediate vnode layers
34430743Sphk	 * (such as union, umapfs, etc) must catch these functions to do
34530743Sphk	 * the necessary locking at their layer. Note that the inactive
34630743Sphk	 * and lookup operations also change their lock state, but this
34730743Sphk	 * cannot be avoided, so these two operations will always need
34830743Sphk	 * to be handled in intermediate layers.
34930743Sphk	 */
35030743Sphk	struct vnode *vp = ap->a_vp;
35130743Sphk	int vnflags, flags = ap->a_flags;
35230743Sphk
35330743Sphk	if (vp->v_vnlock == NULL) {
35430743Sphk		if ((flags & LK_TYPE_MASK) == LK_DRAIN)
35530743Sphk			return (0);
35630743Sphk		MALLOC(vp->v_vnlock, struct lock *, sizeof(struct lock),
35730743Sphk		    M_VNODE, M_WAITOK);
35834206Sdyson		lockinit(vp->v_vnlock, PVFS, "vnlock", 0, LK_NOPAUSE);
35930743Sphk	}
36030743Sphk	switch (flags & LK_TYPE_MASK) {
36130743Sphk	case LK_DRAIN:
36230743Sphk		vnflags = LK_DRAIN;
36330743Sphk		break;
36430743Sphk	case LK_EXCLUSIVE:
36530743Sphk#ifdef DEBUG_VFS_LOCKS
36630743Sphk		/*
36730743Sphk		 * Normally, we use shared locks here, but that confuses
36830743Sphk		 * the locking assertions.
36930743Sphk		 */
37030743Sphk		vnflags = LK_EXCLUSIVE;
37130743Sphk		break;
37230743Sphk#endif
37330743Sphk	case LK_SHARED:
37430743Sphk		vnflags = LK_SHARED;
37530743Sphk		break;
37630743Sphk	case LK_UPGRADE:
37730743Sphk	case LK_EXCLUPGRADE:
37830743Sphk	case LK_DOWNGRADE:
37930743Sphk		return (0);
38030743Sphk	case LK_RELEASE:
38130743Sphk	default:
38230743Sphk		panic("vop_sharedlock: bad operation %d", flags & LK_TYPE_MASK);
38330743Sphk	}
38430743Sphk	if (flags & LK_INTERLOCK)
38530743Sphk		vnflags |= LK_INTERLOCK;
38642900Seivind#ifndef	DEBUG_LOCKS
38742900Seivind	return (lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p));
38842900Seivind#else
38942900Seivind	return (debuglockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p,
39042900Seivind	    "vop_sharedlock", vp->filename, vp->line));
39142900Seivind#endif
39230743Sphk}
39330743Sphk
39430743Sphk/*
39530743Sphk * Stubs to use when there is no locking to be done on the underlying object.
39630743Sphk * A minimal shared lock is necessary to ensure that the underlying object
39730743Sphk * is not revoked while an operation is in progress. So, an active shared
39830743Sphk * count is maintained in an auxillary vnode lock structure.
39930743Sphk */
40030743Sphkint
40130743Sphkvop_nolock(ap)
40230743Sphk	struct vop_lock_args /* {
40330743Sphk		struct vnode *a_vp;
40430743Sphk		int a_flags;
40530743Sphk		struct proc *a_p;
40630743Sphk	} */ *ap;
40730743Sphk{
40830743Sphk#ifdef notyet
40930743Sphk	/*
41030743Sphk	 * This code cannot be used until all the non-locking filesystems
41130743Sphk	 * (notably NFS) are converted to properly lock and release nodes.
41230743Sphk	 * Also, certain vnode operations change the locking state within
41330743Sphk	 * the operation (create, mknod, remove, link, rename, mkdir, rmdir,
41430743Sphk	 * and symlink). Ideally these operations should not change the
41530743Sphk	 * lock state, but should be changed to let the caller of the
41630743Sphk	 * function unlock them. Otherwise all intermediate vnode layers
41730743Sphk	 * (such as union, umapfs, etc) must catch these functions to do
41830743Sphk	 * the necessary locking at their layer. Note that the inactive
41930743Sphk	 * and lookup operations also change their lock state, but this
42030743Sphk	 * cannot be avoided, so these two operations will always need
42130743Sphk	 * to be handled in intermediate layers.
42230743Sphk	 */
42330743Sphk	struct vnode *vp = ap->a_vp;
42430743Sphk	int vnflags, flags = ap->a_flags;
42530743Sphk
42630743Sphk	if (vp->v_vnlock == NULL) {
42730743Sphk		if ((flags & LK_TYPE_MASK) == LK_DRAIN)
42830743Sphk			return (0);
42930743Sphk		MALLOC(vp->v_vnlock, struct lock *, sizeof(struct lock),
43030743Sphk		    M_VNODE, M_WAITOK);
43134206Sdyson		lockinit(vp->v_vnlock, PVFS, "vnlock", 0, LK_NOPAUSE);
43230743Sphk	}
43330743Sphk	switch (flags & LK_TYPE_MASK) {
43430743Sphk	case LK_DRAIN:
43530743Sphk		vnflags = LK_DRAIN;
43630743Sphk		break;
43730743Sphk	case LK_EXCLUSIVE:
43830743Sphk	case LK_SHARED:
43930743Sphk		vnflags = LK_SHARED;
44030743Sphk		break;
44130743Sphk	case LK_UPGRADE:
44230743Sphk	case LK_EXCLUPGRADE:
44330743Sphk	case LK_DOWNGRADE:
44430743Sphk		return (0);
44530743Sphk	case LK_RELEASE:
44630743Sphk	default:
44730743Sphk		panic("vop_nolock: bad operation %d", flags & LK_TYPE_MASK);
44830743Sphk	}
44930743Sphk	if (flags & LK_INTERLOCK)
45030743Sphk		vnflags |= LK_INTERLOCK;
45130743Sphk	return(lockmgr(vp->v_vnlock, vnflags, &vp->v_interlock, ap->a_p));
45230743Sphk#else /* for now */
45330743Sphk	/*
45430743Sphk	 * Since we are not using the lock manager, we must clear
45530743Sphk	 * the interlock here.
45630743Sphk	 */
45731263Sbde	if (ap->a_flags & LK_INTERLOCK)
45830743Sphk		simple_unlock(&ap->a_vp->v_interlock);
45930743Sphk	return (0);
46030743Sphk#endif
46130743Sphk}
46230743Sphk
46330743Sphk/*
46430743Sphk * Do the inverse of vop_nolock, handling the interlock in a compatible way.
46530743Sphk */
46630743Sphkint
46730743Sphkvop_nounlock(ap)
46830743Sphk	struct vop_unlock_args /* {
46930743Sphk		struct vnode *a_vp;
47030743Sphk		int a_flags;
47130743Sphk		struct proc *a_p;
47230743Sphk	} */ *ap;
47330743Sphk{
47430743Sphk	struct vnode *vp = ap->a_vp;
47530743Sphk
47630743Sphk	if (vp->v_vnlock == NULL) {
47730743Sphk		if (ap->a_flags & LK_INTERLOCK)
47830743Sphk			simple_unlock(&ap->a_vp->v_interlock);
47930743Sphk		return (0);
48030743Sphk	}
48130743Sphk	return (lockmgr(vp->v_vnlock, LK_RELEASE | ap->a_flags,
48230743Sphk		&ap->a_vp->v_interlock, ap->a_p));
48330743Sphk}
48430743Sphk
48530743Sphk/*
48630743Sphk * Return whether or not the node is in use.
48730743Sphk */
48830743Sphkint
48930743Sphkvop_noislocked(ap)
49030743Sphk	struct vop_islocked_args /* {
49130743Sphk		struct vnode *a_vp;
49254444Seivind		struct proc *a_p;
49330743Sphk	} */ *ap;
49430743Sphk{
49530743Sphk	struct vnode *vp = ap->a_vp;
49630743Sphk
49730743Sphk	if (vp->v_vnlock == NULL)
49830743Sphk		return (0);
49954444Seivind	return (lockstatus(vp->v_vnlock, ap->a_p));
50030743Sphk}
50130743Sphk
50251068Salfred/*
50351068Salfred * vfs default ops
50451068Salfred * used to fill the vfs fucntion table to get reasonable default return values.
50551068Salfred */
50651068Salfredint
50751068Salfredvfs_stdmount (mp, path, data, ndp, p)
50851068Salfred	struct mount *mp;
50951068Salfred	char *path;
51051068Salfred	caddr_t data;
51151068Salfred	struct nameidata *ndp;
51251068Salfred	struct proc *p;
51351068Salfred{
51451068Salfred	return (0);
51551068Salfred}
51651068Salfred
51751068Salfredint
51851068Salfredvfs_stdunmount (mp, mntflags, p)
51951068Salfred	struct mount *mp;
52051068Salfred	int mntflags;
52151068Salfred	struct proc *p;
52251068Salfred{
52351068Salfred	return (0);
52451068Salfred}
52551068Salfred
52651068Salfredint
52751068Salfredvfs_stdroot (mp, vpp)
52851068Salfred	struct mount *mp;
52951068Salfred	struct vnode **vpp;
53051068Salfred{
53151068Salfred	return (EOPNOTSUPP);
53251068Salfred}
53351068Salfred
53451068Salfredint
53551068Salfredvfs_stdstatfs (mp, sbp, p)
53651068Salfred	struct mount *mp;
53751068Salfred	struct statfs *sbp;
53851068Salfred	struct proc *p;
53951068Salfred{
54051068Salfred	return (EOPNOTSUPP);
54151068Salfred}
54251068Salfred
54351068Salfredint
54451068Salfredvfs_stdvptofh (vp, fhp)
54551068Salfred	struct vnode *vp;
54651068Salfred	struct fid *fhp;
54751068Salfred{
54851068Salfred	return (EOPNOTSUPP);
54951068Salfred}
55051068Salfred
55151068Salfredint
55251068Salfredvfs_stdstart (mp, flags, p)
55351068Salfred	struct mount *mp;
55451068Salfred	int flags;
55551068Salfred	struct proc *p;
55651068Salfred{
55751068Salfred	return (0);
55851068Salfred}
55951068Salfred
56051068Salfredint
56151068Salfredvfs_stdquotactl (mp, cmds, uid, arg, p)
56251068Salfred	struct mount *mp;
56351068Salfred	int cmds;
56451068Salfred	uid_t uid;
56551068Salfred	caddr_t arg;
56651068Salfred	struct proc *p;
56751068Salfred{
56851068Salfred	return (EOPNOTSUPP);
56951068Salfred}
57051068Salfred
57151068Salfredint
57251068Salfredvfs_stdsync (mp, waitfor, cred, p)
57351068Salfred	struct mount *mp;
57451068Salfred	int waitfor;
57551068Salfred	struct ucred *cred;
57651068Salfred	struct proc *p;
57751068Salfred{
57851068Salfred	return (0);
57951068Salfred}
58051068Salfred
58151068Salfredint
58251068Salfredvfs_stdvget (mp, ino, vpp)
58351068Salfred	struct mount *mp;
58451068Salfred	ino_t ino;
58551068Salfred	struct vnode **vpp;
58651068Salfred{
58751068Salfred	return (EOPNOTSUPP);
58851068Salfred}
58951068Salfred
59051068Salfredint
59151138Salfredvfs_stdfhtovp (mp, fhp, vpp)
59251068Salfred	struct mount *mp;
59351068Salfred	struct fid *fhp;
59451138Salfred	struct vnode **vpp;
59551138Salfred{
59651138Salfred	return (EOPNOTSUPP);
59751138Salfred}
59851138Salfred
59951138Salfredint
60051138Salfredvfs_stdcheckexp (mp, nam, extflagsp, credanonp)
60151138Salfred	struct mount *mp;
60251068Salfred	struct sockaddr *nam;
60351138Salfred	int *extflagsp;
60451068Salfred	struct ucred **credanonp;
60551068Salfred{
60651068Salfred	return (EOPNOTSUPP);
60751068Salfred}
60851068Salfred
60951068Salfredint
61051068Salfredvfs_stdinit (vfsp)
61151068Salfred	struct vfsconf *vfsp;
61251068Salfred{
61351068Salfred	return (0);
61451068Salfred}
61551068Salfred
61651068Salfredint
61751068Salfredvfs_stduninit (vfsp)
61851068Salfred	struct vfsconf *vfsp;
61951068Salfred{
62051068Salfred	return(0);
62151068Salfred}
62251068Salfred
62354803Srwatsonint
62454803Srwatsonvfs_stdextattrctl(mp, cmd, attrname, arg, p)
62554803Srwatson	struct mount *mp;
62654803Srwatson	int cmd;
62756272Srwatson	const char *attrname;
62854803Srwatson	caddr_t arg;
62954803Srwatson	struct proc *p;
63054803Srwatson{
63154803Srwatson	return(EOPNOTSUPP);
63254803Srwatson}
63354803Srwatson
63451068Salfred/* end of vfs default ops */
635