vnode_if.src revision 1.29.2.1 1 # $NetBSD: vnode_if.src,v 1.29.2.1 2001/09/18 19:13:55 fvdl 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 # For operations other than VOP_LOOKUP which require a component name
54 # parameter, the flags required for the initial namei() call are listed.
55 # Additional flags may be added to the namei() call, but these are required.
56 #
57
58 #
59 #% lookup dvp L ? ?
60 #% lookup vpp - L -
61 #
62 # XXX - the lookup locking protocol defies simple description and depends
63 # on the flags and operation fields in the (cnp) structure. Note
64 # especially that *vpp may equal dvp and both may be locked.
65 #
66 # More details:
67 # There are three types of lookups: ".", ".." (ISDOTDOT), and other.
68 # On successful lookup of ".", a reference is added to dvp, and it
69 # is returned in *vpp.
70 # To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and
71 # then dvp is relocked iff LOCKPARENT is set and this is the last
72 # component name (ISLASTCN set). This preserves the
73 # protocol of always locking nodes from root ("/") downward and
74 # prevents deadlock.
75 # Other lookups find the named node (creating the vnode if needed) and
76 # return it, locked, in *vpp.
77 # For non-"." lookups, if LOCKPARENT is not set or this was not the
78 # last component name, dvp is returned unlocked on a successful
79 # lookup.
80 # On failure, *vpp is NULL, and *dvp is left locked. If there was
81 # an error re-locking dvp (for instance in the ISDOTDOT case),
82 # the error is returned with PDIRUNLOCK set.
83 #
84 # *vpp is always locked on return if the operation succeeds.
85 # typically, if *vpp == dvp, you need to release twice, but unlock once.
86 #
87 # The PDIRUNLOCK flag is set when dvp is unlocked in the lookup routine.
88 # It signals the caller that dvp's lock state changed. It will
89 # be set on exit if either a successful lookup unlocked the
90 # parrent, or there was an error re-locking dvp in the ISDOTDOT case.
91 #
92 # See sys/sys/namei.h for a description of the SAVENAME and SAVESTART
93 # flags.
94 #
95 vop_lookup {
96 IN struct vnode *dvp;
97 INOUT struct vnode **vpp;
98 IN struct componentname *cnp;
99 };
100
101 #
102 #% create dvp L U U
103 #% create vpp - L -
104 #
105 #! create cnp CREATE, LOCKPARENT
106 #
107 vop_create {
108 IN WILLPUT struct vnode *dvp;
109 OUT struct vnode **vpp;
110 IN struct componentname *cnp;
111 IN struct vattr *vap;
112 };
113
114 #
115 #% mknod dvp L U U
116 #% mknod vpp - L -
117 #
118 #! mknod cnp CREATE, LOCKPARENT
119 #
120 vop_mknod {
121 IN WILLPUT struct vnode *dvp;
122 OUT struct vnode **vpp;
123 IN struct componentname *cnp;
124 IN struct vattr *vap;
125 };
126
127 #
128 #% open vp L L L
129 #% open vpp - - L
130 #
131 vop_open {
132 IN struct vnode *vp;
133 IN int mode;
134 IN struct ucred *cred;
135 IN struct proc *p;
136 OUT struct vnode **vpp;
137 };
138
139 #
140 #% close vp L L L
141 #
142 vop_close {
143 IN struct vnode *vp;
144 IN int fflag;
145 IN struct ucred *cred;
146 IN struct proc *p;
147 };
148
149 #
150 #% access vp L L L
151 #
152 vop_access {
153 IN struct vnode *vp;
154 IN int mode;
155 IN struct ucred *cred;
156 IN struct proc *p;
157 };
158
159 #
160 #% getattr vp = = =
161 #
162 vop_getattr {
163 IN struct vnode *vp;
164 IN struct vattr *vap;
165 IN struct ucred *cred;
166 IN struct proc *p;
167 };
168
169 #
170 #% setattr vp L L L
171 #
172 vop_setattr {
173 IN struct vnode *vp;
174 IN struct vattr *vap;
175 IN struct ucred *cred;
176 IN struct proc *p;
177 };
178
179 #
180 #% read vp L L L
181 #
182 vop_read {
183 IN struct vnode *vp;
184 INOUT struct uio *uio;
185 IN int ioflag;
186 IN struct ucred *cred;
187 };
188
189 #
190 #% write vp L L L
191 #
192 vop_write {
193 IN struct vnode *vp;
194 INOUT struct uio *uio;
195 IN int ioflag;
196 IN struct ucred *cred;
197 };
198
199 #
200 #% ioctl vp U U U
201 #
202 vop_ioctl {
203 IN struct vnode *vp;
204 IN u_long command;
205 IN caddr_t data;
206 IN int fflag;
207 IN struct ucred *cred;
208 IN struct proc *p;
209 };
210
211 #
212 #% fcntl vp L L L
213 #
214 vop_fcntl {
215 IN struct vnode *vp;
216 IN u_int command;
217 IN caddr_t data;
218 IN int fflag;
219 IN struct ucred *cred;
220 IN struct proc *p;
221 };
222
223 #
224 #% poll vp U U U
225 #
226 vop_poll {
227 IN struct vnode *vp;
228 IN int events;
229 IN struct proc *p;
230 };
231
232 #
233 #% revoke vp U U U
234 #
235 vop_revoke {
236 IN struct vnode *vp;
237 IN int flags;
238 };
239
240 #
241 # XXX - not used
242 #
243 vop_mmap {
244 IN struct vnode *vp;
245 IN int fflags;
246 IN struct ucred *cred;
247 IN struct proc *p;
248 };
249
250 #
251 #% fsync vp L L L
252 #
253 vop_fsync {
254 IN struct vnode *vp;
255 IN struct ucred *cred;
256 IN int flags;
257 IN off_t offlo
258 IN off_t offhi
259 IN struct proc *p;
260 };
261
262 #
263 # Needs work: Is newoff right? What's it mean?
264 #
265 vop_seek {
266 IN struct vnode *vp;
267 IN off_t oldoff;
268 IN off_t newoff;
269 IN struct ucred *cred;
270 };
271
272 #
273 #% remove dvp L U U
274 #% remove vp L U U
275 #
276 #! remove cnp DELETE, LOCKPARENT | LOCKLEAF
277 #
278 vop_remove {
279 IN WILLPUT struct vnode *dvp;
280 IN WILLPUT struct vnode *vp;
281 IN struct componentname *cnp;
282 };
283
284 #
285 #% link vp U U U
286 #% link tdvp L U U
287 #
288 #! link cnp CREATE, LOCKPARENT
289 #
290 vop_link {
291 IN WILLPUT struct vnode *dvp;
292 IN struct vnode *vp;
293 IN struct componentname *cnp;
294 };
295
296 #
297 #% rename fdvp U U U
298 #% rename fvp U U U
299 #% rename tdvp L U U
300 #% rename tvp X U U
301 #
302 #! rename fcnp DELETE, WANTPARENT | SAVESTART
303 #! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART
304 #
305 # XXX the vop_rename routines should REALLY NOT be depending on SAVESTART!
306 #
307 vop_rename {
308 IN WILLRELE struct vnode *fdvp;
309 IN WILLRELE struct vnode *fvp;
310 IN struct componentname *fcnp;
311 IN WILLPUT struct vnode *tdvp;
312 IN WILLRELE struct vnode *tvp;
313 IN struct componentname *tcnp;
314 };
315
316 #
317 #% mkdir dvp L U U
318 #% mkdir vpp - L -
319 #
320 #! mkdir cnp CREATE, LOCKPARENT
321 #
322 vop_mkdir {
323 IN WILLPUT struct vnode *dvp;
324 OUT struct vnode **vpp;
325 IN struct componentname *cnp;
326 IN struct vattr *vap;
327 };
328
329 #
330 #% rmdir dvp L U U
331 #% rmdir vp L U U
332 #
333 #! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF
334 #
335 vop_rmdir {
336 IN WILLPUT struct vnode *dvp;
337 IN WILLPUT struct vnode *vp;
338 IN struct componentname *cnp;
339 };
340
341 #
342 #% symlink dvp L U U
343 #% symlink vpp - L -
344 #
345 #! symlink cnp CREATE, LOCKPARENT
346 #
347 vop_symlink {
348 IN WILLPUT struct vnode *dvp;
349 OUT struct vnode **vpp;
350 IN struct componentname *cnp;
351 IN struct vattr *vap;
352 IN char *target;
353 };
354
355 #
356 #% readdir vp L L L
357 #
358 vop_readdir {
359 IN struct vnode *vp;
360 INOUT struct uio *uio;
361 IN struct ucred *cred;
362 OUT int *eofflag;
363 OUT off_t **cookies;
364 IN int *ncookies;
365 };
366
367 #
368 #% readlink vp L L L
369 #
370 vop_readlink {
371 IN struct vnode *vp;
372 INOUT struct uio *uio;
373 IN struct ucred *cred;
374 };
375
376 #
377 #% abortop dvp = = =
378 #
379 #! abortop cnp as appropriate.
380 #
381 vop_abortop {
382 IN struct vnode *dvp;
383 IN struct componentname *cnp;
384 };
385
386 #
387 #% inactive vp L U U
388 #
389 vop_inactive {
390 IN WILLUNLOCK struct vnode *vp;
391 IN struct proc *p;
392 };
393
394 #
395 #% reclaim vp U U U
396 #
397 vop_reclaim {
398 IN struct vnode *vp;
399 IN struct proc *p;
400 };
401
402 #
403 #% lock vp U L U
404 #
405 vop_lock {
406 IN struct vnode *vp;
407 IN int flags;
408 };
409
410 #
411 #% unlock vp L U L
412 #
413 vop_unlock {
414 IN struct vnode *vp;
415 IN int flags;
416 };
417
418 #
419 #% bmap vp L L L
420 #% bmap vpp - U -
421 #
422 vop_bmap {
423 IN struct vnode *vp;
424 IN daddr_t bn;
425 OUT struct vnode **vpp;
426 IN daddr_t *bnp;
427 OUT int *runp;
428 };
429
430 #
431 # Needs work: no vp?
432 #
433 #vop_strategy {
434 # IN struct buf *bp;
435 #};
436
437 #
438 #% print vp = = =
439 #
440 vop_print {
441 IN struct vnode *vp;
442 };
443
444 #
445 #% islocked vp = = =
446 #
447 vop_islocked {
448 IN struct vnode *vp;
449 };
450
451 #
452 #% pathconf vp L L L
453 #
454 vop_pathconf {
455 IN struct vnode *vp;
456 IN int name;
457 OUT register_t *retval;
458 };
459
460 #
461 #% advlock vp U U U
462 #
463 vop_advlock {
464 IN struct vnode *vp;
465 IN caddr_t id;
466 IN int op;
467 IN struct flock *fl;
468 IN int flags;
469 };
470
471 #
472 #% blkatoff vp L L L
473 #
474 vop_blkatoff {
475 IN struct vnode *vp;
476 IN off_t offset;
477 OUT char **res;
478 OUT struct buf **bpp;
479 };
480
481 #
482 #% valloc pvp L L L
483 #
484 vop_valloc {
485 IN struct vnode *pvp;
486 IN int mode;
487 IN struct ucred *cred;
488 OUT struct vnode **vpp;
489 };
490
491 #
492 #% balloc vp L L L
493 #
494 vop_balloc {
495 IN struct vnode *vp;
496 IN off_t startoffset;
497 IN int size;
498 IN struct ucred *cred;
499 IN int flags;
500 OUT struct buf **bpp;
501 };
502
503 #
504 #% ballocn vp L L L
505 #
506 vop_ballocn {
507 IN struct vnode *vp;
508 IN off_t offset;
509 IN off_t length;
510 IN struct ucred *cred;
511 IN int flags;
512 };
513
514 #
515 #% reallocblks vp L L L
516 #
517 vop_reallocblks {
518 IN struct vnode *vp;
519 IN struct cluster_save *buflist;
520 };
521
522 #
523 #% vfree pvp L L L
524 #
525 vop_vfree {
526 IN struct vnode *pvp;
527 IN ino_t ino;
528 IN int mode;
529 };
530
531 #
532 #% truncate vp L L L
533 #
534 vop_truncate {
535 IN struct vnode *vp;
536 IN off_t length;
537 IN int flags;
538 IN struct ucred *cred;
539 IN struct proc *p;
540 };
541
542 #
543 #% update vp L L L
544 #
545 vop_update {
546 IN struct vnode *vp;
547 IN struct timespec *access;
548 IN struct timespec *modify;
549 IN int flags;
550 };
551
552 #
553 #% lease vp = = =
554 #
555 vop_lease {
556 IN struct vnode *vp;
557 IN struct proc *p;
558 IN struct ucred *cred;
559 IN int flag;
560 };
561
562 #
563 #% whiteout dvp L L L
564 #% whiteout cnp - - -
565 #% whiteout flag - - -
566 #
567 #! whiteout cnp CREATE, LOCKPARENT
568 #
569 vop_whiteout {
570 IN struct vnode *dvp;
571 IN struct componentname *cnp;
572 IN int flags;
573 };
574
575 #
576 # Needs work: no vp?
577 #
578 #vop_bwrite {
579 # IN struct buf *bp;
580 #};
581
582 #
583 #% getpages vp L L L
584 #
585 vop_getpages {
586 IN struct vnode *vp;
587 IN voff_t offset;
588 IN struct vm_page **m;
589 IN int *count;
590 IN int centeridx;
591 IN vm_prot_t access_type;
592 IN int advice;
593 IN int flags;
594 };
595
596 #
597 #% putpages vp L L L
598 #
599 vop_putpages {
600 IN struct vnode *vp;
601 IN struct vm_page **m;
602 IN int count;
603 IN int flags;
604 IN int *rtvals;
605 };
606
607 #
608 #% size vp = = =
609 #
610 vop_size {
611 IN struct vnode *vp;
612 IN off_t size;
613 OUT off_t *eobp;
614 };
615