vnode_if.src revision 1.20 1 # $NetBSD: vnode_if.src,v 1.20 1999/08/11 00:20:50 wrstuden 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 # There are three types of lookups: ".", ".." (ISDOTDOT), and other.
64 # On successful lookup of ".", a reference is added to dvp, and it
65 # is returned in *vpp.
66 # To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and
67 # then dvp is relocked iff LOCKPARENT is set and this is the last
68 # component name (ISLASTCN set). This preserves the
69 # protocol of always locking nodes from root ("/") downward and
70 # prevents deadlock.
71 # Other lookups find the named node (creating the vnode if needed) and
72 # return it, locked, in *vpp.
73 # For non-"." lookups, if LOCKPARENT is not set or this was not the
74 # last component name, dvp is returned unlocked on a successful
75 # lookup.
76 # On failure, *vpp is NULL, and *dvp is left locked. If there was
77 # an error re-locking dvp in the ISDOTDOT case, an error is
78 # returned with PDIRUNLOCK set.
79 #
80 # *vpp is always locked on return if the operation succeeds.
81 # typically, if *vpp == dvp, you need to release twice, but unlock once.
82 #
83 # The PDIRUNLOCK flag is set when dvp is unlocked in the lookup routine.
84 # It signals the caller that dvp's lock state changed. It will
85 # be set on exit if either a successful lookup unlocked the
86 # parrent, or there was an error re-locking dvp in the ISDOTDOT case.
87 #
88 vop_lookup {
89 IN struct vnode *dvp;
90 INOUT struct vnode **vpp;
91 IN struct componentname *cnp;
92 };
93
94 #
95 #% create dvp L U U
96 #% create vpp - L -
97 #
98 vop_create {
99 IN WILLPUT struct vnode *dvp;
100 OUT struct vnode **vpp;
101 IN struct componentname *cnp;
102 IN struct vattr *vap;
103 };
104
105 #
106 #% mknod dvp L U U
107 #% mknod vpp - X -
108 #
109 vop_mknod {
110 IN WILLPUT struct vnode *dvp;
111 OUT WILLRELE struct vnode **vpp;
112 IN struct componentname *cnp;
113 IN struct vattr *vap;
114 };
115
116 #
117 #% open vp L L L
118 #
119 vop_open {
120 IN struct vnode *vp;
121 IN int mode;
122 IN struct ucred *cred;
123 IN struct proc *p;
124 };
125
126 #
127 #% close vp L L L
128 #
129 vop_close {
130 IN struct vnode *vp;
131 IN int fflag;
132 IN struct ucred *cred;
133 IN struct proc *p;
134 };
135
136 #
137 #% access vp L L L
138 #
139 vop_access {
140 IN struct vnode *vp;
141 IN int mode;
142 IN struct ucred *cred;
143 IN struct proc *p;
144 };
145
146 #
147 #% getattr vp = = =
148 #
149 vop_getattr {
150 IN struct vnode *vp;
151 IN struct vattr *vap;
152 IN struct ucred *cred;
153 IN struct proc *p;
154 };
155
156 #
157 #% setattr vp L L L
158 #
159 vop_setattr {
160 IN struct vnode *vp;
161 IN struct vattr *vap;
162 IN struct ucred *cred;
163 IN struct proc *p;
164 };
165
166 #
167 #% read vp L L L
168 #
169 vop_read {
170 IN struct vnode *vp;
171 INOUT struct uio *uio;
172 IN int ioflag;
173 IN struct ucred *cred;
174 };
175
176 #
177 #% write vp L L L
178 #
179 vop_write {
180 IN struct vnode *vp;
181 INOUT struct uio *uio;
182 IN int ioflag;
183 IN struct ucred *cred;
184 };
185
186 #
187 #% ioctl vp U U U
188 #
189 vop_ioctl {
190 IN struct vnode *vp;
191 IN u_long command;
192 IN caddr_t data;
193 IN int fflag;
194 IN struct ucred *cred;
195 IN struct proc *p;
196 };
197
198 #
199 #% fcntl vp L L L
200 #
201 vop_fcntl {
202 IN struct vnode *vp;
203 IN u_int command;
204 IN caddr_t data;
205 IN int fflag;
206 IN struct ucred *cred;
207 IN struct proc *p;
208 };
209
210 #
211 #% poll vp U U U
212 #
213 vop_poll {
214 IN struct vnode *vp;
215 IN int events;
216 IN struct proc *p;
217 };
218
219 #
220 #% revoke vp U U U
221 #
222 vop_revoke {
223 IN struct vnode *vp;
224 IN int flags;
225 };
226
227 #
228 # XXX - not used
229 #
230 vop_mmap {
231 IN struct vnode *vp;
232 IN int fflags;
233 IN struct ucred *cred;
234 IN struct proc *p;
235 };
236
237 #
238 #% fsync vp L L L
239 #
240 vop_fsync {
241 IN struct vnode *vp;
242 IN struct ucred *cred;
243 IN int flags;
244 IN struct proc *p;
245 };
246
247 #
248 # Needs work: Is newoff right? What's it mean?
249 #
250 vop_seek {
251 IN struct vnode *vp;
252 IN off_t oldoff;
253 IN off_t newoff;
254 IN struct ucred *cred;
255 };
256
257 #
258 #% remove dvp L U U
259 #% remove vp L U U
260 #
261 vop_remove {
262 IN WILLPUT struct vnode *dvp;
263 IN WILLPUT struct vnode *vp;
264 IN struct componentname *cnp;
265 };
266
267 #
268 #% link vp U U U
269 #% link tdvp L U U
270 #
271 vop_link {
272 IN WILLPUT struct vnode *dvp;
273 IN struct vnode *vp;
274 IN struct componentname *cnp;
275 };
276
277 #
278 #% rename fdvp U U U
279 #% rename fvp U U U
280 #% rename tdvp L U U
281 #% rename tvp X U U
282 #
283 vop_rename {
284 IN WILLRELE struct vnode *fdvp;
285 IN WILLRELE struct vnode *fvp;
286 IN struct componentname *fcnp;
287 IN WILLPUT struct vnode *tdvp;
288 IN WILLRELE struct vnode *tvp;
289 IN struct componentname *tcnp;
290 };
291
292 #
293 #% mkdir dvp L U U
294 #% mkdir vpp - L -
295 #
296 vop_mkdir {
297 IN WILLPUT struct vnode *dvp;
298 OUT struct vnode **vpp;
299 IN struct componentname *cnp;
300 IN struct vattr *vap;
301 };
302
303 #
304 #% rmdir dvp L U U
305 #% rmdir vp L U U
306 #
307 vop_rmdir {
308 IN WILLPUT struct vnode *dvp;
309 IN WILLPUT struct vnode *vp;
310 IN struct componentname *cnp;
311 };
312
313 #
314 #% symlink dvp L U U
315 #% symlink vpp - U -
316 #
317 # XXX - note that the return vnode has already been VRELE'ed
318 # by the filesystem layer. To use it you must use vget,
319 # possibly with a further namei.
320 #
321 vop_symlink {
322 IN WILLPUT struct vnode *dvp;
323 OUT WILLRELE struct vnode **vpp;
324 IN struct componentname *cnp;
325 IN struct vattr *vap;
326 IN char *target;
327 };
328
329 #
330 #% readdir vp L L L
331 #
332 vop_readdir {
333 IN struct vnode *vp;
334 INOUT struct uio *uio;
335 IN struct ucred *cred;
336 OUT int *eofflag;
337 OUT off_t **cookies;
338 IN int *ncookies;
339 };
340
341 #
342 #% readlink vp L L L
343 #
344 vop_readlink {
345 IN struct vnode *vp;
346 INOUT struct uio *uio;
347 IN struct ucred *cred;
348 };
349
350 #
351 #% abortop dvp = = =
352 #
353 vop_abortop {
354 IN struct vnode *dvp;
355 IN struct componentname *cnp;
356 };
357
358 #
359 #% inactive vp L U U
360 #
361 vop_inactive {
362 IN WILLUNLOCK struct vnode *vp;
363 IN struct proc *p;
364 };
365
366 #
367 #% reclaim vp U U U
368 #
369 vop_reclaim {
370 IN struct vnode *vp;
371 IN struct proc *p;
372 };
373
374 #
375 #% lock vp U L U
376 #
377 vop_lock {
378 IN struct vnode *vp;
379 IN int flags;
380 };
381
382 #
383 #% unlock vp L U L
384 #
385 vop_unlock {
386 IN struct vnode *vp;
387 IN int flags;
388 };
389
390 #
391 #% bmap vp L L L
392 #% bmap vpp - U -
393 #
394 vop_bmap {
395 IN struct vnode *vp;
396 IN daddr_t bn;
397 OUT struct vnode **vpp;
398 IN daddr_t *bnp;
399 OUT int *runp;
400 };
401
402 #
403 # Needs work: no vp?
404 #
405 #vop_strategy {
406 # IN struct buf *bp;
407 #};
408
409 #
410 #% print vp = = =
411 #
412 vop_print {
413 IN struct vnode *vp;
414 };
415
416 #
417 #% islocked vp = = =
418 #
419 vop_islocked {
420 IN struct vnode *vp;
421 };
422
423 #
424 #% pathconf vp L L L
425 #
426 vop_pathconf {
427 IN struct vnode *vp;
428 IN int name;
429 OUT register_t *retval;
430 };
431
432 #
433 #% advlock vp U U U
434 #
435 vop_advlock {
436 IN struct vnode *vp;
437 IN caddr_t id;
438 IN int op;
439 IN struct flock *fl;
440 IN int flags;
441 };
442
443 #
444 #% blkatoff vp L L L
445 #
446 vop_blkatoff {
447 IN struct vnode *vp;
448 IN off_t offset;
449 OUT char **res;
450 OUT struct buf **bpp;
451 };
452
453 #
454 #% valloc pvp L L L
455 #
456 vop_valloc {
457 IN struct vnode *pvp;
458 IN int mode;
459 IN struct ucred *cred;
460 OUT struct vnode **vpp;
461 };
462
463 #
464 #% reallocblks vp L L L
465 #
466 vop_reallocblks {
467 IN struct vnode *vp;
468 IN struct cluster_save *buflist;
469 };
470
471 #
472 #% vfree pvp L L L
473 #
474 vop_vfree {
475 IN struct vnode *pvp;
476 IN ino_t ino;
477 IN int mode;
478 };
479
480 #
481 #% truncate vp L L L
482 #
483 vop_truncate {
484 IN struct vnode *vp;
485 IN off_t length;
486 IN int flags;
487 IN struct ucred *cred;
488 IN struct proc *p;
489 };
490
491 #
492 #% update vp L L L
493 #
494 vop_update {
495 IN struct vnode *vp;
496 IN struct timespec *access;
497 IN struct timespec *modify;
498 IN int waitfor;
499 };
500
501 #
502 #% lease vp = = =
503 #
504 vop_lease {
505 IN struct vnode *vp;
506 IN struct proc *p;
507 IN struct ucred *cred;
508 IN int flag;
509 };
510
511 #
512 #% whiteout dvp L L L
513 #% whiteout cnp - - -
514 #% whiteout flag - - -
515 #
516 vop_whiteout {
517 IN struct vnode *dvp;
518 IN struct componentname *cnp;
519 IN int flags;
520 };
521
522 #
523 # Needs work: no vp?
524 #
525 #vop_bwrite {
526 # IN struct buf *bp;
527 #};
528