vnode_if.src revision 99554
1195379Ssam#
2195379Ssam# Copyright (c) 1992, 1993
3195379Ssam#	The Regents of the University of California.  All rights reserved.
4195379Ssam#
5195379Ssam# Redistribution and use in source and binary forms, with or without
6195379Ssam# modification, are permitted provided that the following conditions
7195379Ssam# are met:
8195379Ssam# 1. Redistributions of source code must retain the above copyright
9195379Ssam#    notice, this list of conditions and the following disclaimer.
10195379Ssam# 2. Redistributions in binary form must reproduce the above copyright
11195379Ssam#    notice, this list of conditions and the following disclaimer in the
12195379Ssam#    documentation and/or other materials provided with the distribution.
13195379Ssam# 3. All advertising materials mentioning features or use of this software
14195379Ssam#    must display the following acknowledgement:
15195379Ssam#	This product includes software developed by the University of
16195379Ssam#	California, Berkeley and its contributors.
17195379Ssam# 4. Neither the name of the University nor the names of its contributors
18195379Ssam#    may be used to endorse or promote products derived from this software
19195379Ssam#    without specific prior written permission.
20195379Ssam#
21195379Ssam# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22195379Ssam# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23195379Ssam# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24195379Ssam# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25195379Ssam# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26195379Ssam# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27195379Ssam# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28195379Ssam# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29195379Ssam# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30195379Ssam# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31195379Ssam# SUCH DAMAGE.
32195379Ssam#
33195379Ssam#	@(#)vnode_if.src	8.12 (Berkeley) 5/14/95
34195379Ssam# $FreeBSD: head/sys/kern/vnode_if.src 99554 2002-07-07 22:37:45Z jeff $
35195379Ssam#
36195379Ssam
37195379Ssam#
38195379Ssam# Above each of the vop descriptors is a specification of the locking
39195379Ssam# protocol used by each vop call.  The first column is the name of
40195379Ssam# the variable, the remaining three columns are in, out and error
41195379Ssam# respectively.  The "in" column defines the lock state on input,
42195379Ssam# the "out" column defines the state on succesful return, and the
43195379Ssam# "error" column defines the locking state on error exit.
44195379Ssam#
45195379Ssam# The locking value can take the following values:
46195379Ssam# L: locked; not converted to type of lock.
47195379Ssam# A: any lock type.
48195379Ssam# S: locked with shared lock.
49195379Ssam# E: locked with exclusive lock for this process.
50195379Ssam# O: locked with exclusive lock for other process.
51195379Ssam# U: unlocked.
52223842Skevlo# -: not applicable.  vnode does not yet (or no longer) exists.
53195379Ssam# =: the same on input and output, may be either L or U.
54195379Ssam# X: locked if not nil.
55195379Ssam#
56195379Ssam
57195379Ssam#
58195379Ssam#% islocked	vp	= = =
59195379Ssam#
60195379Ssamvop_islocked {
61195379Ssam	IN struct vnode *vp;
62195379Ssam	IN struct thread *td;
63195379Ssam};
64195379Ssam
65195379Ssam#
66195379Ssam#% lookup	dvp	L ? ?
67195379Ssam#% lookup	vpp	- L -
68195379Ssam#
69195379Ssam# XXX - the lookup locking protocol defies simple description and depends
70195379Ssam#	on the flags and operation fields in the (cnp) structure.  Note
71195379Ssam#	especially that *vpp may equal dvp and both may be locked.
72195379Ssam#
73195379Ssamvop_lookup {
74195379Ssam	IN struct vnode *dvp;
75195379Ssam	INOUT struct vnode **vpp;
76195379Ssam	IN struct componentname *cnp;
77195379Ssam};
78195379Ssam
79195379Ssam#
80195379Ssam#% cachedlookup	dvp	L ? ?
81195379Ssam#% cachedlookup	vpp	- L -
82195379Ssam#
83195379Ssam# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
84195379Ssam#
85195379Ssamvop_cachedlookup {
86195379Ssam	IN struct vnode *dvp;
87195379Ssam	INOUT struct vnode **vpp;
88195379Ssam	IN struct componentname *cnp;
89195379Ssam};
90195379Ssam
91195379Ssam#
92195379Ssam#% create	dvp	L L L
93195379Ssam#% create	vpp	- L -
94195379Ssam#
95195379Ssamvop_create {
96195379Ssam	IN struct vnode *dvp;
97195379Ssam	OUT struct vnode **vpp;
98195379Ssam	IN struct componentname *cnp;
99195379Ssam	IN struct vattr *vap;
100195379Ssam};
101195379Ssam
102195379Ssam#
103195379Ssam#% whiteout	dvp	L L L
104195379Ssam#
105195379Ssamvop_whiteout {
106195379Ssam	IN struct vnode *dvp;
107195379Ssam	IN struct componentname *cnp;
108195379Ssam	IN int flags;
109195379Ssam};
110195379Ssam
111195379Ssam#
112195379Ssam#% mknod	dvp	L L L
113195379Ssam#% mknod	vpp	- L -
114195379Ssam#
115195379Ssamvop_mknod {
116195379Ssam	IN struct vnode *dvp;
117195379Ssam	OUT struct vnode **vpp;
118195379Ssam	IN struct componentname *cnp;
119195379Ssam	IN struct vattr *vap;
120195379Ssam};
121195379Ssam
122195379Ssam#
123195379Ssam#% open		vp	L L L
124195379Ssam#
125195379Ssamvop_open {
126195379Ssam	IN struct vnode *vp;
127195379Ssam	IN int mode;
128195379Ssam	IN struct ucred *cred;
129195379Ssam	IN struct thread *td;
130195379Ssam};
131195379Ssam
132195379Ssam#
133195379Ssam#% close	vp	U U U
134195379Ssam#
135195379Ssamvop_close {
136195379Ssam	IN struct vnode *vp;
137195379Ssam	IN int fflag;
138195379Ssam	IN struct ucred *cred;
139195379Ssam	IN struct thread *td;
140195379Ssam};
141195379Ssam
142195379Ssam#
143195379Ssam#% access	vp	L L L
144195379Ssam#
145195379Ssamvop_access {
146195379Ssam	IN struct vnode *vp;
147195379Ssam	IN int mode;
148195379Ssam	IN struct ucred *cred;
149195379Ssam	IN struct thread *td;
150195379Ssam};
151195379Ssam
152195379Ssam#
153195379Ssam#% getattr	vp	L L L
154195379Ssam#
155195379Ssamvop_getattr {
156195379Ssam	IN struct vnode *vp;
157218965Sbrucec	OUT struct vattr *vap;
158195379Ssam	IN struct ucred *cred;
159195379Ssam	IN struct thread *td;
160195379Ssam};
161195379Ssam
162195379Ssam#
163195379Ssam#% setattr	vp	L L L
164195379Ssam#
165195379Ssamvop_setattr {
166195379Ssam	IN struct vnode *vp;
167195379Ssam	IN struct vattr *vap;
168195379Ssam	IN struct ucred *cred;
169195379Ssam	IN struct thread *td;
170195379Ssam};
171195379Ssam
172195379Ssam#
173195379Ssam#% read		vp	L L L
174195379Ssam#
175195379Ssamvop_read {
176195379Ssam	IN struct vnode *vp;
177195379Ssam	INOUT struct uio *uio;
178195379Ssam	IN int ioflag;
179195379Ssam	IN struct ucred *cred;
180195379Ssam};
181195379Ssam
182195379Ssam#
183195379Ssam#% write	vp	L L L
184195379Ssam#
185195379Ssamvop_write {
186195379Ssam	IN struct vnode *vp;
187195379Ssam	INOUT struct uio *uio;
188195379Ssam	IN int ioflag;
189195379Ssam	IN struct ucred *cred;
190195379Ssam};
191195379Ssam
192195379Ssam#
193195379Ssam#% lease	vp	= = =
194195379Ssam#
195195379Ssamvop_lease {
196195379Ssam	IN struct vnode *vp;
197195379Ssam	IN struct thread *td;
198195379Ssam	IN struct ucred *cred;
199195379Ssam	IN int flag;
200195379Ssam};
201195379Ssam
202195379Ssam#
203195379Ssam#% ioctl	vp	U U U
204195379Ssam#
205195379Ssamvop_ioctl {
206195379Ssam	IN struct vnode *vp;
207195379Ssam	IN u_long command;
208195379Ssam	IN caddr_t data;
209195379Ssam	IN int fflag;
210195379Ssam	IN struct ucred *cred;
211195379Ssam	IN struct thread *td;
212195379Ssam};
213195379Ssam
214195379Ssam#
215195379Ssam#% poll	vp	U U U
216195379Ssam#
217195379Ssamvop_poll {
218195379Ssam	IN struct vnode *vp;
219195379Ssam	IN int events;
220195379Ssam	IN struct ucred *cred;
221195379Ssam	IN struct thread *td;
222195379Ssam};
223195379Ssam
224195379Ssam#
225195527Ssam#% kqfilter	vp	U U U
226195527Ssam#
227195379Ssamvop_kqfilter {
228195379Ssam	IN struct vnode *vp;
229195379Ssam	IN struct knote *kn;
230195379Ssam};
231195379Ssam
232195379Ssam#
233195379Ssam#% revoke	vp	U U U
234195379Ssam#
235195379Ssamvop_revoke {
236195379Ssam	IN struct vnode *vp;
237195379Ssam	IN int flags;
238};
239
240#
241#% fsync	vp	L L L
242#
243vop_fsync {
244	IN struct vnode *vp;
245	IN struct ucred *cred;
246	IN int waitfor;
247	IN struct thread *td;
248};
249
250#
251#% remove	dvp	L L L
252#% remove	vp	L L L
253#
254vop_remove {
255	IN struct vnode *dvp;
256	IN struct vnode *vp;
257	IN struct componentname *cnp;
258};
259
260#
261#% link		tdvp	L L L
262#% link		vp	U U U
263#
264vop_link {
265	IN struct vnode *tdvp;
266	IN struct vnode *vp;
267	IN struct componentname *cnp;
268};
269
270#
271# rename	fdvp	U U U
272# rename	fvp	U U U
273# rename	tdvp	L U U
274# rename	tvp	X U U
275#! rename	pre	vop_rename_pre
276#
277vop_rename {
278	IN WILLRELE struct vnode *fdvp;
279	IN WILLRELE struct vnode *fvp;
280	IN struct componentname *fcnp;
281	IN WILLRELE struct vnode *tdvp;
282	IN WILLRELE struct vnode *tvp;
283	IN struct componentname *tcnp;
284};
285
286#
287#% mkdir	dvp	L L L
288#% mkdir	vpp	- L -
289#
290vop_mkdir {
291	IN struct vnode *dvp;
292	OUT struct vnode **vpp;
293	IN struct componentname *cnp;
294	IN struct vattr *vap;
295};
296
297#
298#% rmdir	dvp	L L L
299#% rmdir	vp	L L L
300#
301vop_rmdir {
302	IN struct vnode *dvp;
303	IN struct vnode *vp;
304	IN struct componentname *cnp;
305};
306
307#
308#% symlink	dvp	L L L
309#% symlink	vpp	- L -
310#
311vop_symlink {
312	IN struct vnode *dvp;
313	OUT struct vnode **vpp;
314	IN struct componentname *cnp;
315	IN struct vattr *vap;
316	IN char *target;
317};
318
319#
320#% readdir	vp	L L L
321#
322vop_readdir {
323	IN struct vnode *vp;
324	INOUT struct uio *uio;
325	IN struct ucred *cred;
326	INOUT int *eofflag;
327	OUT int *ncookies;
328	INOUT u_long **cookies;
329};
330
331#
332#% readlink	vp	L L L
333#
334vop_readlink {
335	IN struct vnode *vp;
336	INOUT struct uio *uio;
337	IN struct ucred *cred;
338};
339
340#
341#% inactive	vp	L U U
342#
343vop_inactive {
344	IN struct vnode *vp;
345	IN struct thread *td;
346};
347
348#
349#% reclaim	vp	U U U
350#
351vop_reclaim {
352	IN struct vnode *vp;
353	IN struct thread *td;
354};
355
356#
357#% lock		vp	? ? ?
358#
359vop_lock {
360	IN struct vnode *vp;
361	IN int flags;
362	IN struct thread *td;
363};
364
365#
366#% unlock	vp	L U L
367#
368vop_unlock {
369	IN struct vnode *vp;
370	IN int flags;
371	IN struct thread *td;
372};
373
374#
375#% bmap		vp	L L L
376#% bmap		vpp	- U -
377#
378vop_bmap {
379	IN struct vnode *vp;
380	IN daddr_t bn;
381	OUT struct vnode **vpp;
382	IN daddr_t *bnp;
383	OUT int *runp;
384	OUT int *runb;
385};
386
387#
388# strategy	vp	L L L
389#! strategy	pre	vop_strategy_pre
390#
391vop_strategy {
392	IN struct vnode *vp;
393	IN struct buf *bp;
394};
395
396#
397#% getwritemount vp	= = =
398#
399vop_getwritemount {
400	IN struct vnode *vp;
401	OUT struct mount **mpp;
402};
403
404#
405#% print	vp	= = =
406#
407vop_print {
408	IN struct vnode *vp;
409};
410
411#
412#% pathconf	vp	L L L
413#
414vop_pathconf {
415	IN struct vnode *vp;
416	IN int name;
417	OUT register_t *retval;
418};
419
420#
421#% advlock	vp	U U U
422#
423vop_advlock {
424	IN struct vnode *vp;
425	IN caddr_t id;
426	IN int op;
427	IN struct flock *fl;
428	IN int flags;
429};
430
431#
432#% reallocblks	vp	L L L
433#
434vop_reallocblks {
435	IN struct vnode *vp;
436	IN struct cluster_save *buflist;
437};
438
439#
440#% getpages	vp	L L L
441#
442vop_getpages {
443	IN struct vnode *vp;
444	IN vm_page_t *m;
445	IN int count;
446	IN int reqpage;
447	IN vm_ooffset_t offset;
448};
449
450#
451#% putpages	vp	L L L
452#
453vop_putpages {
454	IN struct vnode *vp;
455	IN vm_page_t *m;
456	IN int count;
457	IN int sync;
458	IN int *rtvals;
459	IN vm_ooffset_t offset;
460};
461
462#
463#% freeblks	vp	- - -
464#
465# This call is used by the filesystem to release blocks back to 
466# device-driver.  This is useful if the driver has a lengthy 
467# erase handling or similar.
468#
469
470vop_freeblks {
471	IN struct vnode *vp;
472	IN daddr_t addr;
473	IN daddr_t length;
474};
475
476#
477#% getacl	vp	L L L
478#
479vop_getacl {
480	IN struct vnode *vp;
481	IN acl_type_t type;
482	OUT struct acl *aclp;
483	IN struct ucred *cred;
484	IN struct thread *td;
485};
486
487#
488#% setacl	vp	L L L
489#
490vop_setacl {
491	IN struct vnode *vp;
492	IN acl_type_t type;
493	IN struct acl *aclp;
494	IN struct ucred *cred;
495	IN struct thread *td;
496};
497
498#
499#% aclcheck	vp	= = =
500#
501vop_aclcheck {
502	IN struct vnode *vp;
503	IN acl_type_t type;
504	IN struct acl *aclp;
505	IN struct ucred *cred;
506	IN struct thread *td;
507};
508
509#
510#% getextattr	vp	L L L
511#
512vop_getextattr {
513	IN struct vnode *vp;
514	IN int attrnamespace;
515	IN const char *name;
516	INOUT struct uio *uio;
517	OUT size_t *size;
518	IN struct ucred *cred;
519	IN struct thread *td;
520};
521
522#
523#% setextattr	vp	L L L
524#
525vop_setextattr {
526	IN struct vnode *vp;
527	IN int attrnamespace;
528	IN const char *name;
529	INOUT struct uio *uio;
530	IN struct ucred *cred;
531	IN struct thread *td;
532};
533
534#
535#% createvobject	vp	L L L
536#
537vop_createvobject {
538	IN struct vnode *vp;
539	IN struct ucred *cred;
540	IN struct thread *td;
541};
542
543#
544#% destroyvobject	vp	L L L
545#
546vop_destroyvobject {
547	IN struct vnode *vp;
548};
549
550#
551#% getvobject	vp	L L L
552#
553vop_getvobject {
554	IN struct vnode *vp;
555	OUT struct vm_object **objpp;
556};
557