xref: /netbsd-src/sys/kern/vnode_if.src (revision f89f6560d453f5e37386cc7938c072d2f528b9fa)
1#	$NetBSD: vnode_if.src,v 1.67 2014/07/25 08:16:47 dholland 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     - U -
65#
66#    Note especially that *vpp may equal dvp.
67#
68#    More details:
69#     All lookups find the named node (creating the vnode if needed) and
70#          return it, referenced and unlocked, in *vpp.
71#     On failure, *vpp is NULL, and *dvp is left locked.
72#
73vop_lookup {
74	VERSION 2
75	IN struct vnode *dvp;
76	OUT WILLMAKE struct vnode **vpp;
77	IN struct componentname *cnp;
78};
79
80#
81#% create     dvp     L L L
82#% create     vpp     - U -
83#
84#! create cnp	CREATE, LOCKPARENT
85#
86vop_create {
87	VERSION 3
88	IN LOCKED=YES struct vnode *dvp;
89	OUT WILLMAKE struct vnode **vpp;
90	IN struct componentname *cnp;
91	IN struct vattr *vap;
92};
93
94#
95#% mknod      dvp     L L L
96#% mknod      vpp     - U -
97#
98#! mknod cnp	CREATE, LOCKPARENT
99#
100vop_mknod {
101	VERSION 3
102	IN LOCKED=YES struct vnode *dvp;
103	OUT WILLMAKE struct vnode **vpp;
104	IN struct componentname *cnp;
105	IN struct vattr *vap;
106};
107
108#
109#% open               vp      L L L
110#
111vop_open {
112	IN LOCKED=YES struct vnode *vp;
113	IN int mode;
114	IN kauth_cred_t cred;
115};
116
117#
118#% close      vp      L L L
119#
120vop_close {
121	IN LOCKED=YES struct vnode *vp;
122	IN int fflag;
123	IN kauth_cred_t cred;
124};
125
126#
127#% access     vp      L L L
128#
129vop_access {
130	IN LOCKED=YES struct vnode *vp;
131	IN int mode;
132	IN kauth_cred_t cred;
133};
134
135#
136#% getattr    vp      L L L
137#
138vop_getattr {
139	IN struct vnode *vp;
140	IN struct vattr *vap;
141	IN kauth_cred_t cred;
142};
143
144#
145#% setattr    vp      L L L
146#
147vop_setattr {
148	IN LOCKED=YES struct vnode *vp;
149	IN struct vattr *vap;
150	IN kauth_cred_t cred;
151};
152
153#
154#% read               vp      L L L
155#
156vop_read {
157	IN LOCKED=YES struct vnode *vp;
158	INOUT struct uio *uio;
159	IN int ioflag;
160	IN kauth_cred_t cred;
161};
162
163#
164#% write      vp      L L L
165#
166vop_write {
167	IN LOCKED=YES struct vnode *vp;
168	INOUT struct uio *uio;
169	IN int ioflag;
170	IN kauth_cred_t cred;
171};
172
173#
174#% fallocate  vp      L L L
175#
176vop_fallocate {
177	IN LOCKED=YES struct vnode *vp;
178	IN off_t pos;
179	IN off_t len;
180};
181
182#
183#% fdiscard   vp      L L L
184#
185vop_fdiscard {
186	IN LOCKED=YES struct vnode *vp;
187	IN off_t pos;
188	IN off_t len;
189};
190
191#
192#% ioctl      vp      U U U
193#
194vop_ioctl {
195	IN LOCKED=NO struct vnode *vp;
196	IN u_long command;
197	IN void *data;
198	IN int fflag;
199	IN kauth_cred_t cred;
200};
201
202#
203#% fcntl      vp      U U U
204#
205vop_fcntl {
206	IN LOCKED=NO struct vnode *vp;
207	IN u_int command;
208	IN void *data;
209	IN int fflag;
210	IN kauth_cred_t cred;
211};
212
213#
214#% poll     vp      U U U
215#
216vop_poll {
217	IN LOCKED=NO struct vnode *vp;
218	IN int events;
219};
220
221#
222#% kqfilter     vp      U U U
223#
224vop_kqfilter {
225	IN LOCKED=NO struct vnode *vp;
226	IN struct knote *kn;
227};
228
229#
230#% revoke     vp      U U U
231#
232vop_revoke {
233	IN LOCKED=NO struct vnode *vp;
234	IN int flags;
235};
236
237#
238#% mmap      vp      = = =
239#
240vop_mmap {
241	IN struct vnode *vp;
242	IN vm_prot_t prot;
243	IN kauth_cred_t cred;
244};
245
246#
247#% fsync      vp      L L L
248#
249vop_fsync {
250	IN LOCKED=YES struct vnode *vp;
251	IN kauth_cred_t cred;
252	IN int flags;
253	IN off_t offlo;
254	IN off_t offhi;
255};
256
257#
258# Needs work: Is newoff right?  What's it mean?
259# XXX Locking protocol?
260#
261vop_seek {
262	IN struct vnode *vp;
263	IN off_t oldoff;
264	IN off_t newoff;
265	IN kauth_cred_t cred;
266};
267
268#
269#% remove     dvp     L U U
270#% remove     vp      L U U
271#
272#! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
273#
274vop_remove {
275	IN LOCKED=YES WILLPUT struct vnode *dvp;
276	IN LOCKED=YES WILLPUT struct vnode *vp;
277	IN struct componentname *cnp;
278};
279
280#
281#% link               dvp     L U U
282#% link               vp      U U U
283#
284#! link	 cnp	CREATE, LOCKPARENT
285#
286vop_link {
287	IN LOCKED=YES WILLPUT struct vnode *dvp;
288	IN LOCKED=NO struct vnode *vp;
289	IN struct componentname *cnp;
290};
291
292#
293#% rename     fdvp    U U U
294#% rename     fvp     U U U
295#% rename     tdvp    L U U
296#% rename     tvp     X U U
297#
298#! rename fcnp	DELETE,	LOCKPARENT
299#! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
300#
301vop_rename {
302	IN LOCKED=NO WILLRELE struct vnode *fdvp;
303	IN LOCKED=NO WILLRELE struct vnode *fvp;
304	IN struct componentname *fcnp;
305	IN LOCKED=YES WILLPUT struct vnode *tdvp;
306	IN WILLPUT struct vnode *tvp;
307	IN struct componentname *tcnp;
308};
309
310#
311#% mkdir      dvp     L L L
312#% mkdir      vpp     - U -
313#
314#! mkdir cnp	CREATE, LOCKPARENT
315#
316vop_mkdir {
317	VERSION 3
318	IN LOCKED=YES struct vnode *dvp;
319	OUT WILLMAKE struct vnode **vpp;
320	IN struct componentname *cnp;
321	IN struct vattr *vap;
322};
323
324#
325#% rmdir      dvp     L U U
326#% rmdir      vp      L U U
327#
328#! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
329#
330vop_rmdir {
331	IN LOCKED=YES WILLPUT struct vnode *dvp;
332	IN LOCKED=YES WILLPUT struct vnode *vp;
333	IN struct componentname *cnp;
334};
335
336#
337#% symlink    dvp     L L L
338#% symlink    vpp     - U -
339#
340#! symlink cnp	CREATE, LOCKPARENT
341#
342vop_symlink {
343	VERSION 3
344	IN LOCKED=YES struct vnode *dvp;
345	OUT WILLMAKE struct vnode **vpp;
346	IN struct componentname *cnp;
347	IN struct vattr *vap;
348	IN char *target;
349};
350
351#
352#% readdir    vp      L L L
353#
354vop_readdir {
355	IN LOCKED=YES struct vnode *vp;
356	INOUT struct uio *uio;
357	IN kauth_cred_t cred;
358	OUT int *eofflag;
359	OUT off_t **cookies;
360	IN int *ncookies;
361};
362
363#
364#% readlink   vp      L L L
365#
366vop_readlink {
367	IN LOCKED=YES struct vnode *vp;
368	INOUT struct uio *uio;
369	IN kauth_cred_t cred;
370};
371
372#
373#% abortop    dvp     = = =
374#
375#! abortop cnp	as appropriate.
376#
377vop_abortop {
378	IN struct vnode *dvp;
379	IN struct componentname *cnp;
380};
381
382#
383#% inactive   vp      L U U
384#
385vop_inactive {
386	IN LOCKED=YES WILLUNLOCK struct vnode *vp;
387	INOUT bool *recycle;
388};
389
390#
391#% reclaim    vp      U U U
392#
393vop_reclaim {
394	IN LOCKED=NO struct vnode *vp;
395};
396
397#
398#% lock               vp      U L U
399#
400vop_lock {
401	IN LOCKED=NO struct vnode *vp;
402	IN int flags;
403};
404
405#
406#% unlock     vp      L U L
407#
408vop_unlock {
409	IN LOCKED=YES struct vnode *vp;
410};
411
412#
413#% bmap               vp      = = =
414#% bmap               vpp     - U -
415#
416vop_bmap {
417	IN struct vnode *vp;
418	IN daddr_t bn;
419	OUT struct vnode **vpp;
420	IN daddr_t *bnp;
421	OUT int *runp;
422};
423
424#
425#% strategy   vp      = = =
426#
427vop_strategy {
428	IN struct vnode *vp;
429	IN struct buf *bp;
430};
431
432#
433#% print      vp      = = =
434#
435vop_print {
436	IN struct vnode *vp;
437};
438
439#
440#% islocked   vp      = = =
441#
442vop_islocked {
443	IN struct vnode *vp;
444};
445
446#
447#% pathconf   vp      L L L
448#
449vop_pathconf {
450	IN LOCKED=YES struct vnode *vp;
451	IN int name;
452	OUT register_t *retval;
453};
454
455#
456#% advlock    vp      U U U
457#
458vop_advlock {
459	IN LOCKED=NO struct vnode *vp;
460	IN void *id;
461	IN int op;
462	IN struct flock *fl;
463	IN int flags;
464};
465
466#
467#% whiteout   dvp     L L L
468#% whiteout   cnp     - - -
469#% whiteout   flag    - - -
470#
471#! whiteout cnp	CREATE, LOCKPARENT
472#
473vop_whiteout {
474	IN LOCKED=YES struct vnode *dvp;
475	IN struct componentname *cnp;
476	IN int flags;
477};
478
479#
480#% getpages	vp = = =
481#
482vop_getpages {
483	IN struct vnode *vp;
484	IN voff_t offset;
485	IN struct vm_page **m;
486	IN int *count;
487	IN int centeridx;
488	IN vm_prot_t access_type;
489	IN int advice;
490	IN int flags;
491};
492
493#
494#% putpages	vp = = =
495#
496vop_putpages {
497	IN struct vnode *vp;
498	IN voff_t offlo;
499	IN voff_t offhi;
500	IN int flags;
501};
502
503#
504#% closeextattr	vp L L L
505#
506vop_closeextattr {
507	IN LOCKED=YES struct vnode *vp;
508	IN int commit;
509	IN kauth_cred_t cred;
510};
511
512#
513#% getextattr	vp L L L
514#
515vop_getextattr {
516	IN LOCKED=YES struct vnode *vp;
517	IN int attrnamespace;
518	IN const char *name;
519	INOUT struct uio *uio;
520	OUT size_t *size;
521	IN kauth_cred_t cred;
522};
523
524#
525#% listextattr	vp L L L
526#
527vop_listextattr {
528	IN LOCKED=YES struct vnode *vp;
529	IN int attrnamespace;
530	INOUT struct uio *uio;
531	OUT size_t *size;
532	IN int flag;
533	IN kauth_cred_t cred;
534};
535
536#
537#% openextattr	vp L L L
538#
539vop_openextattr {
540	IN LOCKED=YES struct vnode *vp;
541	IN kauth_cred_t cred;
542};
543
544#
545#% deleteextattr vp L L L
546#
547vop_deleteextattr {
548	IN LOCKED=YES struct vnode *vp;
549	IN int attrnamespace;
550	IN const char *name;
551	IN kauth_cred_t cred;
552};
553
554#
555#% setextattr	vp L L L
556#
557vop_setextattr {
558	IN LOCKED=YES struct vnode *vp;
559	IN int attrnamespace;
560	IN const char *name;
561	INOUT struct uio *uio;
562	IN kauth_cred_t cred;
563};
564