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