vnode_if.src revision 45058
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
3445058Seivind# $Id: vnode_if.src,v 1.19 1998/09/05 14:13:06 phk Exp $
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:
4622521Sdyson# L: locked.
4745058Seivind# U: unlocked.
4822521Sdyson# -: not applicable.  vnode does not yet (or no longer) exists.
4922521Sdyson# =: the same on input and output, may be either L or U.
5022521Sdyson# X: locked if not nil.
5122521Sdyson#
5222521Sdyson
5322521Sdyson#
5422521Sdyson#% lookup	dvp	L ? ?
5522521Sdyson#% lookup	vpp	- L -
5622521Sdyson#
5722521Sdyson# XXX - the lookup locking protocol defies simple description and depends
5822521Sdyson#	on the flags and operation fields in the (cnp) structure.  Note
5922521Sdyson#	especially that *vpp may equal dvp and both may be locked.
6022521Sdyson#
611541Srgrimesvop_lookup {
621541Srgrimes	IN struct vnode *dvp;
631541Srgrimes	INOUT struct vnode **vpp;
641541Srgrimes	IN struct componentname *cnp;
651541Srgrimes};
661541Srgrimes
6722521Sdyson#
6828732Sphk#% cachedlookup	dvp	L ? ?
6928732Sphk#% cachedlookup	vpp	- L -
7028732Sphk#
7128732Sphk# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
7228732Sphk#
7328732Sphkvop_cachedlookup {
7428732Sphk	IN struct vnode *dvp;
7528732Sphk	INOUT struct vnode **vpp;
7628732Sphk	IN struct componentname *cnp;
7728732Sphk};
7828732Sphk
7928732Sphk#
8035823Smsmith#% create	dvp	L L L
8122521Sdyson#% create	vpp	- L -
8222521Sdyson#
831541Srgrimesvop_create {
8435823Smsmith	IN struct vnode *dvp;
851541Srgrimes	OUT struct vnode **vpp;
861541Srgrimes	IN struct componentname *cnp;
871541Srgrimes	IN struct vattr *vap;
881541Srgrimes};
891541Srgrimes
9022521Sdyson#
9122521Sdyson#% whiteout	dvp	L L L
9222521Sdyson#
9322521Sdysonvop_whiteout {
9435823Smsmith	IN struct vnode *dvp;
9522521Sdyson	IN struct componentname *cnp;
9622521Sdyson	IN int flags;
9722521Sdyson};
9822521Sdyson
9922521Sdyson#
10035823Smsmith#% mknod	dvp	L L L
10122521Sdyson#% mknod	vpp	- X -
10222521Sdyson#
1031541Srgrimesvop_mknod {
10435823Smsmith	IN struct vnode *dvp;
1051541Srgrimes	OUT WILLRELE struct vnode **vpp;
1061541Srgrimes	IN struct componentname *cnp;
1071541Srgrimes	IN struct vattr *vap;
1081541Srgrimes};
1091541Srgrimes
11022521Sdyson#
11122521Sdyson#% open		vp	L L L
11222521Sdyson#
1131541Srgrimesvop_open {
1141541Srgrimes	IN struct vnode *vp;
1151541Srgrimes	IN int mode;
1161541Srgrimes	IN struct ucred *cred;
1171541Srgrimes	IN struct proc *p;
1181541Srgrimes};
1191541Srgrimes
12022521Sdyson#
12122521Sdyson#% close	vp	U U U
12222521Sdyson#
1231541Srgrimesvop_close {
1241541Srgrimes	IN struct vnode *vp;
1251541Srgrimes	IN int fflag;
1261541Srgrimes	IN struct ucred *cred;
1271541Srgrimes	IN struct proc *p;
1281541Srgrimes};
1291541Srgrimes
13022521Sdyson#
13122521Sdyson#% access	vp	L L L
13222521Sdyson#
1331541Srgrimesvop_access {
1341541Srgrimes	IN struct vnode *vp;
1351541Srgrimes	IN int mode;
1361541Srgrimes	IN struct ucred *cred;
1371541Srgrimes	IN struct proc *p;
1381541Srgrimes};
1391541Srgrimes
14022521Sdyson#
14122521Sdyson#% getattr	vp	= = =
14222521Sdyson#
1431541Srgrimesvop_getattr {
1441541Srgrimes	IN struct vnode *vp;
1451541Srgrimes	IN struct vattr *vap;
1461541Srgrimes	IN struct ucred *cred;
1471541Srgrimes	IN struct proc *p;
1481541Srgrimes};
1491541Srgrimes
15022521Sdyson#
15122521Sdyson#% setattr	vp	L L L
15222521Sdyson#
1531541Srgrimesvop_setattr {
1541541Srgrimes	IN struct vnode *vp;
1551541Srgrimes	IN struct vattr *vap;
1561541Srgrimes	IN struct ucred *cred;
1571541Srgrimes	IN struct proc *p;
1581541Srgrimes};
1591541Srgrimes
16022521Sdyson#
16122521Sdyson#% read		vp	L L L
16222521Sdyson#
1631541Srgrimesvop_read {
1641541Srgrimes	IN struct vnode *vp;
1651541Srgrimes	INOUT struct uio *uio;
1661541Srgrimes	IN int ioflag;
1671541Srgrimes	IN struct ucred *cred;
1681541Srgrimes};
1691541Srgrimes
17022521Sdyson#
17122521Sdyson#% write	vp	L L L
17222521Sdyson#
1731541Srgrimesvop_write {
1741541Srgrimes	IN struct vnode *vp;
1751541Srgrimes	INOUT struct uio *uio;
1761541Srgrimes	IN int ioflag;
1771541Srgrimes	IN struct ucred *cred;
1781541Srgrimes};
1791541Srgrimes
18022521Sdyson#
18122521Sdyson#% lease	vp	= = =
18222521Sdyson#
18322521Sdysonvop_lease {
18422521Sdyson	IN struct vnode *vp;
18522521Sdyson	IN struct proc *p;
18622521Sdyson	IN struct ucred *cred;
18722521Sdyson	IN int flag;
18822521Sdyson};
18922521Sdyson
19022521Sdyson#
19122521Sdyson#% ioctl	vp	U U U
19222521Sdyson#
1931541Srgrimesvop_ioctl {
1941541Srgrimes	IN struct vnode *vp;
19522521Sdyson	IN u_long command;
1961541Srgrimes	IN caddr_t data;
1971541Srgrimes	IN int fflag;
1981541Srgrimes	IN struct ucred *cred;
1991541Srgrimes	IN struct proc *p;
2001541Srgrimes};
2011541Srgrimes
20222521Sdyson#
20329353Speter#% poll	vp	U U U
20422521Sdyson#
20529353Spetervop_poll {
2061541Srgrimes	IN struct vnode *vp;
20729353Speter	IN int events;
2081541Srgrimes	IN struct ucred *cred;
2091541Srgrimes	IN struct proc *p;
2101541Srgrimes};
2111541Srgrimes
21222521Sdyson#
21322521Sdyson#% revoke	vp	U U U
21422521Sdyson#
21522521Sdysonvop_revoke {
21622521Sdyson	IN struct vnode *vp;
21722521Sdyson	IN int flags;
21822521Sdyson};
21922521Sdyson
22022521Sdyson#
22122521Sdyson# XXX - not used
22222521Sdyson#
2231541Srgrimesvop_mmap {
2241541Srgrimes	IN struct vnode *vp;
2251541Srgrimes	IN int fflags;
2261541Srgrimes	IN struct ucred *cred;
2271541Srgrimes	IN struct proc *p;
2281541Srgrimes};
2291541Srgrimes
23022521Sdyson#
23122521Sdyson#% fsync	vp	L L L
23222521Sdyson#
2331541Srgrimesvop_fsync {
2341541Srgrimes	IN struct vnode *vp;
2351541Srgrimes	IN struct ucred *cred;
2361541Srgrimes	IN int waitfor;
2371541Srgrimes	IN struct proc *p;
2381541Srgrimes};
2391541Srgrimes
24022521Sdyson#
24135823Smsmith#% remove	dvp	L L L
24235823Smsmith#% remove	vp	L L L
24322521Sdyson#
2441541Srgrimesvop_remove {
24535823Smsmith	IN struct vnode *dvp;
24635823Smsmith	IN struct vnode *vp;
2471541Srgrimes	IN struct componentname *cnp;
2481541Srgrimes};
2491541Srgrimes
25022521Sdyson#
25135823Smsmith#% link		tdvp	L L L
25222521Sdyson#% link		vp	U U U
25322521Sdyson#
2549842Sdgvop_link {
25535823Smsmith	IN struct vnode *tdvp;
2569842Sdg	IN struct vnode *vp;
2579842Sdg	IN struct componentname *cnp;
2589842Sdg};
2591541Srgrimes
26022521Sdyson#
26122521Sdyson#% rename	fdvp	U U U
26222521Sdyson#% rename	fvp	U U U
26322521Sdyson#% rename	tdvp	L U U
26422521Sdyson#% rename	tvp	X U U
26522521Sdyson#
2661541Srgrimesvop_rename {
2671541Srgrimes	IN WILLRELE struct vnode *fdvp;
2681541Srgrimes	IN WILLRELE struct vnode *fvp;
2691541Srgrimes	IN struct componentname *fcnp;
2701541Srgrimes	IN WILLRELE struct vnode *tdvp;
2711541Srgrimes	IN WILLRELE struct vnode *tvp;
2721541Srgrimes	IN struct componentname *tcnp;
2731541Srgrimes};
2741541Srgrimes
27522521Sdyson#
27635823Smsmith#% mkdir	dvp	L L L
27722521Sdyson#% mkdir	vpp	- L -
27822521Sdyson#
2791541Srgrimesvop_mkdir {
28035823Smsmith	IN struct vnode *dvp;
2811541Srgrimes	OUT struct vnode **vpp;
2821541Srgrimes	IN struct componentname *cnp;
2831541Srgrimes	IN struct vattr *vap;
2841541Srgrimes};
2851541Srgrimes
28622521Sdyson#
28735823Smsmith#% rmdir	dvp	L L L
28835823Smsmith#% rmdir	vp	L L L
28922521Sdyson#
2901541Srgrimesvop_rmdir {
29135823Smsmith	IN struct vnode *dvp;
29235823Smsmith	IN struct vnode *vp;
2931541Srgrimes	IN struct componentname *cnp;
2941541Srgrimes};
2951541Srgrimes
29622521Sdyson#
29735823Smsmith#% symlink	dvp	L L L
29822521Sdyson#% symlink	vpp	- U -
29922521Sdyson#
30022521Sdyson# XXX - note that the return vnode has already been VRELE'ed
30122521Sdyson#	by the filesystem layer.  To use it you must use vget,
30222521Sdyson#	possibly with a further namei.
30322521Sdyson#
3041541Srgrimesvop_symlink {
30535823Smsmith	IN struct vnode *dvp;
3061541Srgrimes	OUT WILLRELE struct vnode **vpp;
3071541Srgrimes	IN struct componentname *cnp;
3081541Srgrimes	IN struct vattr *vap;
3091541Srgrimes	IN char *target;
3101541Srgrimes};
3111541Srgrimes
31222521Sdyson#
31322521Sdyson#% readdir	vp	L L L
31422521Sdyson#
3151541Srgrimesvop_readdir {
3161541Srgrimes	IN struct vnode *vp;
3171541Srgrimes	INOUT struct uio *uio;
3181541Srgrimes	IN struct ucred *cred;
3193167Sdfr	INOUT int *eofflag;
32022521Sdyson	OUT int *ncookies;
32122521Sdyson	INOUT u_long **cookies;
3221541Srgrimes};
3231541Srgrimes
32422521Sdyson#
32522521Sdyson#% readlink	vp	L L L
32622521Sdyson#
3271541Srgrimesvop_readlink {
3281541Srgrimes	IN struct vnode *vp;
3291541Srgrimes	INOUT struct uio *uio;
3301541Srgrimes	IN struct ucred *cred;
3311541Srgrimes};
3321541Srgrimes
33322521Sdyson#
33422521Sdyson#% abortop	dvp	= = =
33522521Sdyson#
3361541Srgrimesvop_abortop {
3371541Srgrimes	IN struct vnode *dvp;
3381541Srgrimes	IN struct componentname *cnp;
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#
35822521Sdyson#% lock		vp	U L U
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#% islocked	vp	= = =
40522521Sdyson#
4061541Srgrimesvop_islocked {
4071541Srgrimes	IN struct vnode *vp;
4081541Srgrimes};
4091541Srgrimes
41022521Sdyson#
41122521Sdyson#% pathconf	vp	L L L
41222521Sdyson#
4131541Srgrimesvop_pathconf {
4141541Srgrimes	IN struct vnode *vp;
4151541Srgrimes	IN int name;
41622521Sdyson	OUT register_t *retval;
4171541Srgrimes};
4181541Srgrimes
41922521Sdyson#
42022521Sdyson#% advlock	vp	U U U
42122521Sdyson#
4221541Srgrimesvop_advlock {
4231541Srgrimes	IN struct vnode *vp;
4241541Srgrimes	IN caddr_t id;
4251541Srgrimes	IN int op;
4261541Srgrimes	IN struct flock *fl;
4271541Srgrimes	IN int flags;
4281541Srgrimes};
4291541Srgrimes
43022521Sdyson#
43134266Sjulian#% balloc	vp	L L L
43234266Sjulian#
43334266Sjulianvop_balloc {
43434266Sjulian	IN struct vnode *vp;
43534266Sjulian	IN off_t startoffset;
43634266Sjulian	IN int size;
43734266Sjulian	IN struct ucred *cred;
43834266Sjulian	IN int flags;
43934266Sjulian	OUT struct buf **bpp;
44034266Sjulian};
44134266Sjulian
44234266Sjulian#
44322521Sdyson#% reallocblks	vp	L L L
44422521Sdyson#
4451541Srgrimesvop_reallocblks {
4461541Srgrimes	IN struct vnode *vp;
4471541Srgrimes	IN struct cluster_save *buflist;
4481541Srgrimes};
4491541Srgrimes
45045058Seivind#
45145058Seivind#% getpages	vp	L L L
45245058Seivind#
45310551Sdysonvop_getpages {
45410551Sdyson	IN struct vnode *vp;
45510551Sdyson	IN vm_page_t *m;
45610551Sdyson	IN int count;
45710551Sdyson	IN int reqpage;
45812767Sdyson	IN vm_ooffset_t offset;
45910551Sdyson};
46010551Sdyson
46145058Seivind#
46245058Seivind#% putpages	vp	L L L
46345058Seivind#
46410551Sdysonvop_putpages {
46510551Sdyson	IN struct vnode *vp;
46610551Sdyson	IN vm_page_t *m;
46710551Sdyson	IN int count;
46810551Sdyson	IN int sync;
46910551Sdyson	IN int *rtvals;
47012767Sdyson	IN vm_ooffset_t offset;
47110551Sdyson};
47211704Sdyson
47322521Sdyson#
47438862Sphk#% freeblks	vp	- - -
47538862Sphk#
47638862Sphk# This call is used by the filesystem to release blocks back to 
47738862Sphk# device-driver.  This is useful if the driver has a lengthy 
47838862Sphk# erase handling or similar.
47938862Sphk#
48038862Sphk
48138862Sphkvop_freeblks {
48238862Sphk	IN struct vnode *vp;
48338862Sphk	IN daddr_t addr;
48438862Sphk	IN daddr_t length;
48538862Sphk};
48638862Sphk
48738862Sphk#
4881541Srgrimes# Needs work: no vp?
48922521Sdyson#
4901541Srgrimes#vop_bwrite {
4911541Srgrimes#	IN struct buf *bp;
4921541Srgrimes#};
493