vnode_if.src revision 166774
1139804Simp#-
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# 4. Neither the name of the University nor the names of its contributors
141541Srgrimes#    may be used to endorse or promote products derived from this software
151541Srgrimes#    without specific prior written permission.
161541Srgrimes#
171541Srgrimes# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271541Srgrimes# SUCH DAMAGE.
281541Srgrimes#
2922521Sdyson#	@(#)vnode_if.src	8.12 (Berkeley) 5/14/95
3050477Speter# $FreeBSD: head/sys/kern/vnode_if.src 166774 2007-02-15 22:08:35Z pjd $
311541Srgrimes#
3222521Sdyson
3322521Sdyson#
34159082Sdds# Above each of the vop descriptors in lines starting with %%
35159082Sdds# is a specification of the locking protocol used by each vop call.
36159082Sdds# The first column is the name of the variable, the remaining three
37159082Sdds# columns are in, out and error respectively.  The "in" column defines
38159082Sdds# the lock state on input, the "out" column defines the state on succesful
39159082Sdds# return, and the "error" column defines the locking state on error exit.
4022521Sdyson#
4122521Sdyson# The locking value can take the following values:
4254444Seivind# L: locked; not converted to type of lock.
4354444Seivind# A: any lock type.
4454444Seivind# S: locked with shared lock.
4554444Seivind# E: locked with exclusive lock for this process.
4654444Seivind# O: locked with exclusive lock for other process.
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#
52116615Sse# The paramater named "vpp" is assumed to be always used with double
53116615Sse# indirection (**vpp) and that name is hard-codeed in vnode_if.awk !
54116615Sse#
55159082Sdds# Lines starting with %! specify a pre or post-condition function
56159082Sdds# to call before/after the vop call.
57159082Sdds#
58116615Sse# If other such parameters are introduced, they have to be added to
59116615Sse# the AWK script at the head of the definition of "add_debug_code()".
60116615Sse#
6122521Sdyson
6251679Seivindvop_islocked {
6351679Seivind	IN struct vnode *vp;
6483366Sjulian	IN struct thread *td;
6551679Seivind};
6651679Seivind
67159082Sdds%% lookup	dvp	L ? ?
68159082Sdds%% lookup	vpp	- L -
69159082Sdds%! lookup	pre	vop_lookup_pre
70159082Sdds%! lookup	post	vop_lookup_post
71159082Sdds
7222521Sdyson# XXX - the lookup locking protocol defies simple description and depends
7322521Sdyson#	on the flags and operation fields in the (cnp) structure.  Note
7422521Sdyson#	especially that *vpp may equal dvp and both may be locked.
75159082Sdds
761541Srgrimesvop_lookup {
771541Srgrimes	IN struct vnode *dvp;
781541Srgrimes	INOUT struct vnode **vpp;
791541Srgrimes	IN struct componentname *cnp;
801541Srgrimes};
811541Srgrimes
82159082Sdds%% cachedlookup	dvp	L ? ?
83159082Sdds%% cachedlookup	vpp	- L -
84159082Sdds
8528732Sphk# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
86159082Sdds
8728732Sphkvop_cachedlookup {
8828732Sphk	IN struct vnode *dvp;
8928732Sphk	INOUT struct vnode **vpp;
9028732Sphk	IN struct componentname *cnp;
9128732Sphk};
9228732Sphk
93159082Sdds%% create	dvp	E E E
94159082Sdds%% create	vpp	- L -
95159082Sdds%! create	post	vop_create_post
96159082Sdds
971541Srgrimesvop_create {
9835823Smsmith	IN struct vnode *dvp;
991541Srgrimes	OUT struct vnode **vpp;
1001541Srgrimes	IN struct componentname *cnp;
1011541Srgrimes	IN struct vattr *vap;
1021541Srgrimes};
1031541Srgrimes
104159082Sdds
105159082Sdds%% whiteout	dvp	E E E
106159082Sdds
10722521Sdysonvop_whiteout {
10835823Smsmith	IN struct vnode *dvp;
10922521Sdyson	IN struct componentname *cnp;
11022521Sdyson	IN int flags;
11122521Sdyson};
11222521Sdyson
113159082Sdds
114159082Sdds%% mknod	dvp	E E E
115159082Sdds%% mknod	vpp	- L -
116159082Sdds%! mknod	post	vop_mknod_post
117159082Sdds
1181541Srgrimesvop_mknod {
11935823Smsmith	IN struct vnode *dvp;
12053101Seivind	OUT struct vnode **vpp;
1211541Srgrimes	IN struct componentname *cnp;
1221541Srgrimes	IN struct vattr *vap;
1231541Srgrimes};
1241541Srgrimes
125159082Sdds
126159082Sdds%% open		vp	L L L
127159082Sdds
1281541Srgrimesvop_open {
1291541Srgrimes	IN struct vnode *vp;
1301541Srgrimes	IN int mode;
1311541Srgrimes	IN struct ucred *cred;
13283366Sjulian	IN struct thread *td;
133118093Sphk	IN int fdidx;
1341541Srgrimes};
1351541Srgrimes
136159082Sdds
137159082Sdds%% close	vp	E E E
138159082Sdds
1391541Srgrimesvop_close {
1401541Srgrimes	IN struct vnode *vp;
1411541Srgrimes	IN int fflag;
1421541Srgrimes	IN struct ucred *cred;
14383366Sjulian	IN struct thread *td;
1441541Srgrimes};
1451541Srgrimes
146159082Sdds
147159082Sdds%% access	vp	L L L
148159082Sdds
1491541Srgrimesvop_access {
1501541Srgrimes	IN struct vnode *vp;
1511541Srgrimes	IN int mode;
1521541Srgrimes	IN struct ucred *cred;
15383366Sjulian	IN struct thread *td;
1541541Srgrimes};
1551541Srgrimes
156159082Sdds
157159082Sdds%% getattr	vp	L L L
158159082Sdds
1591541Srgrimesvop_getattr {
1601541Srgrimes	IN struct vnode *vp;
16154803Srwatson	OUT struct vattr *vap;
1621541Srgrimes	IN struct ucred *cred;
16383366Sjulian	IN struct thread *td;
1641541Srgrimes};
1651541Srgrimes
166159082Sdds
167159082Sdds%% setattr	vp	E E E
168159082Sdds%! setattr	post	vop_setattr_post
169159082Sdds
1701541Srgrimesvop_setattr {
1711541Srgrimes	IN struct vnode *vp;
1721541Srgrimes	IN struct vattr *vap;
1731541Srgrimes	IN struct ucred *cred;
17483366Sjulian	IN struct thread *td;
1751541Srgrimes};
1761541Srgrimes
177159082Sdds
178159082Sdds%% read		vp	L L L
179159082Sdds
1801541Srgrimesvop_read {
1811541Srgrimes	IN struct vnode *vp;
1821541Srgrimes	INOUT struct uio *uio;
1831541Srgrimes	IN int ioflag;
1841541Srgrimes	IN struct ucred *cred;
1851541Srgrimes};
1861541Srgrimes
187159082Sdds
188159082Sdds%% write	vp	E E E
189159082Sdds%! write	pre	VOP_WRITE_PRE
190159082Sdds%! write	post	VOP_WRITE_POST
191159082Sdds
1921541Srgrimesvop_write {
1931541Srgrimes	IN struct vnode *vp;
1941541Srgrimes	INOUT struct uio *uio;
1951541Srgrimes	IN int ioflag;
1961541Srgrimes	IN struct ucred *cred;
1971541Srgrimes};
1981541Srgrimes
199159082Sdds
200159082Sdds%% lease	vp	= = =
201159082Sdds
20222521Sdysonvop_lease {
20322521Sdyson	IN struct vnode *vp;
20483366Sjulian	IN struct thread *td;
20522521Sdyson	IN struct ucred *cred;
20622521Sdyson	IN int flag;
20722521Sdyson};
20822521Sdyson
209159082Sdds
210159082Sdds%% ioctl	vp	U U U
211159082Sdds
2121541Srgrimesvop_ioctl {
2131541Srgrimes	IN struct vnode *vp;
21422521Sdyson	IN u_long command;
215153400Sdes	IN void *data;
2161541Srgrimes	IN int fflag;
2171541Srgrimes	IN struct ucred *cred;
21883366Sjulian	IN struct thread *td;
2191541Srgrimes};
2201541Srgrimes
221159082Sdds
222159082Sdds%% poll	vp	U U U
223159082Sdds
22429353Spetervop_poll {
2251541Srgrimes	IN struct vnode *vp;
22629353Speter	IN int events;
2271541Srgrimes	IN struct ucred *cred;
22883366Sjulian	IN struct thread *td;
2291541Srgrimes};
2301541Srgrimes
231159082Sdds
232159082Sdds%% kqfilter	vp	U U U
233159082Sdds
23472521Sjlemonvop_kqfilter {
23572521Sjlemon	IN struct vnode *vp;
23672521Sjlemon	IN struct knote *kn;
23772521Sjlemon};
23872521Sjlemon
239159082Sdds
240159082Sdds%% revoke	vp	L L L
241159082Sdds
24222521Sdysonvop_revoke {
24322521Sdyson	IN struct vnode *vp;
24422521Sdyson	IN int flags;
24522521Sdyson};
24622521Sdyson
247159082Sdds
248159082Sdds%% fsync	vp	E E E
249159082Sdds
2501541Srgrimesvop_fsync {
2511541Srgrimes	IN struct vnode *vp;
2521541Srgrimes	IN int waitfor;
25383366Sjulian	IN struct thread *td;
2541541Srgrimes};
2551541Srgrimes
256159082Sdds
257159082Sdds%% remove	dvp	E E E
258159082Sdds%% remove	vp	E E E
259159082Sdds%! remove	post	vop_remove_post
260159082Sdds
2611541Srgrimesvop_remove {
26235823Smsmith	IN struct vnode *dvp;
26335823Smsmith	IN struct vnode *vp;
2641541Srgrimes	IN struct componentname *cnp;
2651541Srgrimes};
2661541Srgrimes
267159082Sdds
268159082Sdds%% link		tdvp	E E E
269159082Sdds%% link		vp	E E E
270159082Sdds%! link		post	vop_link_post
271159082Sdds
2729842Sdgvop_link {
27335823Smsmith	IN struct vnode *tdvp;
2749842Sdg	IN struct vnode *vp;
2759842Sdg	IN struct componentname *cnp;
2769842Sdg};
2771541Srgrimes
278159082Sdds
279159082Sdds%! rename	pre	vop_rename_pre
280159082Sdds%! rename	post	vop_rename_post
281159082Sdds
2821541Srgrimesvop_rename {
2831541Srgrimes	IN WILLRELE struct vnode *fdvp;
2841541Srgrimes	IN WILLRELE struct vnode *fvp;
2851541Srgrimes	IN struct componentname *fcnp;
2861541Srgrimes	IN WILLRELE struct vnode *tdvp;
2871541Srgrimes	IN WILLRELE struct vnode *tvp;
2881541Srgrimes	IN struct componentname *tcnp;
2891541Srgrimes};
2901541Srgrimes
291159082Sdds
292159082Sdds%% mkdir	dvp	E E E
293159082Sdds%% mkdir	vpp	- E -
294159082Sdds%! mkdir	post	vop_mkdir_post
295159082Sdds
2961541Srgrimesvop_mkdir {
29735823Smsmith	IN struct vnode *dvp;
2981541Srgrimes	OUT struct vnode **vpp;
2991541Srgrimes	IN struct componentname *cnp;
3001541Srgrimes	IN struct vattr *vap;
3011541Srgrimes};
3021541Srgrimes
303159082Sdds
304159082Sdds%% rmdir	dvp	E E E
305159082Sdds%% rmdir	vp	E E E
306159082Sdds%! rmdir	post	vop_rmdir_post
307159082Sdds
3081541Srgrimesvop_rmdir {
30935823Smsmith	IN struct vnode *dvp;
31035823Smsmith	IN struct vnode *vp;
3111541Srgrimes	IN struct componentname *cnp;
3121541Srgrimes};
3131541Srgrimes
314159082Sdds
315159082Sdds%% symlink	dvp	E E E
316159082Sdds%% symlink	vpp	- E -
317159082Sdds%! symlink	post	vop_symlink_post
318159082Sdds
3191541Srgrimesvop_symlink {
32035823Smsmith	IN struct vnode *dvp;
32153131Seivind	OUT struct vnode **vpp;
3221541Srgrimes	IN struct componentname *cnp;
3231541Srgrimes	IN struct vattr *vap;
3241541Srgrimes	IN char *target;
3251541Srgrimes};
3261541Srgrimes
327159082Sdds
328159082Sdds%% readdir	vp	L L L
329159082Sdds
3301541Srgrimesvop_readdir {
3311541Srgrimes	IN struct vnode *vp;
3321541Srgrimes	INOUT struct uio *uio;
3331541Srgrimes	IN struct ucred *cred;
3343167Sdfr	INOUT int *eofflag;
33522521Sdyson	OUT int *ncookies;
33622521Sdyson	INOUT u_long **cookies;
3371541Srgrimes};
3381541Srgrimes
339159082Sdds
340159082Sdds%% readlink	vp	L L L
341159082Sdds
3421541Srgrimesvop_readlink {
3431541Srgrimes	IN struct vnode *vp;
3441541Srgrimes	INOUT struct uio *uio;
3451541Srgrimes	IN struct ucred *cred;
3461541Srgrimes};
3471541Srgrimes
348159082Sdds
349159082Sdds%% inactive	vp	E E E
350159082Sdds
3511541Srgrimesvop_inactive {
3521541Srgrimes	IN struct vnode *vp;
35383366Sjulian	IN struct thread *td;
3541541Srgrimes};
3551541Srgrimes
356159082Sdds
357159082Sdds%% reclaim	vp	E E E
358159082Sdds
3591541Srgrimesvop_reclaim {
3601541Srgrimes	IN struct vnode *vp;
36183366Sjulian	IN struct thread *td;
3621541Srgrimes};
3631541Srgrimes
364159082Sdds
365159082Sdds%! lock		pre	vop_lock_pre
366159082Sdds%! lock		post	vop_lock_post
367159082Sdds
368164248Skmacy_vop_lock {
3691541Srgrimes	IN struct vnode *vp;
37022521Sdyson	IN int flags;
37183366Sjulian	IN struct thread *td;
372164248Skmacy	IN char *file;
373164248Skmacy	IN int line;
3741541Srgrimes};
3751541Srgrimes
376159082Sdds
377159082Sdds%! unlock	pre	vop_unlock_pre
378159082Sdds%! unlock	post	vop_unlock_post
379159082Sdds
3801541Srgrimesvop_unlock {
3811541Srgrimes	IN struct vnode *vp;
38222521Sdyson	IN int flags;
38383366Sjulian	IN struct thread *td;
3841541Srgrimes};
3851541Srgrimes
386159082Sdds
387159082Sdds%% bmap		vp	L L L
388159082Sdds
3891541Srgrimesvop_bmap {
3901541Srgrimes	IN struct vnode *vp;
39196572Sphk	IN daddr_t bn;
392137726Sphk	OUT struct bufobj **bop;
39396572Sphk	IN daddr_t *bnp;
3941541Srgrimes	OUT int *runp;
39510551Sdyson	OUT int *runb;
3961541Srgrimes};
3971541Srgrimes
398159082Sdds
399159082Sdds%% strategy	vp	L L L
400159082Sdds%! strategy	pre	vop_strategy_pre
401159082Sdds
40237384Sjulianvop_strategy {
40337384Sjulian	IN struct vnode *vp;
40437384Sjulian	IN struct buf *bp;
40537384Sjulian};
4061541Srgrimes
407159082Sdds
408159082Sdds%% getwritemount vp	= = =
409159082Sdds
41062976Smckusickvop_getwritemount {
41162976Smckusick	IN struct vnode *vp;
41262976Smckusick	OUT struct mount **mpp;
41362976Smckusick};
41462976Smckusick
415159082Sdds
416159082Sdds%% print	vp	= = =
417159082Sdds
4181541Srgrimesvop_print {
4191541Srgrimes	IN struct vnode *vp;
4201541Srgrimes};
4211541Srgrimes
422159082Sdds
423159082Sdds%% pathconf	vp	L L L
424159082Sdds
4251541Srgrimesvop_pathconf {
4261541Srgrimes	IN struct vnode *vp;
4271541Srgrimes	IN int name;
42822521Sdyson	OUT register_t *retval;
4291541Srgrimes};
4301541Srgrimes
431159082Sdds
432159082Sdds%% advlock	vp	U U U
433159082Sdds
4341541Srgrimesvop_advlock {
4351541Srgrimes	IN struct vnode *vp;
436153400Sdes	IN void *id;
4371541Srgrimes	IN int op;
4381541Srgrimes	IN struct flock *fl;
4391541Srgrimes	IN int flags;
4401541Srgrimes};
4411541Srgrimes
442159082Sdds
443159082Sdds%% reallocblks	vp	E E E
444159082Sdds
4451541Srgrimesvop_reallocblks {
4461541Srgrimes	IN struct vnode *vp;
4471541Srgrimes	IN struct cluster_save *buflist;
4481541Srgrimes};
4491541Srgrimes
450159082Sdds
451159082Sdds%% getpages	vp	L L L
452159082Sdds
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
461159082Sdds
462159082Sdds%% putpages	vp	E E E
463159082Sdds
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
473159082Sdds
474159082Sdds%% getacl	vp	L L L
475159082Sdds
47654803Srwatsonvop_getacl {
47754803Srwatson	IN struct vnode *vp;
47854803Srwatson	IN acl_type_t type;
47954803Srwatson	OUT struct acl *aclp;
48054803Srwatson	IN struct ucred *cred;
48183366Sjulian	IN struct thread *td;
48254803Srwatson};
48354803Srwatson
484159082Sdds
485159082Sdds%% setacl	vp	E E E
486159082Sdds
48754803Srwatsonvop_setacl {
48854803Srwatson	IN struct vnode *vp;
48954803Srwatson	IN acl_type_t type;
49054803Srwatson	IN struct acl *aclp;
49154803Srwatson	IN struct ucred *cred;
49283366Sjulian	IN struct thread *td;
49354803Srwatson};
49454803Srwatson
495159082Sdds
496159082Sdds%% aclcheck	vp	= = =
497159082Sdds
49854803Srwatsonvop_aclcheck {
49954803Srwatson	IN struct vnode *vp;
50054803Srwatson	IN acl_type_t type;
50154803Srwatson	IN struct acl *aclp;
50254803Srwatson	IN struct ucred *cred;
50383366Sjulian	IN struct thread *td;
50454803Srwatson};
50554803Srwatson
506159082Sdds
507159082Sdds%% closeextattr	vp	L L L
508159082Sdds
509102990Sphkvop_closeextattr {
510102990Sphk	IN struct vnode *vp;
511102990Sphk	IN int commit;
512102990Sphk	IN struct ucred *cred;
513102990Sphk	IN struct thread *td;
514102990Sphk};
515102990Sphk
516159082Sdds
517159082Sdds%% getextattr	vp	L L L
518159082Sdds
51954803Srwatsonvop_getextattr {
52054803Srwatson	IN struct vnode *vp;
52174437Srwatson	IN int attrnamespace;
52265119Srwatson	IN const char *name;
52354803Srwatson	INOUT struct uio *uio;
52490448Srwatson	OUT size_t *size;
52554803Srwatson	IN struct ucred *cred;
52683366Sjulian	IN struct thread *td;
52754803Srwatson};
52854803Srwatson
529159082Sdds
530159082Sdds%% listextattr	vp	L L L
531159082Sdds
532115867Srwatsonvop_listextattr {
533115867Srwatson	IN struct vnode *vp;
534115867Srwatson	IN int attrnamespace;
535115867Srwatson	INOUT struct uio *uio;
536115867Srwatson	OUT size_t *size;
537115867Srwatson	IN struct ucred *cred;
538115867Srwatson	IN struct thread *td;
539115867Srwatson};
540115867Srwatson
541159082Sdds
542159082Sdds%% openextattr	vp	L L L
543159082Sdds
544102990Sphkvop_openextattr {
545102990Sphk	IN struct vnode *vp;
546102990Sphk	IN struct ucred *cred;
547102990Sphk	IN struct thread *td;
548102990Sphk};
549102990Sphk
550159082Sdds
551159082Sdds%% deleteextattr	vp	E E E
552159082Sdds
553118131Srwatsonvop_deleteextattr {
554116698Srwatson	IN struct vnode *vp;
555116698Srwatson	IN int attrnamespace;
556116698Srwatson	IN const char *name;
557116698Srwatson	IN struct ucred *cred;
558116698Srwatson	IN struct thread *td;
559116698Srwatson};
560116698Srwatson
561159082Sdds
562159082Sdds%% setextattr	vp	E E E
563159082Sdds
56454803Srwatsonvop_setextattr {
56554803Srwatson	IN struct vnode *vp;
56674437Srwatson	IN int attrnamespace;
56765119Srwatson	IN const char *name;
56854803Srwatson	INOUT struct uio *uio;
56954803Srwatson	IN struct ucred *cred;
57083366Sjulian	IN struct thread *td;
57154803Srwatson};
57265770Sbp
573159082Sdds
574159082Sdds%% setlabel	vp	E E E
575159082Sdds
576100984Srwatsonvop_setlabel {
577100984Srwatson	IN struct vnode *vp;
578100984Srwatson	IN struct label *label;
579100984Srwatson	IN struct ucred *cred;
580100984Srwatson	IN struct thread *td;
581100984Srwatson};
582166774Spjd
583166774Spjd
584166774Spjd%% setlabel	vp	= = =
585166774Spjd
586166774Spjdvop_vptofh {
587166774Spjd	IN struct vnode *vp;
588166774Spjd	IN struct fid *fhp;
589166774Spjd};
590