vnode_if.src revision 76132
1149796Srwatson#
2149796Srwatson# Copyright (c) 1992, 1993
3149796Srwatson#	The Regents of the University of California.  All rights reserved.
4149796Srwatson#
5149796Srwatson# Redistribution and use in source and binary forms, with or without
6149796Srwatson# modification, are permitted provided that the following conditions
7149796Srwatson# are met:
8149796Srwatson# 1. Redistributions of source code must retain the above copyright
9149796Srwatson#    notice, this list of conditions and the following disclaimer.
10149796Srwatson# 2. Redistributions in binary form must reproduce the above copyright
11149796Srwatson#    notice, this list of conditions and the following disclaimer in the
12149796Srwatson#    documentation and/or other materials provided with the distribution.
13149796Srwatson# 3. All advertising materials mentioning features or use of this software
14149796Srwatson#    must display the following acknowledgement:
15149796Srwatson#	This product includes software developed by the University of
16149796Srwatson#	California, Berkeley and its contributors.
17149796Srwatson# 4. Neither the name of the University nor the names of its contributors
18149796Srwatson#    may be used to endorse or promote products derived from this software
19149796Srwatson#    without specific prior written permission.
20149796Srwatson#
21149796Srwatson# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22149796Srwatson# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23149796Srwatson# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24149796Srwatson# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25149796Srwatson# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26149796Srwatson# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27149796Srwatson# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28149796Srwatson# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29149796Srwatson# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30149796Srwatson# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31149796Srwatson# SUCH DAMAGE.
32149796Srwatson#
33149796Srwatson#	@(#)vnode_if.src	8.12 (Berkeley) 5/14/95
34149796Srwatson# $FreeBSD: head/sys/kern/vnode_if.src 76132 2001-04-29 12:36:52Z phk $
35149796Srwatson#
36149796Srwatson
37149796Srwatson#
38149796Srwatson# Above each of the vop descriptors is a specification of the locking
39149796Srwatson# protocol used by each vop call.  The first column is the name of
40149796Srwatson# the variable, the remaining three columns are in, out and error
41149796Srwatson# respectively.  The "in" column defines the lock state on input,
42149796Srwatson# the "out" column defines the state on succesful return, and the
43149796Srwatson# "error" column defines the locking state on error exit.
44149796Srwatson#
45149796Srwatson# The locking value can take the following values:
46149796Srwatson# L: locked; not converted to type of lock.
47149796Srwatson# A: any lock type.
48149796Srwatson# S: locked with shared lock.
49149796Srwatson# E: locked with exclusive lock for this process.
50149796Srwatson# O: locked with exclusive lock for other process.
51149796Srwatson# U: unlocked.
52149796Srwatson# -: not applicable.  vnode does not yet (or no longer) exists.
53149796Srwatson# =: the same on input and output, may be either L or U.
54149796Srwatson# X: locked if not nil.
55149796Srwatson#
56149796Srwatson
57149796Srwatson#
58149796Srwatson#% islocked	vp	= = =
59149796Srwatson#
60149796Srwatsonvop_islocked {
61149796Srwatson	IN struct vnode *vp;
62149796Srwatson	IN struct proc *p;
63149796Srwatson};
64149796Srwatson
65149796Srwatson#
66149796Srwatson#% lookup	dvp	L ? ?
67149796Srwatson#% lookup	vpp	- L -
68149796Srwatson#
69149796Srwatson# XXX - the lookup locking protocol defies simple description and depends
70149796Srwatson#	on the flags and operation fields in the (cnp) structure.  Note
71149796Srwatson#	especially that *vpp may equal dvp and both may be locked.
72149796Srwatson#
73149796Srwatsonvop_lookup {
74149796Srwatson	IN struct vnode *dvp;
75149796Srwatson	INOUT struct vnode **vpp;
76149796Srwatson	IN struct componentname *cnp;
77149796Srwatson};
78149796Srwatson
79149796Srwatson#
80149796Srwatson#% cachedlookup	dvp	L ? ?
81149796Srwatson#% cachedlookup	vpp	- L -
82149796Srwatson#
83149796Srwatson# This must be an exact copy of lookup.  See kern/vfs_cache.c for details.
84149796Srwatson#
85149796Srwatsonvop_cachedlookup {
86149796Srwatson	IN struct vnode *dvp;
87149796Srwatson	INOUT struct vnode **vpp;
88149796Srwatson	IN struct componentname *cnp;
89149796Srwatson};
90149796Srwatson
91149796Srwatson#
92149796Srwatson#% create	dvp	L L L
93149796Srwatson#% create	vpp	- L -
94149796Srwatson#
95149796Srwatsonvop_create {
96149796Srwatson	IN struct vnode *dvp;
97149796Srwatson	OUT struct vnode **vpp;
98149796Srwatson	IN struct componentname *cnp;
99149796Srwatson	IN struct vattr *vap;
100149796Srwatson};
101149796Srwatson
102149796Srwatson#
103149796Srwatson#% whiteout	dvp	L L L
104149796Srwatson#
105149796Srwatsonvop_whiteout {
106149796Srwatson	IN struct vnode *dvp;
107149796Srwatson	IN struct componentname *cnp;
108149796Srwatson	IN int flags;
109149796Srwatson};
110149796Srwatson
111149796Srwatson#
112149796Srwatson#% mknod	dvp	L L L
113149796Srwatson#% mknod	vpp	- X -
114149796Srwatson#
115149796Srwatsonvop_mknod {
116149796Srwatson	IN struct vnode *dvp;
117149796Srwatson	OUT struct vnode **vpp;
118149796Srwatson	IN struct componentname *cnp;
119149796Srwatson	IN struct vattr *vap;
120149796Srwatson};
121149796Srwatson
122149796Srwatson#
123149796Srwatson#% open		vp	L L L
124149796Srwatson#
125149796Srwatsonvop_open {
126149796Srwatson	IN struct vnode *vp;
127149796Srwatson	IN int mode;
128149796Srwatson	IN struct ucred *cred;
129149796Srwatson	IN struct proc *p;
130149796Srwatson};
131149796Srwatson
132149796Srwatson#
133149796Srwatson#% close	vp	U U U
134149796Srwatson#
135149796Srwatsonvop_close {
136149796Srwatson	IN struct vnode *vp;
137149796Srwatson	IN int fflag;
138149796Srwatson	IN struct ucred *cred;
139149796Srwatson	IN struct proc *p;
140149796Srwatson};
141149796Srwatson
142149796Srwatson#
143149796Srwatson#% access	vp	L L L
144149796Srwatson#
145149796Srwatsonvop_access {
146149796Srwatson	IN struct vnode *vp;
147149796Srwatson	IN int mode;
148149796Srwatson	IN struct ucred *cred;
149149796Srwatson	IN struct proc *p;
150149796Srwatson};
151149796Srwatson
152149796Srwatson#
153149796Srwatson#% getattr	vp	= = =
154149796Srwatson#
155149796Srwatsonvop_getattr {
156149796Srwatson	IN struct vnode *vp;
157149796Srwatson	OUT struct vattr *vap;
158149796Srwatson	IN struct ucred *cred;
159149796Srwatson	IN struct proc *p;
160149796Srwatson};
161149796Srwatson
162149796Srwatson#
163149796Srwatson#% setattr	vp	L L L
164149796Srwatson#
165149796Srwatsonvop_setattr {
166149796Srwatson	IN struct vnode *vp;
167149796Srwatson	IN struct vattr *vap;
168149796Srwatson	IN struct ucred *cred;
169149796Srwatson	IN struct proc *p;
170149796Srwatson};
171149796Srwatson
172149796Srwatson#
173149796Srwatson#% read		vp	L L L
174149796Srwatson#
175149796Srwatsonvop_read {
176149796Srwatson	IN struct vnode *vp;
177149796Srwatson	INOUT struct uio *uio;
178149796Srwatson	IN int ioflag;
179149796Srwatson	IN struct ucred *cred;
180149796Srwatson};
181149796Srwatson
182149796Srwatson#
183149796Srwatson#% write	vp	L L L
184149796Srwatson#
185149796Srwatsonvop_write {
186149796Srwatson	IN struct vnode *vp;
187149796Srwatson	INOUT struct uio *uio;
188149796Srwatson	IN int ioflag;
189149796Srwatson	IN struct ucred *cred;
190149796Srwatson};
191149796Srwatson
192149796Srwatson#
193149796Srwatson#% lease	vp	= = =
194149796Srwatson#
195149796Srwatsonvop_lease {
196149796Srwatson	IN struct vnode *vp;
197149796Srwatson	IN struct proc *p;
198149796Srwatson	IN struct ucred *cred;
199149796Srwatson	IN int flag;
200149796Srwatson};
201149796Srwatson
202149796Srwatson#
203149796Srwatson#% ioctl	vp	U U U
204149796Srwatson#
205149796Srwatsonvop_ioctl {
206149796Srwatson	IN struct vnode *vp;
207149796Srwatson	IN u_long command;
208149796Srwatson	IN caddr_t data;
209149796Srwatson	IN int fflag;
210149796Srwatson	IN struct ucred *cred;
211149796Srwatson	IN struct proc *p;
212149796Srwatson};
213149796Srwatson
214149796Srwatson#
215149796Srwatson#% poll	vp	U U U
216149796Srwatson#
217149796Srwatsonvop_poll {
218149796Srwatson	IN struct vnode *vp;
219149796Srwatson	IN int events;
220149796Srwatson	IN struct ucred *cred;
221149796Srwatson	IN struct proc *p;
222149796Srwatson};
223149796Srwatson
224149796Srwatson#
225149796Srwatson#% kqfilter	vp	U U U
226149796Srwatson#
227149796Srwatsonvop_kqfilter {
228149796Srwatson	IN struct vnode *vp;
229149796Srwatson	IN struct knote *kn;
230149796Srwatson};
231149796Srwatson
232149796Srwatson#
233149796Srwatson#% revoke	vp	U U U
234149796Srwatson#
235149796Srwatsonvop_revoke {
236149796Srwatson	IN struct vnode *vp;
237149796Srwatson	IN int flags;
238149796Srwatson};
239149796Srwatson
240149796Srwatson#
241149796Srwatson#% fsync	vp	L L L
242149796Srwatson#
243149796Srwatsonvop_fsync {
244149796Srwatson	IN struct vnode *vp;
245	IN struct ucred *cred;
246	IN int waitfor;
247	IN struct proc *p;
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#
276vop_rename {
277	IN WILLRELE struct vnode *fdvp;
278	IN WILLRELE struct vnode *fvp;
279	IN struct componentname *fcnp;
280	IN WILLRELE struct vnode *tdvp;
281	IN WILLRELE struct vnode *tvp;
282	IN struct componentname *tcnp;
283};
284
285#
286#% mkdir	dvp	L L L
287#% mkdir	vpp	- L -
288#
289vop_mkdir {
290	IN struct vnode *dvp;
291	OUT struct vnode **vpp;
292	IN struct componentname *cnp;
293	IN struct vattr *vap;
294};
295
296#
297#% rmdir	dvp	L L L
298#% rmdir	vp	L L L
299#
300vop_rmdir {
301	IN struct vnode *dvp;
302	IN struct vnode *vp;
303	IN struct componentname *cnp;
304};
305
306#
307#% symlink	dvp	L L L
308#% symlink	vpp	- U -
309#
310vop_symlink {
311	IN struct vnode *dvp;
312	OUT struct vnode **vpp;
313	IN struct componentname *cnp;
314	IN struct vattr *vap;
315	IN char *target;
316};
317
318#
319#% readdir	vp	L L L
320#
321vop_readdir {
322	IN struct vnode *vp;
323	INOUT struct uio *uio;
324	IN struct ucred *cred;
325	INOUT int *eofflag;
326	OUT int *ncookies;
327	INOUT u_long **cookies;
328};
329
330#
331#% readlink	vp	L L L
332#
333vop_readlink {
334	IN struct vnode *vp;
335	INOUT struct uio *uio;
336	IN struct ucred *cred;
337};
338
339#
340#% inactive	vp	L U U
341#
342vop_inactive {
343	IN struct vnode *vp;
344	IN struct proc *p;
345};
346
347#
348#% reclaim	vp	U U U
349#
350vop_reclaim {
351	IN struct vnode *vp;
352	IN struct proc *p;
353};
354
355#
356#% lock		vp	? ? ?
357#
358vop_lock {
359	IN struct vnode *vp;
360	IN int flags;
361	IN struct proc *p;
362};
363
364#
365#% unlock	vp	L U L
366#
367vop_unlock {
368	IN struct vnode *vp;
369	IN int flags;
370	IN struct proc *p;
371};
372
373#
374#% bmap		vp	L L L
375#% bmap		vpp	- U -
376#
377vop_bmap {
378	IN struct vnode *vp;
379	IN daddr_t bn;
380	OUT struct vnode **vpp;
381	IN daddr_t *bnp;
382	OUT int *runp;
383	OUT int *runb;
384};
385
386#
387#% strategy	vp	L L L
388#
389vop_strategy {
390	IN struct vnode *vp;
391	IN struct buf *bp;
392};
393
394#
395#% getwritemount vp	= = =
396#
397vop_getwritemount {
398	IN struct vnode *vp;
399	OUT struct mount **mpp;
400};
401
402#
403#% print	vp	= = =
404#
405vop_print {
406	IN struct vnode *vp;
407};
408
409#
410#% pathconf	vp	L L L
411#
412vop_pathconf {
413	IN struct vnode *vp;
414	IN int name;
415	OUT register_t *retval;
416};
417
418#
419#% advlock	vp	U U U
420#
421vop_advlock {
422	IN struct vnode *vp;
423	IN caddr_t id;
424	IN int op;
425	IN struct flock *fl;
426	IN int flags;
427};
428
429#
430#% reallocblks	vp	L L L
431#
432vop_reallocblks {
433	IN struct vnode *vp;
434	IN struct cluster_save *buflist;
435};
436
437#
438#% getpages	vp	L L L
439#
440vop_getpages {
441	IN struct vnode *vp;
442	IN vm_page_t *m;
443	IN int count;
444	IN int reqpage;
445	IN vm_ooffset_t offset;
446};
447
448#
449#% putpages	vp	L L L
450#
451vop_putpages {
452	IN struct vnode *vp;
453	IN vm_page_t *m;
454	IN int count;
455	IN int sync;
456	IN int *rtvals;
457	IN vm_ooffset_t offset;
458};
459
460#
461#% freeblks	vp	- - -
462#
463# This call is used by the filesystem to release blocks back to 
464# device-driver.  This is useful if the driver has a lengthy 
465# erase handling or similar.
466#
467
468vop_freeblks {
469	IN struct vnode *vp;
470	IN daddr_t addr;
471	IN daddr_t length;
472};
473
474#
475#% getacl	vp	L L L
476#
477vop_getacl {
478	IN struct vnode *vp;
479	IN acl_type_t type;
480	OUT struct acl *aclp;
481	IN struct ucred *cred;
482	IN struct proc *p;
483};
484
485#
486#% setacl	vp	L L L
487#
488vop_setacl {
489	IN struct vnode *vp;
490	IN acl_type_t type;
491	IN struct acl *aclp;
492	IN struct ucred *cred;
493	IN struct proc *p;
494};
495
496#
497#% aclcheck	vp	= = =
498#
499vop_aclcheck {
500	IN struct vnode *vp;
501	IN acl_type_t type;
502	IN struct acl *aclp;
503	IN struct ucred *cred;
504	IN struct proc *p;
505};
506
507#
508#% getextattr	vp	L L L
509#
510vop_getextattr {
511	IN struct vnode *vp;
512	IN int attrnamespace;
513	IN const char *name;
514	INOUT struct uio *uio;
515	IN struct ucred *cred;
516	IN struct proc *p;
517};
518
519#
520#% setextattr	vp	L L L
521#
522vop_setextattr {
523	IN struct vnode *vp;
524	IN int attrnamespace;
525	IN const char *name;
526	INOUT struct uio *uio;
527	IN struct ucred *cred;
528	IN struct proc *p;
529};
530
531#
532#% createvobject	vp	L L L
533#
534vop_createvobject {
535	IN struct vnode *vp;
536	IN struct ucred *cred;
537	IN struct proc *p;
538};
539
540#
541#% destroyvobject	vp	L L L
542#
543vop_destroyvobject {
544	IN struct vnode *vp;
545};
546
547#
548#% getvobject	vp	L L L
549#
550vop_getvobject {
551	IN struct vnode *vp;
552	OUT struct vm_object **objpp;
553};
554