Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.58
      1 #	$NetBSD: vnode_if.src,v 1.58 2008/11/15 19:08:12 pooka 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 	IN int flags;
    400 };
    401 
    402 #
    403 #% bmap               vp      = = =
    404 #% bmap               vpp     - U -
    405 #
    406 vop_bmap {
    407 	IN struct vnode *vp;
    408 	IN daddr_t bn;
    409 	OUT struct vnode **vpp;
    410 	IN daddr_t *bnp;
    411 	OUT int *runp;
    412 };
    413 
    414 #
    415 #% strategy   vp      = = =
    416 #
    417 vop_strategy {
    418 	IN struct vnode *vp;
    419 	IN struct buf *bp;
    420 };
    421 
    422 #
    423 #% print      vp      = = =
    424 #
    425 vop_print {
    426 	IN struct vnode *vp;
    427 };
    428 
    429 #
    430 #% islocked   vp      = = =
    431 #
    432 vop_islocked {
    433 	IN struct vnode *vp;
    434 };
    435 
    436 #
    437 #% pathconf   vp      L L L
    438 #
    439 vop_pathconf {
    440 	IN LOCKED=YES struct vnode *vp;
    441 	IN int name;
    442 	OUT register_t *retval;
    443 };
    444 
    445 #
    446 #% advlock    vp      U U U
    447 #
    448 vop_advlock {
    449 	IN LOCKED=NO struct vnode *vp;
    450 	IN void *id;
    451 	IN int op;
    452 	IN struct flock *fl;
    453 	IN int flags;
    454 };
    455 
    456 #
    457 #% whiteout   dvp     L L L
    458 #% whiteout   cnp     - - -
    459 #% whiteout   flag    - - -
    460 #
    461 #! whiteout cnp	CREATE, LOCKPARENT
    462 # 
    463 vop_whiteout {
    464 	IN LOCKED=YES struct vnode *dvp;
    465 	IN struct componentname *cnp;
    466 	IN int flags;
    467 };
    468 
    469 #
    470 # Needs work: no vp?
    471 #
    472 #vop_bwrite {
    473 #	IN struct buf *bp;
    474 #};
    475 
    476 #
    477 #% getpages	vp = = =
    478 #
    479 vop_getpages {
    480 	IN struct vnode *vp;
    481 	IN voff_t offset;
    482 	IN struct vm_page **m;
    483 	IN int *count;
    484 	IN int centeridx;
    485 	IN vm_prot_t access_type;
    486 	IN int advice;
    487 	IN int flags;
    488 };
    489 
    490 #
    491 #% putpages	vp = = =
    492 #
    493 vop_putpages {
    494 	IN struct vnode *vp;
    495 	IN voff_t offlo;
    496 	IN voff_t offhi;
    497 	IN int flags;
    498 };
    499 
    500 #
    501 #% closeextattr	vp L L L
    502 #
    503 vop_closeextattr {
    504 	IN LOCKED=YES struct vnode *vp;
    505 	IN int commit;
    506 	IN kauth_cred_t cred;
    507 };
    508 
    509 #
    510 #% getextattr	vp L L L
    511 #
    512 vop_getextattr {
    513 	IN LOCKED=YES struct vnode *vp;
    514 	IN int attrnamespace;
    515 	IN const char *name;
    516 	INOUT struct uio *uio;
    517 	OUT size_t *size;
    518 	IN kauth_cred_t cred;
    519 };
    520 
    521 #
    522 #% listextattr	vp L L L
    523 #
    524 vop_listextattr {
    525 	IN LOCKED=YES struct vnode *vp;
    526 	IN int attrnamespace;
    527 	INOUT struct uio *uio;
    528 	OUT size_t *size;
    529 	IN kauth_cred_t cred;
    530 };
    531 
    532 #
    533 #% openextattr	vp L L L
    534 #
    535 vop_openextattr {
    536 	IN LOCKED=YES struct vnode *vp;
    537 	IN kauth_cred_t cred;
    538 };
    539 
    540 #
    541 #% deleteextattr vp L L L
    542 #
    543 vop_deleteextattr {
    544 	IN LOCKED=YES struct vnode *vp;
    545 	IN int attrnamespace;
    546 	IN const char *name;
    547 	IN kauth_cred_t cred;
    548 };
    549 
    550 #
    551 #% setextattr	vp L L L
    552 #
    553 vop_setextattr {
    554 	IN LOCKED=YES struct vnode *vp;
    555 	IN int attrnamespace;
    556 	IN const char *name;
    557 	INOUT struct uio *uio;
    558 	IN kauth_cred_t cred;
    559 };
    560