Annotation of src/sys/kern/vnode_if.src, Revision 1.46.2.1
1.46.2.1! yamt 1: # $NetBSD: vnode_if.src,v 1.46 2005/11/02 12:38:59 yamt Exp $
1.1 mycroft 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: #
1.13 fvdl 34: # @(#)vnode_if.src 8.14 (Berkeley) 8/6/95
35: #
36: #
37:
1.44 perry 38: #
1.13 fvdl 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,
1.36 wiz 43: # the "out" column defines the state on successful return, and the
1.13 fvdl 44: # "error" column defines the locking state on error exit.
1.44 perry 45: #
1.13 fvdl 46: # The locking value can take the following values:
47: # L: locked.
1.30 chs 48: # U: unlocked.
1.13 fvdl 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.
1.22 wrstuden 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.
1.44 perry 56: #
57:
1.13 fvdl 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.
1.16 sommerfe 65: #
66: # More details:
1.20 wrstuden 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
1.22 wrstuden 81: # an error re-locking dvp (for instance in the ISDOTDOT case),
82: # the error is returned with PDIRUNLOCK set.
1.44 perry 83: #
1.16 sommerfe 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: #
1.20 wrstuden 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.
1.1 mycroft 91: #
1.22 wrstuden 92: # See sys/sys/namei.h for a description of the SAVENAME and SAVESTART
93: # flags.
94: #
1.1 mycroft 95: vop_lookup {
96: IN struct vnode *dvp;
97: INOUT struct vnode **vpp;
98: IN struct componentname *cnp;
99: };
100:
1.13 fvdl 101: #
102: #% create dvp L U U
103: #% create vpp - L -
104: #
1.22 wrstuden 105: #! create cnp CREATE, LOCKPARENT
106: #
1.1 mycroft 107: vop_create {
1.41 thorpej 108: IN LOCKED=YES WILLPUT struct vnode *dvp;
1.1 mycroft 109: OUT struct vnode **vpp;
110: IN struct componentname *cnp;
111: IN struct vattr *vap;
112: };
113:
1.13 fvdl 114: #
115: #% mknod dvp L U U
1.29 assar 116: #% mknod vpp - L -
1.13 fvdl 117: #
1.22 wrstuden 118: #! mknod cnp CREATE, LOCKPARENT
119: #
1.1 mycroft 120: vop_mknod {
1.41 thorpej 121: IN LOCKED=YES WILLPUT struct vnode *dvp;
1.29 assar 122: OUT struct vnode **vpp;
1.1 mycroft 123: IN struct componentname *cnp;
124: IN struct vattr *vap;
125: };
126:
1.13 fvdl 127: #
128: #% open vp L L L
129: #
1.1 mycroft 130: vop_open {
1.41 thorpej 131: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 132: IN int mode;
133: IN struct ucred *cred;
1.35 fvdl 134: IN struct proc *p;
1.1 mycroft 135: };
136:
1.13 fvdl 137: #
1.15 wrstuden 138: #% close vp L L L
1.13 fvdl 139: #
1.1 mycroft 140: vop_close {
1.41 thorpej 141: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 142: IN int fflag;
143: IN struct ucred *cred;
1.35 fvdl 144: IN struct proc *p;
1.1 mycroft 145: };
146:
1.13 fvdl 147: #
148: #% access vp L L L
149: #
1.1 mycroft 150: vop_access {
1.41 thorpej 151: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 152: IN int mode;
153: IN struct ucred *cred;
1.35 fvdl 154: IN struct proc *p;
1.1 mycroft 155: };
156:
1.13 fvdl 157: #
158: #% getattr vp = = =
159: #
1.1 mycroft 160: vop_getattr {
161: IN struct vnode *vp;
162: IN struct vattr *vap;
163: IN struct ucred *cred;
1.35 fvdl 164: IN struct proc *p;
1.1 mycroft 165: };
166:
1.13 fvdl 167: #
168: #% setattr vp L L L
169: #
1.1 mycroft 170: vop_setattr {
1.41 thorpej 171: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 172: IN struct vattr *vap;
173: IN struct ucred *cred;
1.35 fvdl 174: IN struct proc *p;
1.1 mycroft 175: };
176:
1.13 fvdl 177: #
178: #% read vp L L L
179: #
1.1 mycroft 180: vop_read {
1.41 thorpej 181: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 182: INOUT struct uio *uio;
1.46.2.1! yamt 183: INOUT struct uvm_ractx *ra;
1.1 mycroft 184: IN int ioflag;
185: IN struct ucred *cred;
186: };
187:
1.13 fvdl 188: #
189: #% write vp L L L
190: #
1.1 mycroft 191: vop_write {
1.41 thorpej 192: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 193: INOUT struct uio *uio;
194: IN int ioflag;
195: IN struct ucred *cred;
196: };
197:
1.13 fvdl 198: #
199: #% ioctl vp U U U
200: #
1.1 mycroft 201: vop_ioctl {
1.41 thorpej 202: IN LOCKED=NO struct vnode *vp;
1.4 cgd 203: IN u_long command;
1.32 jdolecek 204: IN void *data;
1.19 wrstuden 205: IN int fflag;
206: IN struct ucred *cred;
1.35 fvdl 207: IN struct proc *p;
1.19 wrstuden 208: };
209:
210: #
211: #% fcntl vp L L L
212: #
213: vop_fcntl {
1.41 thorpej 214: IN LOCKED=YES struct vnode *vp;
1.19 wrstuden 215: IN u_int command;
1.32 jdolecek 216: IN void *data;
1.1 mycroft 217: IN int fflag;
218: IN struct ucred *cred;
1.35 fvdl 219: IN struct proc *p;
1.1 mycroft 220: };
221:
1.13 fvdl 222: #
223: #% poll vp U U U
224: #
1.11 mycroft 225: vop_poll {
1.41 thorpej 226: IN LOCKED=NO struct vnode *vp;
1.11 mycroft 227: IN int events;
1.35 fvdl 228: IN struct proc *p;
1.31 jdolecek 229: };
230:
231: #
232: #% kqfilter vp U U U
233: #
234: vop_kqfilter {
1.41 thorpej 235: IN LOCKED=NO struct vnode *vp;
1.31 jdolecek 236: IN struct knote *kn;
1.1 mycroft 237: };
238:
1.13 fvdl 239: #
240: #% revoke vp U U U
241: #
242: vop_revoke {
1.41 thorpej 243: IN LOCKED=NO struct vnode *vp;
1.13 fvdl 244: IN int flags;
245: };
246:
1.44 perry 247: #
1.30 chs 248: #% mmap vp = = =
1.13 fvdl 249: #
1.1 mycroft 250: vop_mmap {
251: IN struct vnode *vp;
252: IN int fflags;
253: IN struct ucred *cred;
1.35 fvdl 254: IN struct proc *p;
1.1 mycroft 255: };
256:
1.13 fvdl 257: #
258: #% fsync vp L L L
259: #
1.1 mycroft 260: vop_fsync {
1.41 thorpej 261: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 262: IN struct ucred *cred;
1.14 kleink 263: IN int flags;
1.37 wiz 264: IN off_t offlo;
265: IN off_t offhi;
1.35 fvdl 266: IN struct proc *p;
1.1 mycroft 267: };
268:
1.13 fvdl 269: #
270: # Needs work: Is newoff right? What's it mean?
1.45 isaki 271: # XXX Locking protocol?
1.13 fvdl 272: #
1.1 mycroft 273: vop_seek {
274: IN struct vnode *vp;
275: IN off_t oldoff;
276: IN off_t newoff;
277: IN struct ucred *cred;
278: };
279:
1.13 fvdl 280: #
281: #% remove dvp L U U
282: #% remove vp L U U
283: #
1.22 wrstuden 284: #! remove cnp DELETE, LOCKPARENT | LOCKLEAF
285: #
1.1 mycroft 286: vop_remove {
1.41 thorpej 287: IN LOCKED=YES WILLPUT struct vnode *dvp;
288: IN LOCKED=YES WILLPUT struct vnode *vp;
1.1 mycroft 289: IN struct componentname *cnp;
290: };
291:
1.13 fvdl 292: #
293: #% link vp U U U
1.41 thorpej 294: #% link dvp L U U
1.13 fvdl 295: #
1.22 wrstuden 296: #! link cnp CREATE, LOCKPARENT
297: #
1.1 mycroft 298: vop_link {
1.41 thorpej 299: IN LOCKED=YES WILLPUT struct vnode *dvp;
300: IN LOCKED=NO struct vnode *vp;
1.1 mycroft 301: IN struct componentname *cnp;
302: };
303:
1.13 fvdl 304: #
305: #% rename fdvp U U U
306: #% rename fvp U U U
307: #% rename tdvp L U U
308: #% rename tvp X U U
309: #
1.22 wrstuden 310: #! rename fcnp DELETE, WANTPARENT | SAVESTART
311: #! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART
312: #
313: # XXX the vop_rename routines should REALLY NOT be depending on SAVESTART!
314: #
1.1 mycroft 315: vop_rename {
1.41 thorpej 316: IN LOCKED=NO WILLRELE struct vnode *fdvp;
317: IN LOCKED=NO WILLRELE struct vnode *fvp;
1.1 mycroft 318: IN struct componentname *fcnp;
1.41 thorpej 319: IN LOCKED=YES WILLPUT struct vnode *tdvp;
1.33 jdolecek 320: IN WILLPUT struct vnode *tvp;
1.1 mycroft 321: IN struct componentname *tcnp;
322: };
323:
1.13 fvdl 324: #
325: #% mkdir dvp L U U
1.44 perry 326: #% mkdir vpp - L -
1.13 fvdl 327: #
1.22 wrstuden 328: #! mkdir cnp CREATE, LOCKPARENT
329: #
1.1 mycroft 330: vop_mkdir {
1.41 thorpej 331: IN LOCKED=YES WILLPUT struct vnode *dvp;
1.1 mycroft 332: OUT struct vnode **vpp;
333: IN struct componentname *cnp;
334: IN struct vattr *vap;
335: };
336:
1.13 fvdl 337: #
338: #% rmdir dvp L U U
339: #% rmdir vp L U U
340: #
1.22 wrstuden 341: #! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF
342: #
1.1 mycroft 343: vop_rmdir {
1.41 thorpej 344: IN LOCKED=YES WILLPUT struct vnode *dvp;
345: IN LOCKED=YES WILLPUT struct vnode *vp;
1.1 mycroft 346: IN struct componentname *cnp;
347: };
348:
1.13 fvdl 349: #
350: #% symlink dvp L U U
1.29 assar 351: #% symlink vpp - L -
1.13 fvdl 352: #
1.22 wrstuden 353: #! symlink cnp CREATE, LOCKPARENT
354: #
1.1 mycroft 355: vop_symlink {
1.41 thorpej 356: IN LOCKED=YES WILLPUT struct vnode *dvp;
1.29 assar 357: OUT struct vnode **vpp;
1.1 mycroft 358: IN struct componentname *cnp;
359: IN struct vattr *vap;
360: IN char *target;
361: };
362:
1.13 fvdl 363: #
1.44 perry 364: #% readdir vp L L L
1.13 fvdl 365: #
1.1 mycroft 366: vop_readdir {
1.41 thorpej 367: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 368: INOUT struct uio *uio;
369: IN struct ucred *cred;
370: OUT int *eofflag;
1.13 fvdl 371: OUT off_t **cookies;
372: IN int *ncookies;
1.1 mycroft 373: };
374:
1.13 fvdl 375: #
376: #% readlink vp L L L
377: #
1.1 mycroft 378: vop_readlink {
1.41 thorpej 379: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 380: INOUT struct uio *uio;
381: IN struct ucred *cred;
382: };
383:
1.13 fvdl 384: #
385: #% abortop dvp = = =
386: #
1.22 wrstuden 387: #! abortop cnp as appropriate.
388: #
1.1 mycroft 389: vop_abortop {
390: IN struct vnode *dvp;
391: IN struct componentname *cnp;
392: };
393:
1.13 fvdl 394: #
1.44 perry 395: #% inactive vp L U U
1.13 fvdl 396: #
1.1 mycroft 397: vop_inactive {
1.41 thorpej 398: IN LOCKED=YES WILLUNLOCK struct vnode *vp;
1.35 fvdl 399: IN struct proc *p;
1.1 mycroft 400: };
401:
1.13 fvdl 402: #
403: #% reclaim vp U U U
404: #
1.1 mycroft 405: vop_reclaim {
1.41 thorpej 406: IN LOCKED=NO struct vnode *vp;
1.35 fvdl 407: IN struct proc *p;
1.1 mycroft 408: };
409:
1.13 fvdl 410: #
411: #% lock vp U L U
412: #
1.1 mycroft 413: vop_lock {
1.41 thorpej 414: IN LOCKED=NO struct vnode *vp;
1.13 fvdl 415: IN int flags;
1.1 mycroft 416: };
417:
1.13 fvdl 418: #
419: #% unlock vp L U L
420: #
1.1 mycroft 421: vop_unlock {
1.41 thorpej 422: IN LOCKED=YES struct vnode *vp;
1.13 fvdl 423: IN int flags;
1.1 mycroft 424: };
425:
1.13 fvdl 426: #
1.40 yamt 427: #% bmap vp = = =
1.13 fvdl 428: #% bmap vpp - U -
429: #
1.1 mycroft 430: vop_bmap {
1.41 thorpej 431: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 432: IN daddr_t bn;
433: OUT struct vnode **vpp;
434: IN daddr_t *bnp;
435: OUT int *runp;
436: };
437:
1.13 fvdl 438: #
1.38 hannken 439: #% strategy vp = = =
1.13 fvdl 440: #
1.38 hannken 441: vop_strategy {
442: IN struct vnode *vp;
443: IN struct buf *bp;
444: };
1.1 mycroft 445:
1.13 fvdl 446: #
447: #% print vp = = =
448: #
1.1 mycroft 449: vop_print {
450: IN struct vnode *vp;
451: };
452:
1.13 fvdl 453: #
454: #% islocked vp = = =
455: #
1.1 mycroft 456: vop_islocked {
457: IN struct vnode *vp;
458: };
459:
1.13 fvdl 460: #
461: #% pathconf vp L L L
462: #
1.1 mycroft 463: vop_pathconf {
1.41 thorpej 464: IN LOCKED=YES struct vnode *vp;
1.1 mycroft 465: IN int name;
1.3 cgd 466: OUT register_t *retval;
1.1 mycroft 467: };
468:
1.13 fvdl 469: #
470: #% advlock vp U U U
471: #
1.1 mycroft 472: vop_advlock {
1.41 thorpej 473: IN LOCKED=NO struct vnode *vp;
1.32 jdolecek 474: IN void *id;
1.1 mycroft 475: IN int op;
476: IN struct flock *fl;
477: IN int flags;
478: };
479:
1.44 perry 480: #
1.13 fvdl 481: #% lease vp = = =
1.44 perry 482: #
1.6 mycroft 483: vop_lease {
484: IN struct vnode *vp;
1.35 fvdl 485: IN struct proc *p;
1.6 mycroft 486: IN struct ucred *cred;
487: IN int flag;
1.7 mycroft 488: };
489:
1.13 fvdl 490: #
491: #% whiteout dvp L L L
492: #% whiteout cnp - - -
493: #% whiteout flag - - -
1.22 wrstuden 494: #
495: #! whiteout cnp CREATE, LOCKPARENT
1.44 perry 496: #
1.7 mycroft 497: vop_whiteout {
1.41 thorpej 498: IN LOCKED=YES struct vnode *dvp;
1.7 mycroft 499: IN struct componentname *cnp;
500: IN int flags;
1.1 mycroft 501: };
502:
1.13 fvdl 503: #
1.1 mycroft 504: # Needs work: no vp?
1.13 fvdl 505: #
1.1 mycroft 506: #vop_bwrite {
507: # IN struct buf *bp;
508: #};
1.26 chs 509:
510: #
1.39 yamt 511: #% getpages vp = = =
1.26 chs 512: #
513: vop_getpages {
514: IN struct vnode *vp;
515: IN voff_t offset;
1.27 chs 516: IN struct vm_page **m;
1.26 chs 517: IN int *count;
518: IN int centeridx;
519: IN vm_prot_t access_type;
520: IN int advice;
521: IN int flags;
522: };
523:
524: #
1.30 chs 525: #% putpages vp = = =
1.26 chs 526: #
527: vop_putpages {
528: IN struct vnode *vp;
1.30 chs 529: IN voff_t offlo;
530: IN voff_t offhi;
1.26 chs 531: IN int flags;
532: };
1.42 thorpej 533:
534: #
535: #% closeextattr vp L L L
536: #
537: vop_closeextattr {
538: IN LOCKED=YES struct vnode *vp;
539: IN int commit;
540: IN struct ucred *cred;
541: IN struct proc *p;
542: };
543:
544: #
545: #% getextattr vp L L L
546: #
547: vop_getextattr {
548: IN LOCKED=YES struct vnode *vp;
549: IN int attrnamespace;
550: IN const char *name;
551: INOUT struct uio *uio;
552: OUT size_t *size;
553: IN struct ucred *cred;
554: IN struct proc *p;
555: };
556:
557: #
558: #% listextattr vp L L L
559: #
560: vop_listextattr {
561: IN LOCKED=YES struct vnode *vp;
562: IN int attrnamespace;
563: INOUT struct uio *uio;
564: OUT size_t *size;
565: IN struct ucred *cred;
566: IN struct proc *p;
567: };
568:
569: #
570: #% openextattr vp L L L
571: #
572: vop_openextattr {
573: IN LOCKED=YES struct vnode *vp;
574: IN struct ucred *cred;
575: IN struct proc *p;
576: };
577:
578: #
579: #% deleteextattr vp L L L
580: #
581: vop_deleteextattr {
582: IN LOCKED=YES struct vnode *vp;
583: IN int attrnamespace;
584: IN const char *name;
585: IN struct ucred *cred;
586: IN struct proc *p;
587: };
588:
589: #
590: #% setextattr vp L L L
591: #
592: vop_setextattr {
593: IN LOCKED=YES struct vnode *vp;
594: IN int attrnamespace;
595: IN const char *name;
596: INOUT struct uio *uio;
597: IN struct ucred *cred;
598: IN struct proc *p;
599: };
CVSweb <webmaster@jp.NetBSD.org>