xref: /netbsd-src/sys/kern/vnode_if.src (revision bada23909e740596d0a3785a73bd3583a9807fb8)
1#	$NetBSD: vnode_if.src,v 1.16 1999/03/22 16:57:37 sommerfe 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. All advertising materials mentioning features or use of this software
15#    must display the following acknowledgement:
16#	This product includes software developed by the University of
17#	California, Berkeley and its contributors.
18# 4. Neither the name of the University nor the names of its contributors
19#    may be used to endorse or promote products derived from this software
20#    without specific prior written permission.
21#
22# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25# ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32# SUCH DAMAGE.
33#
34#	@(#)vnode_if.src	8.14 (Berkeley) 8/6/95
35#
36#
37
38#
39# Above each of the vop descriptors is a specification of the locking
40# protocol used by each vop call.  The first column is the name of
41# the variable, the remaining three columns are in, out and error
42# respectively.  The "in" column defines the lock state on input,
43# the "out" column defines the state on succesful return, and the
44# "error" column defines the locking state on error exit.
45#
46# The locking value can take the following values:
47# L: locked.
48# U: unlocked/
49# -: not applicable.  vnode does not yet (or no longer) exists.
50# =: the same on input and output, may be either L or U.
51# X: locked if not nil.
52#
53
54#
55#% lookup     dvp     L ? ?
56#% lookup     vpp     - L -
57#
58# XXX - the lookup locking protocol defies simple description and depends
59#     on the flags and operation fields in the (cnp) structure.  Note
60#     especially that *vpp may equal dvp and both may be locked.
61#
62#    More details:
63#     On success, adds a reference to *vpp so it doesn't evaporate.
64#     If LOCKPARENT is set in cnp, dvp is returned locked even on failure.
65#     otherwise it is unlocked (unless *vpp == dvp on return)
66#
67#     *vpp is always locked on return if the operation succeeds.
68#     typically, if *vpp == dvp, you need to release twice, but unlock once.
69#
70#     If ISDOTDOT is set, dvp is unlocked before *vpp is
71#     locked; dvp is then relocked.  this is done to avoid deadlocking
72#     another process concurrently scanning downwards.
73#
74vop_lookup {
75	IN struct vnode *dvp;
76	INOUT struct vnode **vpp;
77	IN struct componentname *cnp;
78};
79
80#
81#% create     dvp     L U U
82#% create     vpp     - L -
83#
84vop_create {
85	IN WILLRELE struct vnode *dvp;
86	OUT struct vnode **vpp;
87	IN struct componentname *cnp;
88	IN struct vattr *vap;
89};
90
91#
92#% mknod      dvp     L U U
93#% mknod      vpp     - X -
94#
95vop_mknod {
96	IN WILLRELE struct vnode *dvp;
97	OUT WILLRELE struct vnode **vpp;
98	IN struct componentname *cnp;
99	IN struct vattr *vap;
100};
101
102#
103#% open               vp      L L L
104#
105vop_open {
106	IN struct vnode *vp;
107	IN int mode;
108	IN struct ucred *cred;
109	IN struct proc *p;
110};
111
112#
113#% close      vp      L L L
114#
115vop_close {
116	IN struct vnode *vp;
117	IN int fflag;
118	IN struct ucred *cred;
119	IN struct proc *p;
120};
121
122#
123#% access     vp      L L L
124#
125vop_access {
126	IN struct vnode *vp;
127	IN int mode;
128	IN struct ucred *cred;
129	IN struct proc *p;
130};
131
132#
133#% getattr    vp      = = =
134#
135vop_getattr {
136	IN struct vnode *vp;
137	IN struct vattr *vap;
138	IN struct ucred *cred;
139	IN struct proc *p;
140};
141
142#
143#% setattr    vp      L L L
144#
145vop_setattr {
146	IN struct vnode *vp;
147	IN struct vattr *vap;
148	IN struct ucred *cred;
149	IN struct proc *p;
150};
151
152#
153#% read               vp      L L L
154#
155vop_read {
156	IN struct vnode *vp;
157	INOUT struct uio *uio;
158	IN int ioflag;
159	IN struct ucred *cred;
160};
161
162#
163#% write      vp      L L L
164#
165vop_write {
166	IN struct vnode *vp;
167	INOUT struct uio *uio;
168	IN int ioflag;
169	IN struct ucred *cred;
170};
171
172#
173#% ioctl      vp      U U U
174#
175vop_ioctl {
176	IN struct vnode *vp;
177	IN u_long command;
178	IN caddr_t data;
179	IN int fflag;
180	IN struct ucred *cred;
181	IN struct proc *p;
182};
183
184#
185#% poll     vp      U U U
186#
187vop_poll {
188	IN struct vnode *vp;
189	IN int events;
190	IN struct proc *p;
191};
192
193#
194#% revoke     vp      U U U
195#
196vop_revoke {
197	IN struct vnode *vp;
198	IN int flags;
199};
200
201#
202# XXX - not used
203#
204vop_mmap {
205	IN struct vnode *vp;
206	IN int fflags;
207	IN struct ucred *cred;
208	IN struct proc *p;
209};
210
211#
212#% fsync      vp      L L L
213#
214vop_fsync {
215	IN struct vnode *vp;
216	IN struct ucred *cred;
217	IN int flags;
218	IN struct proc *p;
219};
220
221#
222# Needs work: Is newoff right?  What's it mean?
223#
224vop_seek {
225	IN struct vnode *vp;
226	IN off_t oldoff;
227	IN off_t newoff;
228	IN struct ucred *cred;
229};
230
231#
232#% remove     dvp     L U U
233#% remove     vp      L U U
234#
235vop_remove {
236	IN WILLRELE struct vnode *dvp;
237	IN WILLRELE struct vnode *vp;
238	IN struct componentname *cnp;
239};
240
241#
242#% link               vp      U U U
243#% link               tdvp    L U U
244#
245vop_link {
246	IN WILLRELE struct vnode *dvp;
247	IN struct vnode *vp;
248	IN struct componentname *cnp;
249};
250
251#
252#% rename     fdvp    U U U
253#% rename     fvp     U U U
254#% rename     tdvp    L U U
255#% rename     tvp     X U U
256#
257vop_rename {
258	IN WILLRELE struct vnode *fdvp;
259	IN WILLRELE struct vnode *fvp;
260	IN struct componentname *fcnp;
261	IN WILLRELE struct vnode *tdvp;
262	IN WILLRELE struct vnode *tvp;
263	IN struct componentname *tcnp;
264};
265
266#
267#% mkdir      dvp     L U U
268#% mkdir      vpp     - L -
269#
270vop_mkdir {
271	IN WILLRELE struct vnode *dvp;
272	OUT struct vnode **vpp;
273	IN struct componentname *cnp;
274	IN struct vattr *vap;
275};
276
277#
278#% rmdir      dvp     L U U
279#% rmdir      vp      L U U
280#
281vop_rmdir {
282	IN WILLRELE struct vnode *dvp;
283	IN WILLRELE struct vnode *vp;
284	IN struct componentname *cnp;
285};
286
287#
288#% symlink    dvp     L U U
289#% symlink    vpp     - U -
290#
291# XXX - note that the return vnode has already been VRELE'ed
292#     by the filesystem layer.  To use it you must use vget,
293#     possibly with a further namei.
294#
295vop_symlink {
296	IN WILLRELE struct vnode *dvp;
297	OUT WILLRELE struct vnode **vpp;
298	IN struct componentname *cnp;
299	IN struct vattr *vap;
300	IN char *target;
301};
302
303#
304#% readdir    vp      L L L
305#
306vop_readdir {
307	IN struct vnode *vp;
308	INOUT struct uio *uio;
309	IN struct ucred *cred;
310	OUT int *eofflag;
311	OUT off_t **cookies;
312	IN int *ncookies;
313};
314
315#
316#% readlink   vp      L L L
317#
318vop_readlink {
319	IN struct vnode *vp;
320	INOUT struct uio *uio;
321	IN struct ucred *cred;
322};
323
324#
325#% abortop    dvp     = = =
326#
327vop_abortop {
328	IN struct vnode *dvp;
329	IN struct componentname *cnp;
330};
331
332#
333#% inactive   vp      L U U
334#
335vop_inactive {
336	IN struct vnode *vp;
337	IN struct proc *p;
338};
339
340#
341#% reclaim    vp      U U U
342#
343vop_reclaim {
344	IN struct vnode *vp;
345	IN struct proc *p;
346};
347
348#
349#% lock               vp      U L U
350#
351vop_lock {
352	IN struct vnode *vp;
353	IN int flags;
354};
355
356#
357#% unlock     vp      L U L
358#
359vop_unlock {
360	IN struct vnode *vp;
361	IN int flags;
362};
363
364#
365#% bmap               vp      L L L
366#% bmap               vpp     - U -
367#
368vop_bmap {
369	IN struct vnode *vp;
370	IN daddr_t bn;
371	OUT struct vnode **vpp;
372	IN daddr_t *bnp;
373	OUT int *runp;
374};
375
376#
377# Needs work: no vp?
378#
379#vop_strategy {
380#	IN struct buf *bp;
381#};
382
383#
384#% print      vp      = = =
385#
386vop_print {
387	IN struct vnode *vp;
388};
389
390#
391#% islocked   vp      = = =
392#
393vop_islocked {
394	IN struct vnode *vp;
395};
396
397#
398#% pathconf   vp      L L L
399#
400vop_pathconf {
401	IN struct vnode *vp;
402	IN int name;
403	OUT register_t *retval;
404};
405
406#
407#% advlock    vp      U U U
408#
409vop_advlock {
410	IN struct vnode *vp;
411	IN caddr_t id;
412	IN int op;
413	IN struct flock *fl;
414	IN int flags;
415};
416
417#
418#% blkatoff   vp      L L L
419#
420vop_blkatoff {
421	IN struct vnode *vp;
422	IN off_t offset;
423	OUT char **res;
424	OUT struct buf **bpp;
425};
426
427#
428#% valloc     pvp     L L L
429#
430vop_valloc {
431	IN struct vnode *pvp;
432	IN int mode;
433	IN struct ucred *cred;
434	OUT struct vnode **vpp;
435};
436
437#
438#% reallocblks        vp      L L L
439#
440vop_reallocblks {
441	IN struct vnode *vp;
442	IN struct cluster_save *buflist;
443};
444
445#
446#% vfree      pvp     L L L
447#
448vop_vfree {
449	IN struct vnode *pvp;
450	IN ino_t ino;
451	IN int mode;
452};
453
454#
455#% truncate   vp      L L L
456#
457vop_truncate {
458	IN struct vnode *vp;
459	IN off_t length;
460	IN int flags;
461	IN struct ucred *cred;
462	IN struct proc *p;
463};
464
465#
466#% update     vp      L L L
467#
468vop_update {
469	IN struct vnode *vp;
470	IN struct timespec *access;
471	IN struct timespec *modify;
472	IN int waitfor;
473};
474
475#
476#% lease      vp      = = =
477#
478vop_lease {
479	IN struct vnode *vp;
480	IN struct proc *p;
481	IN struct ucred *cred;
482	IN int flag;
483};
484
485#
486#% whiteout   dvp     L L L
487#% whiteout   cnp     - - -
488#% whiteout   flag    - - -
489#
490vop_whiteout {
491	IN struct vnode *dvp;
492	IN struct componentname *cnp;
493	IN int flags;
494};
495
496#
497# Needs work: no vp?
498#
499#vop_bwrite {
500#	IN struct buf *bp;
501#};
502