vnode_if.src revision 54803
11541Srgrimes#
21541Srgrimes# Copyright (c) 1992, 1993
31541Srgrimes#	The Regents of the University of California.  All rights reserved.
41541Srgrimes#
51541Srgrimes# Redistribution and use in source and binary forms, with or without
61541Srgrimes# modification, are permitted provided that the following conditions
71541Srgrimes# are met:
81541Srgrimes# 1. Redistributions of source code must retain the above copyright
91541Srgrimes#    notice, this list of conditions and the following disclaimer.
101541Srgrimes# 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes#    notice, this list of conditions and the following disclaimer in the
121541Srgrimes#    documentation and/or other materials provided with the distribution.
131541Srgrimes# 3. All advertising materials mentioning features or use of this software
141541Srgrimes#    must display the following acknowledgement:
151541Srgrimes#	This product includes software developed by the University of
161541Srgrimes#	California, Berkeley and its contributors.
171541Srgrimes# 4. Neither the name of the University nor the names of its contributors
181541Srgrimes#    may be used to endorse or promote products derived from this software
191541Srgrimes#    without specific prior written permission.
201541Srgrimes#
211541Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
221541Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
231541Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
241541Srgrimes# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
251541Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
261541Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
271541Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
281541Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
291541Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
301541Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
311541Srgrimes# SUCH DAMAGE.
321541Srgrimes#
3322521Sdyson#	@(#)vnode_if.src	8.12 (Berkeley) 5/14/95
3450477Speter# $FreeBSD: head/sys/kern/vnode_if.src 54803 1999-12-19 06:08:07Z rwatson $
351541Srgrimes#
3622521Sdyson
3722521Sdyson#
3822521Sdyson# Above each of the vop descriptors is a specification of the locking
3922521Sdyson# protocol used by each vop call.  The first column is the name of
4022521Sdyson# the variable, the remaining three columns are in, out and error
4122521Sdyson# respectively.  The "in" column defines the lock state on input,
4222521Sdyson# the "out" column defines the state on succesful return, and the
4322521Sdyson# "error" column defines the locking state on error exit.
4422521Sdyson#
4522521Sdyson# The locking value can take the following values:
4654444Seivind# L: locked; not converted to type of lock.
4754444Seivind# A: any lock type.
4854444Seivind# S: locked with shared lock.
4954444Seivind# E: locked with exclusive lock for this process.
5054444Seivind# O: locked with exclusive lock for other process.
5145058Seivind# U: unlocked.
5222521Sdyson# -: not applicable.  vnode does not yet (or no longer) exists.
5322521Sdyson# =: the same on input and output, may be either L or U.
5422521Sdyson# X: locked if not nil.
5522521Sdyson#
5622521Sdyson
5722521Sdyson#
5851679Seivind#% islocked	vp	= = =
5951679Seivind#
6051679Seivindvop_islocked {
6151679Seivind	IN struct vnode *vp;
6254444Seivind	IN struct proc *p;
6351679Seivind};
6451679Seivind
6551679Seivind#
6622521Sdyson#% lookup	dvp	L ? ?
6722521Sdyson#% lookup	vpp	- L -
6822521Sdyson#
6922521Sdyson# XXX - the lookup locking protocol defies simple description and depends
7022521Sdyson#	on the flags and operation fields in the (cnp) structure.  Note
7122521Sdyson#	especially that *vpp may equal dvp and both may be locked.
7222521Sdyson#
731541Srgrimesvop_lookup {
741541Srgrimes	IN struct vnode *dvp;
751541Srgrimes	INOUT struct vnode **vpp;
761541Srgrimes	IN struct componentname *cnp;
771541Srgrimes};
781541Srgrimes
7922521Sdyson#
8028732Sphk#% cachedlookup	dvp	L ? ?
8128732Sphk#% cachedlookup	vpp	- L -
8228732Sphk#
8328732Sphk# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
8428732Sphk#
8528732Sphkvop_cachedlookup {
8628732Sphk	IN struct vnode *dvp;
8728732Sphk	INOUT struct vnode **vpp;
8828732Sphk	IN struct componentname *cnp;
8928732Sphk};
9028732Sphk
9128732Sphk#
9235823Smsmith#% create	dvp	L L L
9322521Sdyson#% create	vpp	- L -
9422521Sdyson#
951541Srgrimesvop_create {
9635823Smsmith	IN struct vnode *dvp;
971541Srgrimes	OUT struct vnode **vpp;
981541Srgrimes	IN struct componentname *cnp;
991541Srgrimes	IN struct vattr *vap;
1001541Srgrimes};
1011541Srgrimes
10222521Sdyson#
10322521Sdyson#% whiteout	dvp	L L L
10422521Sdyson#
10522521Sdysonvop_whiteout {
10635823Smsmith	IN struct vnode *dvp;
10722521Sdyson	IN struct componentname *cnp;
10822521Sdyson	IN int flags;
10922521Sdyson};
11022521Sdyson
11122521Sdyson#
11235823Smsmith#% mknod	dvp	L L L
11322521Sdyson#% mknod	vpp	- X -
11422521Sdyson#
1151541Srgrimesvop_mknod {
11635823Smsmith	IN struct vnode *dvp;
11753101Seivind	OUT struct vnode **vpp;
1181541Srgrimes	IN struct componentname *cnp;
1191541Srgrimes	IN struct vattr *vap;
1201541Srgrimes};
1211541Srgrimes
12222521Sdyson#
12322521Sdyson#% open		vp	L L L
12422521Sdyson#
1251541Srgrimesvop_open {
1261541Srgrimes	IN struct vnode *vp;
1271541Srgrimes	IN int mode;
1281541Srgrimes	IN struct ucred *cred;
1291541Srgrimes	IN struct proc *p;
1301541Srgrimes};
1311541Srgrimes
13222521Sdyson#
13322521Sdyson#% close	vp	U U U
13422521Sdyson#
1351541Srgrimesvop_close {
1361541Srgrimes	IN struct vnode *vp;
1371541Srgrimes	IN int fflag;
1381541Srgrimes	IN struct ucred *cred;
1391541Srgrimes	IN struct proc *p;
1401541Srgrimes};
1411541Srgrimes
14222521Sdyson#
14322521Sdyson#% access	vp	L L L
14422521Sdyson#
1451541Srgrimesvop_access {
1461541Srgrimes	IN struct vnode *vp;
1471541Srgrimes	IN int mode;
1481541Srgrimes	IN struct ucred *cred;
1491541Srgrimes	IN struct proc *p;
1501541Srgrimes};
1511541Srgrimes
15222521Sdyson#
15322521Sdyson#% getattr	vp	= = =
15422521Sdyson#
1551541Srgrimesvop_getattr {
1561541Srgrimes	IN struct vnode *vp;
15754803Srwatson	OUT struct vattr *vap;
1581541Srgrimes	IN struct ucred *cred;
1591541Srgrimes	IN struct proc *p;
1601541Srgrimes};
1611541Srgrimes
16222521Sdyson#
16322521Sdyson#% setattr	vp	L L L
16422521Sdyson#
1651541Srgrimesvop_setattr {
1661541Srgrimes	IN struct vnode *vp;
1671541Srgrimes	IN struct vattr *vap;
1681541Srgrimes	IN struct ucred *cred;
1691541Srgrimes	IN struct proc *p;
1701541Srgrimes};
1711541Srgrimes
17222521Sdyson#
17322521Sdyson#% read		vp	L L L
17422521Sdyson#
1751541Srgrimesvop_read {
1761541Srgrimes	IN struct vnode *vp;
1771541Srgrimes	INOUT struct uio *uio;
1781541Srgrimes	IN int ioflag;
1791541Srgrimes	IN struct ucred *cred;
1801541Srgrimes};
1811541Srgrimes
18222521Sdyson#
18322521Sdyson#% write	vp	L L L
18422521Sdyson#
1851541Srgrimesvop_write {
1861541Srgrimes	IN struct vnode *vp;
1871541Srgrimes	INOUT struct uio *uio;
1881541Srgrimes	IN int ioflag;
1891541Srgrimes	IN struct ucred *cred;
1901541Srgrimes};
1911541Srgrimes
19222521Sdyson#
19322521Sdyson#% lease	vp	= = =
19422521Sdyson#
19522521Sdysonvop_lease {
19622521Sdyson	IN struct vnode *vp;
19722521Sdyson	IN struct proc *p;
19822521Sdyson	IN struct ucred *cred;
19922521Sdyson	IN int flag;
20022521Sdyson};
20122521Sdyson
20222521Sdyson#
20322521Sdyson#% ioctl	vp	U U U
20422521Sdyson#
2051541Srgrimesvop_ioctl {
2061541Srgrimes	IN struct vnode *vp;
20722521Sdyson	IN u_long command;
2081541Srgrimes	IN caddr_t data;
2091541Srgrimes	IN int fflag;
2101541Srgrimes	IN struct ucred *cred;
2111541Srgrimes	IN struct proc *p;
2121541Srgrimes};
2131541Srgrimes
21422521Sdyson#
21529353Speter#% poll	vp	U U U
21622521Sdyson#
21729353Spetervop_poll {
2181541Srgrimes	IN struct vnode *vp;
21929353Speter	IN int events;
2201541Srgrimes	IN struct ucred *cred;
2211541Srgrimes	IN struct proc *p;
2221541Srgrimes};
2231541Srgrimes
22422521Sdyson#
22522521Sdyson#% revoke	vp	U U U
22622521Sdyson#
22722521Sdysonvop_revoke {
22822521Sdyson	IN struct vnode *vp;
22922521Sdyson	IN int flags;
23022521Sdyson};
23122521Sdyson
23222521Sdyson#
23322521Sdyson# XXX - not used
23422521Sdyson#
2351541Srgrimesvop_mmap {
2361541Srgrimes	IN struct vnode *vp;
2371541Srgrimes	IN int fflags;
2381541Srgrimes	IN struct ucred *cred;
2391541Srgrimes	IN struct proc *p;
2401541Srgrimes};
2411541Srgrimes
24222521Sdyson#
24322521Sdyson#% fsync	vp	L L L
24422521Sdyson#
2451541Srgrimesvop_fsync {
2461541Srgrimes	IN struct vnode *vp;
2471541Srgrimes	IN struct ucred *cred;
2481541Srgrimes	IN int waitfor;
2491541Srgrimes	IN struct proc *p;
2501541Srgrimes};
2511541Srgrimes
25222521Sdyson#
25335823Smsmith#% remove	dvp	L L L
25435823Smsmith#% remove	vp	L L L
25522521Sdyson#
2561541Srgrimesvop_remove {
25735823Smsmith	IN struct vnode *dvp;
25835823Smsmith	IN struct vnode *vp;
2591541Srgrimes	IN struct componentname *cnp;
2601541Srgrimes};
2611541Srgrimes
26222521Sdyson#
26335823Smsmith#% link		tdvp	L L L
26422521Sdyson#% link		vp	U U U
26522521Sdyson#
2669842Sdgvop_link {
26735823Smsmith	IN struct vnode *tdvp;
2689842Sdg	IN struct vnode *vp;
2699842Sdg	IN struct componentname *cnp;
2709842Sdg};
2711541Srgrimes
27222521Sdyson#
27322521Sdyson#% rename	fdvp	U U U
27422521Sdyson#% rename	fvp	U U U
27522521Sdyson#% rename	tdvp	L U U
27622521Sdyson#% rename	tvp	X U U
27722521Sdyson#
2781541Srgrimesvop_rename {
2791541Srgrimes	IN WILLRELE struct vnode *fdvp;
2801541Srgrimes	IN WILLRELE struct vnode *fvp;
2811541Srgrimes	IN struct componentname *fcnp;
2821541Srgrimes	IN WILLRELE struct vnode *tdvp;
2831541Srgrimes	IN WILLRELE struct vnode *tvp;
2841541Srgrimes	IN struct componentname *tcnp;
2851541Srgrimes};
2861541Srgrimes
28722521Sdyson#
28835823Smsmith#% mkdir	dvp	L L L
28922521Sdyson#% mkdir	vpp	- L -
29022521Sdyson#
2911541Srgrimesvop_mkdir {
29235823Smsmith	IN struct vnode *dvp;
2931541Srgrimes	OUT struct vnode **vpp;
2941541Srgrimes	IN struct componentname *cnp;
2951541Srgrimes	IN struct vattr *vap;
2961541Srgrimes};
2971541Srgrimes
29822521Sdyson#
29935823Smsmith#% rmdir	dvp	L L L
30035823Smsmith#% rmdir	vp	L L L
30122521Sdyson#
3021541Srgrimesvop_rmdir {
30335823Smsmith	IN struct vnode *dvp;
30435823Smsmith	IN struct vnode *vp;
3051541Srgrimes	IN struct componentname *cnp;
3061541Srgrimes};
3071541Srgrimes
30822521Sdyson#
30935823Smsmith#% symlink	dvp	L L L
31022521Sdyson#% symlink	vpp	- U -
31122521Sdyson#
3121541Srgrimesvop_symlink {
31335823Smsmith	IN struct vnode *dvp;
31453131Seivind	OUT struct vnode **vpp;
3151541Srgrimes	IN struct componentname *cnp;
3161541Srgrimes	IN struct vattr *vap;
3171541Srgrimes	IN char *target;
3181541Srgrimes};
3191541Srgrimes
32022521Sdyson#
32122521Sdyson#% readdir	vp	L L L
32222521Sdyson#
3231541Srgrimesvop_readdir {
3241541Srgrimes	IN struct vnode *vp;
3251541Srgrimes	INOUT struct uio *uio;
3261541Srgrimes	IN struct ucred *cred;
3273167Sdfr	INOUT int *eofflag;
32822521Sdyson	OUT int *ncookies;
32922521Sdyson	INOUT u_long **cookies;
3301541Srgrimes};
3311541Srgrimes
33222521Sdyson#
33322521Sdyson#% readlink	vp	L L L
33422521Sdyson#
3351541Srgrimesvop_readlink {
3361541Srgrimes	IN struct vnode *vp;
3371541Srgrimes	INOUT struct uio *uio;
3381541Srgrimes	IN struct ucred *cred;
3391541Srgrimes};
3401541Srgrimes
34122521Sdyson#
34222521Sdyson#% inactive	vp	L U U
34322521Sdyson#
3441541Srgrimesvop_inactive {
3451541Srgrimes	IN struct vnode *vp;
34622521Sdyson	IN struct proc *p;
3471541Srgrimes};
3481541Srgrimes
34922521Sdyson#
35022521Sdyson#% reclaim	vp	U U U
35122521Sdyson#
3521541Srgrimesvop_reclaim {
3531541Srgrimes	IN struct vnode *vp;
35422521Sdyson	IN struct proc *p;
3551541Srgrimes};
3561541Srgrimes
35722521Sdyson#
35854795Seivind#% lock		vp	? ? ?
35922521Sdyson#
3601541Srgrimesvop_lock {
3611541Srgrimes	IN struct vnode *vp;
36222521Sdyson	IN int flags;
36322521Sdyson	IN struct proc *p;
3641541Srgrimes};
3651541Srgrimes
36622521Sdyson#
36722521Sdyson#% unlock	vp	L U L
36822521Sdyson#
3691541Srgrimesvop_unlock {
3701541Srgrimes	IN struct vnode *vp;
37122521Sdyson	IN int flags;
37222521Sdyson	IN struct proc *p;
3731541Srgrimes};
3741541Srgrimes
37522521Sdyson#
37622521Sdyson#% bmap		vp	L L L
37722521Sdyson#% bmap		vpp	- U -
37822521Sdyson#
3791541Srgrimesvop_bmap {
3801541Srgrimes	IN struct vnode *vp;
3811541Srgrimes	IN daddr_t bn;
3821541Srgrimes	OUT struct vnode **vpp;
3831541Srgrimes	IN daddr_t *bnp;
3841541Srgrimes	OUT int *runp;
38510551Sdyson	OUT int *runb;
3861541Srgrimes};
3871541Srgrimes
38822521Sdyson#
38945058Seivind#% strategy	vp	L L L
39022521Sdyson#
39137384Sjulianvop_strategy {
39237384Sjulian	IN struct vnode *vp;
39337384Sjulian	IN struct buf *bp;
39437384Sjulian};
3951541Srgrimes
39622521Sdyson#
39722521Sdyson#% print	vp	= = =
39822521Sdyson#
3991541Srgrimesvop_print {
4001541Srgrimes	IN struct vnode *vp;
4011541Srgrimes};
4021541Srgrimes
40322521Sdyson#
40422521Sdyson#% pathconf	vp	L L L
40522521Sdyson#
4061541Srgrimesvop_pathconf {
4071541Srgrimes	IN struct vnode *vp;
4081541Srgrimes	IN int name;
40922521Sdyson	OUT register_t *retval;
4101541Srgrimes};
4111541Srgrimes
41222521Sdyson#
41322521Sdyson#% advlock	vp	U U U
41422521Sdyson#
4151541Srgrimesvop_advlock {
4161541Srgrimes	IN struct vnode *vp;
4171541Srgrimes	IN caddr_t id;
4181541Srgrimes	IN int op;
4191541Srgrimes	IN struct flock *fl;
4201541Srgrimes	IN int flags;
4211541Srgrimes};
4221541Srgrimes
42322521Sdyson#
42434266Sjulian#% balloc	vp	L L L
42534266Sjulian#
42634266Sjulianvop_balloc {
42734266Sjulian	IN struct vnode *vp;
42834266Sjulian	IN off_t startoffset;
42934266Sjulian	IN int size;
43034266Sjulian	IN struct ucred *cred;
43134266Sjulian	IN int flags;
43234266Sjulian	OUT struct buf **bpp;
43334266Sjulian};
43434266Sjulian
43534266Sjulian#
43622521Sdyson#% reallocblks	vp	L L L
43722521Sdyson#
4381541Srgrimesvop_reallocblks {
4391541Srgrimes	IN struct vnode *vp;
4401541Srgrimes	IN struct cluster_save *buflist;
4411541Srgrimes};
4421541Srgrimes
44345058Seivind#
44445058Seivind#% getpages	vp	L L L
44545058Seivind#
44610551Sdysonvop_getpages {
44710551Sdyson	IN struct vnode *vp;
44810551Sdyson	IN vm_page_t *m;
44910551Sdyson	IN int count;
45010551Sdyson	IN int reqpage;
45112767Sdyson	IN vm_ooffset_t offset;
45210551Sdyson};
45310551Sdyson
45445058Seivind#
45545058Seivind#% putpages	vp	L L L
45645058Seivind#
45710551Sdysonvop_putpages {
45810551Sdyson	IN struct vnode *vp;
45910551Sdyson	IN vm_page_t *m;
46010551Sdyson	IN int count;
46110551Sdyson	IN int sync;
46210551Sdyson	IN int *rtvals;
46312767Sdyson	IN vm_ooffset_t offset;
46410551Sdyson};
46511704Sdyson
46622521Sdyson#
46738862Sphk#% freeblks	vp	- - -
46838862Sphk#
46938862Sphk# This call is used by the filesystem to release blocks back to 
47038862Sphk# device-driver.  This is useful if the driver has a lengthy 
47138862Sphk# erase handling or similar.
47238862Sphk#
47338862Sphk
47438862Sphkvop_freeblks {
47538862Sphk	IN struct vnode *vp;
47638862Sphk	IN daddr_t addr;
47738862Sphk	IN daddr_t length;
47838862Sphk};
47938862Sphk
48038862Sphk#
48147964Smckusick#% bwrite	vp	L L L
48222521Sdyson#
48347964Smckusickvop_bwrite {
48447964Smckusick	IN struct vnode *vp;
48547964Smckusick	IN struct buf *bp;
48647964Smckusick};
48754803Srwatson
48854803Srwatson#
48954803Srwatson#% getacl	vp	= = =
49054803Srwatson#
49154803Srwatsonvop_getacl {
49254803Srwatson	IN struct vnode *vp;
49354803Srwatson	IN acl_type_t type;
49454803Srwatson	OUT struct acl *aclp;
49554803Srwatson	IN struct ucred *cred;
49654803Srwatson	IN struct proc *p;
49754803Srwatson};
49854803Srwatson
49954803Srwatson#
50054803Srwatson#% setacl	vp	L L L
50154803Srwatson#
50254803Srwatsonvop_setacl {
50354803Srwatson	IN struct vnode *vp;
50454803Srwatson	IN acl_type_t type;
50554803Srwatson	IN struct acl *aclp;
50654803Srwatson	IN struct ucred *cred;
50754803Srwatson	IN struct proc *p;
50854803Srwatson};
50954803Srwatson
51054803Srwatson#
51154803Srwatson#% aclcheck	vp	= = =
51254803Srwatson#
51354803Srwatsonvop_aclcheck {
51454803Srwatson	IN struct vnode *vp;
51554803Srwatson	IN acl_type_t type;
51654803Srwatson	IN struct acl *aclp;
51754803Srwatson	IN struct ucred *cred;
51854803Srwatson	IN struct proc *p;
51954803Srwatson};
52054803Srwatson
52154803Srwatson#
52254803Srwatson#% getextattr	vp	= = =
52354803Srwatson#
52454803Srwatsonvop_getextattr {
52554803Srwatson	IN struct vnode *vp;
52654803Srwatson	IN char *name;
52754803Srwatson	INOUT struct uio *uio;
52854803Srwatson	IN struct ucred *cred;
52954803Srwatson	IN struct proc *p;
53054803Srwatson};
53154803Srwatson
53254803Srwatson#
53354803Srwatson#% setextattr	vp	L L L
53454803Srwatson#
53554803Srwatsonvop_setextattr {
53654803Srwatson	IN struct vnode *vp;
53754803Srwatson	IN char *name;
53854803Srwatson	INOUT struct uio *uio;
53954803Srwatson	IN struct ucred *cred;
54054803Srwatson	IN struct proc *p;
54154803Srwatson};
542