vnode_if.src revision 74437
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 74437 2001-03-19 05:44:15Z 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#
22572521Sjlemon#% kqfilter	vp	U U U
22672521Sjlemon#
22772521Sjlemonvop_kqfilter {
22872521Sjlemon	IN struct vnode *vp;
22972521Sjlemon	IN struct knote *kn;
23072521Sjlemon};
23172521Sjlemon
23272521Sjlemon#
23322521Sdyson#% revoke	vp	U U U
23422521Sdyson#
23522521Sdysonvop_revoke {
23622521Sdyson	IN struct vnode *vp;
23722521Sdyson	IN int flags;
23822521Sdyson};
23922521Sdyson
24022521Sdyson#
24122521Sdyson#% fsync	vp	L L L
24222521Sdyson#
2431541Srgrimesvop_fsync {
2441541Srgrimes	IN struct vnode *vp;
2451541Srgrimes	IN struct ucred *cred;
2461541Srgrimes	IN int waitfor;
2471541Srgrimes	IN struct proc *p;
2481541Srgrimes};
2491541Srgrimes
25022521Sdyson#
25135823Smsmith#% remove	dvp	L L L
25235823Smsmith#% remove	vp	L L L
25322521Sdyson#
2541541Srgrimesvop_remove {
25535823Smsmith	IN struct vnode *dvp;
25635823Smsmith	IN struct vnode *vp;
2571541Srgrimes	IN struct componentname *cnp;
2581541Srgrimes};
2591541Srgrimes
26022521Sdyson#
26135823Smsmith#% link		tdvp	L L L
26222521Sdyson#% link		vp	U U U
26322521Sdyson#
2649842Sdgvop_link {
26535823Smsmith	IN struct vnode *tdvp;
2669842Sdg	IN struct vnode *vp;
2679842Sdg	IN struct componentname *cnp;
2689842Sdg};
2691541Srgrimes
27022521Sdyson#
27122521Sdyson#% rename	fdvp	U U U
27222521Sdyson#% rename	fvp	U U U
27322521Sdyson#% rename	tdvp	L U U
27422521Sdyson#% rename	tvp	X U U
27522521Sdyson#
2761541Srgrimesvop_rename {
2771541Srgrimes	IN WILLRELE struct vnode *fdvp;
2781541Srgrimes	IN WILLRELE struct vnode *fvp;
2791541Srgrimes	IN struct componentname *fcnp;
2801541Srgrimes	IN WILLRELE struct vnode *tdvp;
2811541Srgrimes	IN WILLRELE struct vnode *tvp;
2821541Srgrimes	IN struct componentname *tcnp;
2831541Srgrimes};
2841541Srgrimes
28522521Sdyson#
28635823Smsmith#% mkdir	dvp	L L L
28722521Sdyson#% mkdir	vpp	- L -
28822521Sdyson#
2891541Srgrimesvop_mkdir {
29035823Smsmith	IN struct vnode *dvp;
2911541Srgrimes	OUT struct vnode **vpp;
2921541Srgrimes	IN struct componentname *cnp;
2931541Srgrimes	IN struct vattr *vap;
2941541Srgrimes};
2951541Srgrimes
29622521Sdyson#
29735823Smsmith#% rmdir	dvp	L L L
29835823Smsmith#% rmdir	vp	L L L
29922521Sdyson#
3001541Srgrimesvop_rmdir {
30135823Smsmith	IN struct vnode *dvp;
30235823Smsmith	IN struct vnode *vp;
3031541Srgrimes	IN struct componentname *cnp;
3041541Srgrimes};
3051541Srgrimes
30622521Sdyson#
30735823Smsmith#% symlink	dvp	L L L
30822521Sdyson#% symlink	vpp	- U -
30922521Sdyson#
3101541Srgrimesvop_symlink {
31135823Smsmith	IN struct vnode *dvp;
31253131Seivind	OUT struct vnode **vpp;
3131541Srgrimes	IN struct componentname *cnp;
3141541Srgrimes	IN struct vattr *vap;
3151541Srgrimes	IN char *target;
3161541Srgrimes};
3171541Srgrimes
31822521Sdyson#
31922521Sdyson#% readdir	vp	L L L
32022521Sdyson#
3211541Srgrimesvop_readdir {
3221541Srgrimes	IN struct vnode *vp;
3231541Srgrimes	INOUT struct uio *uio;
3241541Srgrimes	IN struct ucred *cred;
3253167Sdfr	INOUT int *eofflag;
32622521Sdyson	OUT int *ncookies;
32722521Sdyson	INOUT u_long **cookies;
3281541Srgrimes};
3291541Srgrimes
33022521Sdyson#
33122521Sdyson#% readlink	vp	L L L
33222521Sdyson#
3331541Srgrimesvop_readlink {
3341541Srgrimes	IN struct vnode *vp;
3351541Srgrimes	INOUT struct uio *uio;
3361541Srgrimes	IN struct ucred *cred;
3371541Srgrimes};
3381541Srgrimes
33922521Sdyson#
34022521Sdyson#% inactive	vp	L U U
34122521Sdyson#
3421541Srgrimesvop_inactive {
3431541Srgrimes	IN struct vnode *vp;
34422521Sdyson	IN struct proc *p;
3451541Srgrimes};
3461541Srgrimes
34722521Sdyson#
34822521Sdyson#% reclaim	vp	U U U
34922521Sdyson#
3501541Srgrimesvop_reclaim {
3511541Srgrimes	IN struct vnode *vp;
35222521Sdyson	IN struct proc *p;
3531541Srgrimes};
3541541Srgrimes
35522521Sdyson#
35654795Seivind#% lock		vp	? ? ?
35722521Sdyson#
3581541Srgrimesvop_lock {
3591541Srgrimes	IN struct vnode *vp;
36022521Sdyson	IN int flags;
36122521Sdyson	IN struct proc *p;
3621541Srgrimes};
3631541Srgrimes
36422521Sdyson#
36522521Sdyson#% unlock	vp	L U L
36622521Sdyson#
3671541Srgrimesvop_unlock {
3681541Srgrimes	IN struct vnode *vp;
36922521Sdyson	IN int flags;
37022521Sdyson	IN struct proc *p;
3711541Srgrimes};
3721541Srgrimes
37322521Sdyson#
37422521Sdyson#% bmap		vp	L L L
37522521Sdyson#% bmap		vpp	- U -
37622521Sdyson#
3771541Srgrimesvop_bmap {
3781541Srgrimes	IN struct vnode *vp;
3791541Srgrimes	IN daddr_t bn;
3801541Srgrimes	OUT struct vnode **vpp;
3811541Srgrimes	IN daddr_t *bnp;
3821541Srgrimes	OUT int *runp;
38310551Sdyson	OUT int *runb;
3841541Srgrimes};
3851541Srgrimes
38622521Sdyson#
38745058Seivind#% strategy	vp	L L L
38822521Sdyson#
38937384Sjulianvop_strategy {
39037384Sjulian	IN struct vnode *vp;
39137384Sjulian	IN struct buf *bp;
39237384Sjulian};
3931541Srgrimes
39422521Sdyson#
39562976Smckusick#% getwritemount vp	= = =
39662976Smckusick#
39762976Smckusickvop_getwritemount {
39862976Smckusick	IN struct vnode *vp;
39962976Smckusick	OUT struct mount **mpp;
40062976Smckusick};
40162976Smckusick
40262976Smckusick#
40322521Sdyson#% print	vp	= = =
40422521Sdyson#
4051541Srgrimesvop_print {
4061541Srgrimes	IN struct vnode *vp;
4071541Srgrimes};
4081541Srgrimes
40922521Sdyson#
41022521Sdyson#% pathconf	vp	L L L
41122521Sdyson#
4121541Srgrimesvop_pathconf {
4131541Srgrimes	IN struct vnode *vp;
4141541Srgrimes	IN int name;
41522521Sdyson	OUT register_t *retval;
4161541Srgrimes};
4171541Srgrimes
41822521Sdyson#
41922521Sdyson#% advlock	vp	U U U
42022521Sdyson#
4211541Srgrimesvop_advlock {
4221541Srgrimes	IN struct vnode *vp;
4231541Srgrimes	IN caddr_t id;
4241541Srgrimes	IN int op;
4251541Srgrimes	IN struct flock *fl;
4261541Srgrimes	IN int flags;
4271541Srgrimes};
4281541Srgrimes
42922521Sdyson#
43034266Sjulian#% balloc	vp	L L L
43134266Sjulian#
43234266Sjulianvop_balloc {
43334266Sjulian	IN struct vnode *vp;
43434266Sjulian	IN off_t startoffset;
43534266Sjulian	IN int size;
43634266Sjulian	IN struct ucred *cred;
43734266Sjulian	IN int flags;
43834266Sjulian	OUT struct buf **bpp;
43934266Sjulian};
44034266Sjulian
44134266Sjulian#
44222521Sdyson#% reallocblks	vp	L L L
44322521Sdyson#
4441541Srgrimesvop_reallocblks {
4451541Srgrimes	IN struct vnode *vp;
4461541Srgrimes	IN struct cluster_save *buflist;
4471541Srgrimes};
4481541Srgrimes
44945058Seivind#
45045058Seivind#% getpages	vp	L L L
45145058Seivind#
45210551Sdysonvop_getpages {
45310551Sdyson	IN struct vnode *vp;
45410551Sdyson	IN vm_page_t *m;
45510551Sdyson	IN int count;
45610551Sdyson	IN int reqpage;
45712767Sdyson	IN vm_ooffset_t offset;
45810551Sdyson};
45910551Sdyson
46045058Seivind#
46145058Seivind#% putpages	vp	L L L
46245058Seivind#
46310551Sdysonvop_putpages {
46410551Sdyson	IN struct vnode *vp;
46510551Sdyson	IN vm_page_t *m;
46610551Sdyson	IN int count;
46710551Sdyson	IN int sync;
46810551Sdyson	IN int *rtvals;
46912767Sdyson	IN vm_ooffset_t offset;
47010551Sdyson};
47111704Sdyson
47222521Sdyson#
47338862Sphk#% freeblks	vp	- - -
47438862Sphk#
47538862Sphk# This call is used by the filesystem to release blocks back to 
47638862Sphk# device-driver.  This is useful if the driver has a lengthy 
47738862Sphk# erase handling or similar.
47838862Sphk#
47938862Sphk
48038862Sphkvop_freeblks {
48138862Sphk	IN struct vnode *vp;
48238862Sphk	IN daddr_t addr;
48338862Sphk	IN daddr_t length;
48438862Sphk};
48538862Sphk
48638862Sphk#
48747964Smckusick#% bwrite	vp	L L L
48822521Sdyson#
48947964Smckusickvop_bwrite {
49047964Smckusick	IN struct vnode *vp;
49147964Smckusick	IN struct buf *bp;
49247964Smckusick};
49354803Srwatson
49454803Srwatson#
49566184Srwatson#% getacl	vp	L L L
49654803Srwatson#
49754803Srwatsonvop_getacl {
49854803Srwatson	IN struct vnode *vp;
49954803Srwatson	IN acl_type_t type;
50054803Srwatson	OUT struct acl *aclp;
50154803Srwatson	IN struct ucred *cred;
50254803Srwatson	IN struct proc *p;
50354803Srwatson};
50454803Srwatson
50554803Srwatson#
50654803Srwatson#% setacl	vp	L L L
50754803Srwatson#
50854803Srwatsonvop_setacl {
50954803Srwatson	IN struct vnode *vp;
51054803Srwatson	IN acl_type_t type;
51154803Srwatson	IN struct acl *aclp;
51254803Srwatson	IN struct ucred *cred;
51354803Srwatson	IN struct proc *p;
51454803Srwatson};
51554803Srwatson
51654803Srwatson#
51754803Srwatson#% aclcheck	vp	= = =
51854803Srwatson#
51954803Srwatsonvop_aclcheck {
52054803Srwatson	IN struct vnode *vp;
52154803Srwatson	IN acl_type_t type;
52254803Srwatson	IN struct acl *aclp;
52354803Srwatson	IN struct ucred *cred;
52454803Srwatson	IN struct proc *p;
52554803Srwatson};
52654803Srwatson
52754803Srwatson#
52863893Srwatson#% getextattr	vp	L L L
52954803Srwatson#
53054803Srwatsonvop_getextattr {
53154803Srwatson	IN struct vnode *vp;
53274437Srwatson	IN int attrnamespace;
53365119Srwatson	IN const char *name;
53454803Srwatson	INOUT struct uio *uio;
53554803Srwatson	IN struct ucred *cred;
53654803Srwatson	IN struct proc *p;
53754803Srwatson};
53854803Srwatson
53954803Srwatson#
54054803Srwatson#% setextattr	vp	L L L
54154803Srwatson#
54254803Srwatsonvop_setextattr {
54354803Srwatson	IN struct vnode *vp;
54474437Srwatson	IN int attrnamespace;
54565119Srwatson	IN const char *name;
54654803Srwatson	INOUT struct uio *uio;
54754803Srwatson	IN struct ucred *cred;
54854803Srwatson	IN struct proc *p;
54954803Srwatson};
55065770Sbp
55165770Sbp#
55265770Sbp#% createvobject	vp	L L L
55365770Sbp#
55465770Sbpvop_createvobject {
55565770Sbp	IN struct vnode *vp;
55665770Sbp	IN struct ucred *cred;
55765770Sbp	IN struct proc *p;
55865770Sbp};
55965770Sbp
56065770Sbp#
56165770Sbp#% destroyvobject	vp	L L L
56265770Sbp#
56365770Sbpvop_destroyvobject {
56465770Sbp	IN struct vnode *vp;
56565770Sbp};
56665770Sbp
56765770Sbp#
56865770Sbp#% getvobject	vp	L L L
56965770Sbp#
57065770Sbpvop_getvobject {
57165770Sbp	IN struct vnode *vp;
57265770Sbp	OUT struct vm_object **objpp;
57365770Sbp};
574