xref: /netbsd-src/sys/kern/vnode_if.src (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1#	$NetBSD: vnode_if.src,v 1.77 2017/07/12 09:31:07 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     - 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 LOCKED=YES 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 LOCKED=YES 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	FSTRANS=NO
196	IN LOCKED=NO struct vnode *vp;
197	IN u_long command;
198	IN void *data;
199	IN int fflag;
200	IN kauth_cred_t cred;
201};
202
203#
204#% fcntl      vp      U U U
205#
206vop_fcntl {
207	FSTRANS=NO
208	IN LOCKED=NO struct vnode *vp;
209	IN u_int command;
210	IN void *data;
211	IN int fflag;
212	IN kauth_cred_t cred;
213};
214
215#
216#% poll     vp      U U U
217#
218vop_poll {
219	IN LOCKED=NO struct vnode *vp;
220	IN int events;
221};
222
223#
224#% kqfilter     vp      U U U
225#
226vop_kqfilter {
227	IN LOCKED=NO struct vnode *vp;
228	IN struct knote *kn;
229};
230
231#
232#% revoke     vp      U U U
233#
234vop_revoke {
235	FSTRANS=NO
236	IN LOCKED=NO struct vnode *vp;
237	IN int flags;
238};
239
240#
241#% mmap      vp      = = =
242#
243vop_mmap {
244	IN struct vnode *vp;
245	IN vm_prot_t prot;
246	IN kauth_cred_t cred;
247};
248
249#
250#% fsync      vp      L L L
251#
252vop_fsync {
253	IN LOCKED=YES struct vnode *vp;
254	IN kauth_cred_t cred;
255	IN int flags;
256	IN off_t offlo;
257	IN off_t offhi;
258};
259
260#
261# Needs work: Is newoff right?  What's it mean?
262# XXX Locking protocol?
263#
264vop_seek {
265	IN struct vnode *vp;
266	IN off_t oldoff;
267	IN off_t newoff;
268	IN kauth_cred_t cred;
269};
270
271#
272#% remove     dvp     L L L
273#% remove     vp      L U U
274#
275#! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
276#
277vop_remove {
278	VERSION 2
279	IN LOCKED=YES struct vnode *dvp;
280	IN LOCKED=YES WILLPUT struct vnode *vp;
281	IN struct componentname *cnp;
282};
283
284#
285#% link               dvp     L L L
286#% link               vp      U U U
287#
288#! link	 cnp	CREATE, LOCKPARENT
289#
290vop_link {
291	VERSION 2
292	IN LOCKED=YES struct vnode *dvp;
293	IN LOCKED=NO struct vnode *vp;
294	IN struct componentname *cnp;
295};
296
297#
298#% rename     fdvp    U U U
299#% rename     fvp     U U U
300#% rename     tdvp    L U U
301#% rename     tvp     X U U
302#
303#! rename fcnp	DELETE,	LOCKPARENT
304#! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
305#
306vop_rename {
307	IN LOCKED=NO WILLRELE struct vnode *fdvp;
308	IN LOCKED=NO WILLRELE struct vnode *fvp;
309	IN struct componentname *fcnp;
310	IN LOCKED=YES WILLPUT struct vnode *tdvp;
311	IN WILLPUT struct vnode *tvp;
312	IN struct componentname *tcnp;
313};
314
315#
316#% mkdir      dvp     L L L
317#% mkdir      vpp     - U -
318#
319#! mkdir cnp	CREATE, LOCKPARENT
320#
321vop_mkdir {
322	VERSION 3
323	IN LOCKED=YES struct vnode *dvp;
324	OUT WILLMAKE struct vnode **vpp;
325	IN struct componentname *cnp;
326	IN struct vattr *vap;
327};
328
329#
330#% rmdir      dvp     L L L
331#% rmdir      vp      L U U
332#
333#! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
334#
335vop_rmdir {
336	VERSION 2
337	IN LOCKED=YES struct vnode *dvp;
338	IN LOCKED=YES WILLPUT struct vnode *vp;
339	IN struct componentname *cnp;
340};
341
342#
343#% symlink    dvp     L L L
344#% symlink    vpp     - U -
345#
346#! symlink cnp	CREATE, LOCKPARENT
347#
348vop_symlink {
349	VERSION 3
350	IN LOCKED=YES struct vnode *dvp;
351	OUT WILLMAKE struct vnode **vpp;
352	IN struct componentname *cnp;
353	IN struct vattr *vap;
354	IN char *target;
355};
356
357#
358#% readdir    vp      L L L
359#
360vop_readdir {
361	IN LOCKED=YES struct vnode *vp;
362	INOUT struct uio *uio;
363	IN kauth_cred_t cred;
364	OUT int *eofflag;
365	OUT off_t **cookies;
366	IN int *ncookies;
367};
368
369#
370#% readlink   vp      L L L
371#
372vop_readlink {
373	IN LOCKED=YES struct vnode *vp;
374	INOUT struct uio *uio;
375	IN kauth_cred_t cred;
376};
377
378#
379#% abortop    dvp     = = =
380#
381#! abortop cnp	as appropriate.
382#
383vop_abortop {
384	IN struct vnode *dvp;
385	IN struct componentname *cnp;
386};
387
388#
389#% inactive   vp      L L L
390#
391vop_inactive {
392	VERSION 2
393	IN LOCKED=YES struct vnode *vp;
394	INOUT bool *recycle;
395};
396
397#
398#% reclaim    vp      L U U
399#
400vop_reclaim {
401	VERSION 2
402	FSTRANS=NO
403	IN LOCKED=YES struct vnode *vp;
404};
405
406#
407#% lock               vp      U L U
408#
409vop_lock {
410	FSTRANS=LOCK
411	IN LOCKED=NO struct vnode *vp;
412	IN int flags;
413};
414
415#
416#% unlock     vp      L U L
417#
418vop_unlock {
419	FSTRANS=UNLOCK
420	IN LOCKED=YES struct vnode *vp;
421};
422
423#
424#% bmap               vp      = = =
425#% bmap               vpp     - U -
426#
427vop_bmap {
428	IN struct vnode *vp;
429	IN daddr_t bn;
430	OUT struct vnode **vpp;
431	IN daddr_t *bnp;
432	OUT int *runp;
433};
434
435#
436#% strategy   vp      = = =
437#
438vop_strategy {
439	IN struct vnode *vp;
440	IN struct buf *bp;
441};
442
443#
444#% print      vp      = = =
445#
446vop_print {
447	IN struct vnode *vp;
448};
449
450#
451#% islocked   vp      = = =
452#
453vop_islocked {
454	FSTRANS=NO
455	IN struct vnode *vp;
456};
457
458#
459#% pathconf   vp      L L L
460#
461vop_pathconf {
462	IN LOCKED=YES struct vnode *vp;
463	IN int name;
464	OUT register_t *retval;
465};
466
467#
468#% advlock    vp      U U U
469#
470vop_advlock {
471	FSTRANS=NO
472	IN LOCKED=NO struct vnode *vp;
473	IN void *id;
474	IN int op;
475	IN struct flock *fl;
476	IN int flags;
477};
478
479#
480#% whiteout   dvp     L L L
481#% whiteout   cnp     - - -
482#% whiteout   flag    - - -
483#
484#! whiteout cnp	CREATE, LOCKPARENT
485#
486vop_whiteout {
487	IN LOCKED=YES struct vnode *dvp;
488	IN struct componentname *cnp;
489	IN int flags;
490};
491
492#
493#% getpages	vp = = =
494#
495vop_getpages {
496	FSTRANS=NO
497	IN struct vnode *vp;
498	IN voff_t offset;
499	IN struct vm_page **m;
500	IN int *count;
501	IN int centeridx;
502	IN vm_prot_t access_type;
503	IN int advice;
504	IN int flags;
505};
506
507#
508#% putpages	vp = = =
509#
510vop_putpages {
511	FSTRANS=NO
512	IN struct vnode *vp;
513	IN voff_t offlo;
514	IN voff_t offhi;
515	IN int flags;
516};
517
518#
519#% closeextattr	vp L L L
520#
521vop_closeextattr {
522	IN LOCKED=YES struct vnode *vp;
523	IN int commit;
524	IN kauth_cred_t cred;
525};
526
527#
528#% getextattr	vp L L L
529#
530vop_getextattr {
531	IN LOCKED=YES struct vnode *vp;
532	IN int attrnamespace;
533	IN const char *name;
534	INOUT struct uio *uio;
535	OUT size_t *size;
536	IN kauth_cred_t cred;
537};
538
539#
540#% listextattr	vp L L L
541#
542vop_listextattr {
543	IN LOCKED=YES struct vnode *vp;
544	IN int attrnamespace;
545	INOUT struct uio *uio;
546	OUT size_t *size;
547	IN int flag;
548	IN kauth_cred_t cred;
549};
550
551#
552#% openextattr	vp L L L
553#
554vop_openextattr {
555	IN LOCKED=YES struct vnode *vp;
556	IN kauth_cred_t cred;
557};
558
559#
560#% deleteextattr vp L L L
561#
562vop_deleteextattr {
563	IN LOCKED=YES struct vnode *vp;
564	IN int attrnamespace;
565	IN const char *name;
566	IN kauth_cred_t cred;
567};
568
569#
570#% setextattr	vp L L L
571#
572vop_setextattr {
573	IN LOCKED=YES struct vnode *vp;
574	IN int attrnamespace;
575	IN const char *name;
576	INOUT struct uio *uio;
577	IN kauth_cred_t cred;
578};
579