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