1#	$NetBSD: vnode_if.src,v 1.62 2011/07/11 08:23:00 hannken Exp $
2#
3# Copyright (c) 1992, 1993
4#	The Regents of the University of California.  All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14# 3. Neither the name of the University nor the names of its contributors
15#    may be used to endorse or promote products derived from this software
16#    without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30#	@(#)vnode_if.src	8.14 (Berkeley) 8/6/95
31#
32#
33
34# 
35# Above each of the vop descriptors is a specification of the locking
36# protocol used by each vop call.  The first column is the name of
37# the variable, the remaining three columns are in, out and error
38# respectively.  The "in" column defines the lock state on input,
39# the "out" column defines the state on successful return, and the
40# "error" column defines the locking state on error exit.
41#     
42# The locking value can take the following values:
43# L: locked.
44# U: unlocked.
45# -: not applicable.  vnode does not yet (or no longer) exists.
46# =: the same on input and output, may be either L or U.
47# X: locked if not nil.
48#
49# For operations other than VOP_LOOKUP which require a component name
50# parameter, the flags required for the initial namei() call are listed.
51# Additional flags may be added to the namei() call, but these are required.
52#     
53
54#
55#% bwrite     vp      = = =
56#
57vop_bwrite {
58	IN struct vnode *vp;
59	IN struct buf *bp;
60};
61 
62#
63#% lookup     dvp     L L L
64#% lookup     vpp     - L -
65#
66# XXX - the lookup locking protocol defies simple description.
67#    Note especially that *vpp may equal dvp.
68#
69#    More details:
70#     There are three types of lookups: ".", ".." (ISDOTDOT), and other.
71#     On successful lookup of ".", a reference is added to dvp, and it
72#          is returned in *vpp.
73#     To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and
74#          then dvp is relocked.  This preserves the protocol of always
75#          locking nodes from root ("/") downward and prevents deadlock.
76#     Other lookups find the named node (creating the vnode if needed) and
77#          return it, locked, in *vpp.
78#     On failure, *vpp is NULL, and *dvp is left locked.
79#	
80#     *vpp is always locked on return if the operation succeeds.
81#          Typically, if *vpp == dvp, you need to release twice, but
82#          unlock only once.
83#
84vop_lookup {
85	IN struct vnode *dvp;
86	OUT WILLMAKE struct vnode **vpp;
87	IN struct componentname *cnp;
88};
89
90#
91#% create     dvp     L U U
92#% create     vpp     - L -
93#
94#! create cnp	CREATE, LOCKPARENT
95#
96vop_create {
97	IN LOCKED=YES WILLPUT struct vnode *dvp;
98	OUT WILLMAKE struct vnode **vpp;
99	IN struct componentname *cnp;
100	IN struct vattr *vap;
101};
102
103#
104#% mknod      dvp     L U U
105#% mknod      vpp     - L -
106#
107#! mknod cnp	CREATE, LOCKPARENT
108#
109vop_mknod {
110	IN LOCKED=YES WILLPUT struct vnode *dvp;
111	OUT WILLMAKE struct vnode **vpp;
112	IN struct componentname *cnp;
113	IN struct vattr *vap;
114};
115
116#
117#% open               vp      L L L
118#
119vop_open {
120	IN LOCKED=YES struct vnode *vp;
121	IN int mode;
122	IN kauth_cred_t cred;
123};
124
125#
126#% close      vp      L L L
127#
128vop_close {
129	IN LOCKED=YES struct vnode *vp;
130	IN int fflag;
131	IN kauth_cred_t cred;
132};
133
134#
135#% access     vp      L L L
136#
137vop_access {
138	IN LOCKED=YES struct vnode *vp;
139	IN int mode;
140	IN kauth_cred_t cred;
141};
142
143#
144#% getattr    vp      L L L
145#
146vop_getattr {
147	IN struct vnode *vp;
148	IN struct vattr *vap;
149	IN kauth_cred_t cred;
150};
151
152#
153#% setattr    vp      L L L
154#
155vop_setattr {
156	IN LOCKED=YES struct vnode *vp;
157	IN struct vattr *vap;
158	IN kauth_cred_t cred;
159};
160
161#
162#% read               vp      L L L
163#
164vop_read {
165	IN LOCKED=YES struct vnode *vp;
166	INOUT struct uio *uio;
167	IN int ioflag;
168	IN kauth_cred_t cred;
169};
170
171#
172#% write      vp      L L L
173#
174vop_write {
175	IN LOCKED=YES struct vnode *vp;
176	INOUT struct uio *uio;
177	IN int ioflag;
178	IN kauth_cred_t cred;
179};
180
181#
182#% ioctl      vp      U U U
183#
184vop_ioctl {
185	IN LOCKED=NO struct vnode *vp;
186	IN u_long command;
187	IN void *data;
188	IN int fflag;
189	IN kauth_cred_t cred;
190};
191
192#
193#% fcntl      vp      U U U
194#
195vop_fcntl {
196	IN LOCKED=NO struct vnode *vp;
197	IN u_int command;
198	IN void *data;
199	IN int fflag;
200	IN kauth_cred_t cred;
201};
202
203#
204#% poll     vp      U U U
205#
206vop_poll {
207	IN LOCKED=NO struct vnode *vp;
208	IN int events;
209};
210
211#
212#% kqfilter     vp      U U U
213#
214vop_kqfilter {
215	IN LOCKED=NO struct vnode *vp;
216	IN struct knote *kn;
217};
218
219#
220#% revoke     vp      U U U
221#
222vop_revoke {
223	IN LOCKED=NO struct vnode *vp;
224	IN int flags;
225};
226
227#     
228#% mmap      vp      = = =
229#
230vop_mmap {
231	IN struct vnode *vp;
232	IN vm_prot_t prot;
233	IN kauth_cred_t cred;
234};
235
236#
237#% fsync      vp      L L L
238#
239vop_fsync {
240	IN LOCKED=YES struct vnode *vp;
241	IN kauth_cred_t cred;
242	IN int flags;
243	IN off_t offlo;
244	IN off_t offhi;
245};
246
247#
248# Needs work: Is newoff right?  What's it mean?
249# XXX Locking protocol?
250#
251vop_seek {
252	IN struct vnode *vp;
253	IN off_t oldoff;
254	IN off_t newoff;
255	IN kauth_cred_t cred;
256};
257
258#
259#% remove     dvp     L U U
260#% remove     vp      L U U
261#
262#! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
263#
264vop_remove {
265	IN LOCKED=YES WILLPUT struct vnode *dvp;
266	IN LOCKED=YES WILLPUT struct vnode *vp;
267	IN struct componentname *cnp;
268};
269
270#
271#% link               dvp     L U U
272#% link               vp      U U U
273#
274#! link	 cnp	CREATE, LOCKPARENT
275#
276vop_link {
277	IN LOCKED=YES WILLPUT struct vnode *dvp;
278	IN LOCKED=NO struct vnode *vp;
279	IN struct componentname *cnp;
280};
281
282#
283#% rename     fdvp    U U U
284#% rename     fvp     U U U
285#% rename     tdvp    L U U
286#% rename     tvp     X U U
287#
288#! rename fcnp	DELETE,	LOCKPARENT
289#! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
290#
291vop_rename {
292	IN LOCKED=NO WILLRELE struct vnode *fdvp;
293	IN LOCKED=NO WILLRELE struct vnode *fvp;
294	IN struct componentname *fcnp;
295	IN LOCKED=YES WILLPUT struct vnode *tdvp;
296	IN WILLPUT struct vnode *tvp;
297	IN struct componentname *tcnp;
298};
299
300#
301#% mkdir      dvp     L U U
302#% mkdir      vpp     - L - 
303#
304#! mkdir cnp	CREATE, LOCKPARENT
305#
306vop_mkdir {
307	IN LOCKED=YES WILLPUT struct vnode *dvp;
308	OUT WILLMAKE struct vnode **vpp;
309	IN struct componentname *cnp;
310	IN struct vattr *vap;
311};
312
313#
314#% rmdir      dvp     L U U
315#% rmdir      vp      L U U
316#
317#! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
318#
319vop_rmdir {
320	IN LOCKED=YES WILLPUT struct vnode *dvp;
321	IN LOCKED=YES WILLPUT struct vnode *vp;
322	IN struct componentname *cnp;
323};
324
325#
326#% symlink    dvp     L U U
327#% symlink    vpp     - L -
328#
329#! symlink cnp	CREATE, LOCKPARENT
330#
331vop_symlink {
332	IN LOCKED=YES WILLPUT struct vnode *dvp;
333	OUT WILLMAKE struct vnode **vpp;
334	IN struct componentname *cnp;
335	IN struct vattr *vap;
336	IN char *target;
337};
338
339#
340#% readdir    vp      L L L   
341#
342vop_readdir {
343	IN LOCKED=YES struct vnode *vp;
344	INOUT struct uio *uio;
345	IN kauth_cred_t cred;
346	OUT int *eofflag;
347	OUT off_t **cookies;
348	IN int *ncookies;
349};
350
351#
352#% readlink   vp      L L L
353#
354vop_readlink {
355	IN LOCKED=YES struct vnode *vp;
356	INOUT struct uio *uio;
357	IN kauth_cred_t cred;
358};
359
360#
361#% abortop    dvp     = = =
362#
363#! abortop cnp	as appropriate.
364#
365vop_abortop {
366	IN struct vnode *dvp;
367	IN struct componentname *cnp;
368};
369
370#
371#% inactive   vp      L U U  
372#
373vop_inactive {
374	IN LOCKED=YES WILLUNLOCK struct vnode *vp;
375	INOUT bool *recycle;
376};
377
378#
379#% reclaim    vp      U U U
380#
381vop_reclaim {
382	IN LOCKED=NO struct vnode *vp;
383};
384
385#
386#% lock               vp      U L U
387#
388vop_lock {
389	IN LOCKED=NO struct vnode *vp;
390	IN int flags;
391};
392
393#
394#% unlock     vp      L U L
395#
396vop_unlock {
397	IN LOCKED=YES struct vnode *vp;
398};
399
400#
401#% bmap               vp      = = =
402#% bmap               vpp     - U -
403#
404vop_bmap {
405	IN struct vnode *vp;
406	IN daddr_t bn;
407	OUT struct vnode **vpp;
408	IN daddr_t *bnp;
409	OUT int *runp;
410};
411
412#
413#% strategy   vp      = = =
414#
415vop_strategy {
416	IN struct vnode *vp;
417	IN struct buf *bp;
418};
419
420#
421#% print      vp      = = =
422#
423vop_print {
424	IN struct vnode *vp;
425};
426
427#
428#% islocked   vp      = = =
429#
430vop_islocked {
431	IN struct vnode *vp;
432};
433
434#
435#% pathconf   vp      L L L
436#
437vop_pathconf {
438	IN LOCKED=YES struct vnode *vp;
439	IN int name;
440	OUT register_t *retval;
441};
442
443#
444#% advlock    vp      U U U
445#
446vop_advlock {
447	IN LOCKED=NO struct vnode *vp;
448	IN void *id;
449	IN int op;
450	IN struct flock *fl;
451	IN int flags;
452};
453
454#
455#% whiteout   dvp     L L L
456#% whiteout   cnp     - - -
457#% whiteout   flag    - - -
458#
459#! whiteout cnp	CREATE, LOCKPARENT
460# 
461vop_whiteout {
462	IN LOCKED=YES struct vnode *dvp;
463	IN struct componentname *cnp;
464	IN int flags;
465};
466
467#
468#% getpages	vp = = =
469#
470vop_getpages {
471	IN struct vnode *vp;
472	IN voff_t offset;
473	IN struct vm_page **m;
474	IN int *count;
475	IN int centeridx;
476	IN vm_prot_t access_type;
477	IN int advice;
478	IN int flags;
479};
480
481#
482#% putpages	vp = = =
483#
484vop_putpages {
485	IN struct vnode *vp;
486	IN voff_t offlo;
487	IN voff_t offhi;
488	IN int flags;
489};
490
491#
492#% closeextattr	vp L L L
493#
494vop_closeextattr {
495	IN LOCKED=YES struct vnode *vp;
496	IN int commit;
497	IN kauth_cred_t cred;
498};
499
500#
501#% getextattr	vp L L L
502#
503vop_getextattr {
504	IN LOCKED=YES struct vnode *vp;
505	IN int attrnamespace;
506	IN const char *name;
507	INOUT struct uio *uio;
508	OUT size_t *size;
509	IN kauth_cred_t cred;
510};
511
512#
513#% listextattr	vp L L L
514#
515vop_listextattr {
516	IN LOCKED=YES struct vnode *vp;
517	IN int attrnamespace;
518	INOUT struct uio *uio;
519	OUT size_t *size;
520	IN int flag;
521	IN kauth_cred_t cred;
522};
523
524#
525#% openextattr	vp L L L
526#
527vop_openextattr {
528	IN LOCKED=YES struct vnode *vp;
529	IN kauth_cred_t cred;
530};
531
532#
533#% deleteextattr vp L L L
534#
535vop_deleteextattr {
536	IN LOCKED=YES struct vnode *vp;
537	IN int attrnamespace;
538	IN const char *name;
539	IN kauth_cred_t cred;
540};
541
542#
543#% setextattr	vp L L L
544#
545vop_setextattr {
546	IN LOCKED=YES struct vnode *vp;
547	IN int attrnamespace;
548	IN const char *name;
549	INOUT struct uio *uio;
550	IN kauth_cred_t cred;
551};
552