Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.66
      1 #	$NetBSD: vnode_if.src,v 1.66 2014/02/07 15:26:42 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. Neither the name of the University nor the names of its contributors
     15 #    may be used to endorse or promote products derived from this software
     16 #    without specific prior written permission.
     17 #
     18 # THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     21 # ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     24 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     26 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     27 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     28 # SUCH DAMAGE.
     29 #
     30 #	@(#)vnode_if.src	8.14 (Berkeley) 8/6/95
     31 #
     32 #
     33 
     34 # 
     35 # Above each of the vop descriptors is a specification of the locking
     36 # protocol used by each vop call.  The first column is the name of
     37 # the variable, the remaining three columns are in, out and error
     38 # respectively.  The "in" column defines the lock state on input,
     39 # the "out" column defines the state on successful return, and the
     40 # "error" column defines the locking state on error exit.
     41 #     
     42 # The locking value can take the following values:
     43 # L: locked.
     44 # U: unlocked.
     45 # -: not applicable.  vnode does not yet (or no longer) exists.
     46 # =: the same on input and output, may be either L or U.
     47 # X: locked if not nil.
     48 #
     49 # For operations other than VOP_LOOKUP which require a component name
     50 # parameter, the flags required for the initial namei() call are listed.
     51 # Additional flags may be added to the namei() call, but these are required.
     52 #     
     53 
     54 #
     55 #% bwrite     vp      = = =
     56 #
     57 vop_bwrite {
     58 	IN struct vnode *vp;
     59 	IN struct buf *bp;
     60 };
     61  
     62 #
     63 #% lookup     dvp     L L L
     64 #% lookup     vpp     - U -
     65 #
     66 #    Note especially that *vpp may equal dvp.
     67 #
     68 #    More details:
     69 #     All lookups find the named node (creating the vnode if needed) and
     70 #          return it, referenced and unlocked, in *vpp.
     71 #     On failure, *vpp is NULL, and *dvp is left locked.
     72 #
     73 vop_lookup {
     74 	VERSION 2
     75 	IN struct vnode *dvp;
     76 	OUT WILLMAKE struct vnode **vpp;
     77 	IN struct componentname *cnp;
     78 };
     79 
     80 #
     81 #% create     dvp     L L L
     82 #% create     vpp     - U -
     83 #
     84 #! create cnp	CREATE, LOCKPARENT
     85 #
     86 vop_create {
     87 	VERSION 3
     88 	IN LOCKED=YES struct vnode *dvp;
     89 	OUT WILLMAKE struct vnode **vpp;
     90 	IN struct componentname *cnp;
     91 	IN struct vattr *vap;
     92 };
     93 
     94 #
     95 #% mknod      dvp     L L L
     96 #% mknod      vpp     - U -
     97 #
     98 #! mknod cnp	CREATE, LOCKPARENT
     99 #
    100 vop_mknod {
    101 	VERSION 3
    102 	IN LOCKED=YES struct vnode *dvp;
    103 	OUT WILLMAKE struct vnode **vpp;
    104 	IN struct componentname *cnp;
    105 	IN struct vattr *vap;
    106 };
    107 
    108 #
    109 #% open               vp      L L L
    110 #
    111 vop_open {
    112 	IN LOCKED=YES struct vnode *vp;
    113 	IN int mode;
    114 	IN kauth_cred_t cred;
    115 };
    116 
    117 #
    118 #% close      vp      L L L
    119 #
    120 vop_close {
    121 	IN LOCKED=YES struct vnode *vp;
    122 	IN int fflag;
    123 	IN kauth_cred_t cred;
    124 };
    125 
    126 #
    127 #% access     vp      L L L
    128 #
    129 vop_access {
    130 	IN LOCKED=YES struct vnode *vp;
    131 	IN int mode;
    132 	IN kauth_cred_t cred;
    133 };
    134 
    135 #
    136 #% getattr    vp      L L L
    137 #
    138 vop_getattr {
    139 	IN struct vnode *vp;
    140 	IN struct vattr *vap;
    141 	IN kauth_cred_t cred;
    142 };
    143 
    144 #
    145 #% setattr    vp      L L L
    146 #
    147 vop_setattr {
    148 	IN LOCKED=YES struct vnode *vp;
    149 	IN struct vattr *vap;
    150 	IN kauth_cred_t cred;
    151 };
    152 
    153 #
    154 #% read               vp      L L L
    155 #
    156 vop_read {
    157 	IN LOCKED=YES struct vnode *vp;
    158 	INOUT struct uio *uio;
    159 	IN int ioflag;
    160 	IN kauth_cred_t cred;
    161 };
    162 
    163 #
    164 #% write      vp      L L L
    165 #
    166 vop_write {
    167 	IN LOCKED=YES struct vnode *vp;
    168 	INOUT struct uio *uio;
    169 	IN int ioflag;
    170 	IN kauth_cred_t cred;
    171 };
    172 
    173 #
    174 #% ioctl      vp      U U U
    175 #
    176 vop_ioctl {
    177 	IN LOCKED=NO struct vnode *vp;
    178 	IN u_long command;
    179 	IN void *data;
    180 	IN int fflag;
    181 	IN kauth_cred_t cred;
    182 };
    183 
    184 #
    185 #% fcntl      vp      U U U
    186 #
    187 vop_fcntl {
    188 	IN LOCKED=NO struct vnode *vp;
    189 	IN u_int command;
    190 	IN void *data;
    191 	IN int fflag;
    192 	IN kauth_cred_t cred;
    193 };
    194 
    195 #
    196 #% poll     vp      U U U
    197 #
    198 vop_poll {
    199 	IN LOCKED=NO struct vnode *vp;
    200 	IN int events;
    201 };
    202 
    203 #
    204 #% kqfilter     vp      U U U
    205 #
    206 vop_kqfilter {
    207 	IN LOCKED=NO struct vnode *vp;
    208 	IN struct knote *kn;
    209 };
    210 
    211 #
    212 #% revoke     vp      U U U
    213 #
    214 vop_revoke {
    215 	IN LOCKED=NO struct vnode *vp;
    216 	IN int flags;
    217 };
    218 
    219 #     
    220 #% mmap      vp      = = =
    221 #
    222 vop_mmap {
    223 	IN struct vnode *vp;
    224 	IN vm_prot_t prot;
    225 	IN kauth_cred_t cred;
    226 };
    227 
    228 #
    229 #% fsync      vp      L L L
    230 #
    231 vop_fsync {
    232 	IN LOCKED=YES struct vnode *vp;
    233 	IN kauth_cred_t cred;
    234 	IN int flags;
    235 	IN off_t offlo;
    236 	IN off_t offhi;
    237 };
    238 
    239 #
    240 # Needs work: Is newoff right?  What's it mean?
    241 # XXX Locking protocol?
    242 #
    243 vop_seek {
    244 	IN struct vnode *vp;
    245 	IN off_t oldoff;
    246 	IN off_t newoff;
    247 	IN kauth_cred_t cred;
    248 };
    249 
    250 #
    251 #% remove     dvp     L U U
    252 #% remove     vp      L U U
    253 #
    254 #! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
    255 #
    256 vop_remove {
    257 	IN LOCKED=YES WILLPUT struct vnode *dvp;
    258 	IN LOCKED=YES WILLPUT struct vnode *vp;
    259 	IN struct componentname *cnp;
    260 };
    261 
    262 #
    263 #% link               dvp     L U U
    264 #% link               vp      U U U
    265 #
    266 #! link	 cnp	CREATE, LOCKPARENT
    267 #
    268 vop_link {
    269 	IN LOCKED=YES WILLPUT struct vnode *dvp;
    270 	IN LOCKED=NO struct vnode *vp;
    271 	IN struct componentname *cnp;
    272 };
    273 
    274 #
    275 #% rename     fdvp    U U U
    276 #% rename     fvp     U U U
    277 #% rename     tdvp    L U U
    278 #% rename     tvp     X U U
    279 #
    280 #! rename fcnp	DELETE,	LOCKPARENT
    281 #! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
    282 #
    283 vop_rename {
    284 	IN LOCKED=NO WILLRELE struct vnode *fdvp;
    285 	IN LOCKED=NO WILLRELE struct vnode *fvp;
    286 	IN struct componentname *fcnp;
    287 	IN LOCKED=YES WILLPUT struct vnode *tdvp;
    288 	IN WILLPUT struct vnode *tvp;
    289 	IN struct componentname *tcnp;
    290 };
    291 
    292 #
    293 #% mkdir      dvp     L L L
    294 #% mkdir      vpp     - U - 
    295 #
    296 #! mkdir cnp	CREATE, LOCKPARENT
    297 #
    298 vop_mkdir {
    299 	VERSION 3
    300 	IN LOCKED=YES struct vnode *dvp;
    301 	OUT WILLMAKE struct vnode **vpp;
    302 	IN struct componentname *cnp;
    303 	IN struct vattr *vap;
    304 };
    305 
    306 #
    307 #% rmdir      dvp     L U U
    308 #% rmdir      vp      L U U
    309 #
    310 #! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
    311 #
    312 vop_rmdir {
    313 	IN LOCKED=YES WILLPUT struct vnode *dvp;
    314 	IN LOCKED=YES WILLPUT struct vnode *vp;
    315 	IN struct componentname *cnp;
    316 };
    317 
    318 #
    319 #% symlink    dvp     L L L
    320 #% symlink    vpp     - U -
    321 #
    322 #! symlink cnp	CREATE, LOCKPARENT
    323 #
    324 vop_symlink {
    325 	VERSION 3
    326 	IN LOCKED=YES struct vnode *dvp;
    327 	OUT WILLMAKE struct vnode **vpp;
    328 	IN struct componentname *cnp;
    329 	IN struct vattr *vap;
    330 	IN char *target;
    331 };
    332 
    333 #
    334 #% readdir    vp      L L L   
    335 #
    336 vop_readdir {
    337 	IN LOCKED=YES struct vnode *vp;
    338 	INOUT struct uio *uio;
    339 	IN kauth_cred_t cred;
    340 	OUT int *eofflag;
    341 	OUT off_t **cookies;
    342 	IN int *ncookies;
    343 };
    344 
    345 #
    346 #% readlink   vp      L L L
    347 #
    348 vop_readlink {
    349 	IN LOCKED=YES struct vnode *vp;
    350 	INOUT struct uio *uio;
    351 	IN kauth_cred_t cred;
    352 };
    353 
    354 #
    355 #% abortop    dvp     = = =
    356 #
    357 #! abortop cnp	as appropriate.
    358 #
    359 vop_abortop {
    360 	IN struct vnode *dvp;
    361 	IN struct componentname *cnp;
    362 };
    363 
    364 #
    365 #% inactive   vp      L U U  
    366 #
    367 vop_inactive {
    368 	IN LOCKED=YES WILLUNLOCK struct vnode *vp;
    369 	INOUT bool *recycle;
    370 };
    371 
    372 #
    373 #% reclaim    vp      U U U
    374 #
    375 vop_reclaim {
    376 	IN LOCKED=NO struct vnode *vp;
    377 };
    378 
    379 #
    380 #% lock               vp      U L U
    381 #
    382 vop_lock {
    383 	IN LOCKED=NO struct vnode *vp;
    384 	IN int flags;
    385 };
    386 
    387 #
    388 #% unlock     vp      L U L
    389 #
    390 vop_unlock {
    391 	IN LOCKED=YES struct vnode *vp;
    392 };
    393 
    394 #
    395 #% bmap               vp      = = =
    396 #% bmap               vpp     - U -
    397 #
    398 vop_bmap {
    399 	IN struct vnode *vp;
    400 	IN daddr_t bn;
    401 	OUT struct vnode **vpp;
    402 	IN daddr_t *bnp;
    403 	OUT int *runp;
    404 };
    405 
    406 #
    407 #% strategy   vp      = = =
    408 #
    409 vop_strategy {
    410 	IN struct vnode *vp;
    411 	IN struct buf *bp;
    412 };
    413 
    414 #
    415 #% print      vp      = = =
    416 #
    417 vop_print {
    418 	IN struct vnode *vp;
    419 };
    420 
    421 #
    422 #% islocked   vp      = = =
    423 #
    424 vop_islocked {
    425 	IN struct vnode *vp;
    426 };
    427 
    428 #
    429 #% pathconf   vp      L L L
    430 #
    431 vop_pathconf {
    432 	IN LOCKED=YES struct vnode *vp;
    433 	IN int name;
    434 	OUT register_t *retval;
    435 };
    436 
    437 #
    438 #% advlock    vp      U U U
    439 #
    440 vop_advlock {
    441 	IN LOCKED=NO struct vnode *vp;
    442 	IN void *id;
    443 	IN int op;
    444 	IN struct flock *fl;
    445 	IN int flags;
    446 };
    447 
    448 #
    449 #% whiteout   dvp     L L L
    450 #% whiteout   cnp     - - -
    451 #% whiteout   flag    - - -
    452 #
    453 #! whiteout cnp	CREATE, LOCKPARENT
    454 # 
    455 vop_whiteout {
    456 	IN LOCKED=YES struct vnode *dvp;
    457 	IN struct componentname *cnp;
    458 	IN int flags;
    459 };
    460 
    461 #
    462 #% getpages	vp = = =
    463 #
    464 vop_getpages {
    465 	IN struct vnode *vp;
    466 	IN voff_t offset;
    467 	IN struct vm_page **m;
    468 	IN int *count;
    469 	IN int centeridx;
    470 	IN vm_prot_t access_type;
    471 	IN int advice;
    472 	IN int flags;
    473 };
    474 
    475 #
    476 #% putpages	vp = = =
    477 #
    478 vop_putpages {
    479 	IN struct vnode *vp;
    480 	IN voff_t offlo;
    481 	IN voff_t offhi;
    482 	IN int flags;
    483 };
    484 
    485 #
    486 #% closeextattr	vp L L L
    487 #
    488 vop_closeextattr {
    489 	IN LOCKED=YES struct vnode *vp;
    490 	IN int commit;
    491 	IN kauth_cred_t cred;
    492 };
    493 
    494 #
    495 #% getextattr	vp L L L
    496 #
    497 vop_getextattr {
    498 	IN LOCKED=YES struct vnode *vp;
    499 	IN int attrnamespace;
    500 	IN const char *name;
    501 	INOUT struct uio *uio;
    502 	OUT size_t *size;
    503 	IN kauth_cred_t cred;
    504 };
    505 
    506 #
    507 #% listextattr	vp L L L
    508 #
    509 vop_listextattr {
    510 	IN LOCKED=YES struct vnode *vp;
    511 	IN int attrnamespace;
    512 	INOUT struct uio *uio;
    513 	OUT size_t *size;
    514 	IN int flag;
    515 	IN kauth_cred_t cred;
    516 };
    517 
    518 #
    519 #% openextattr	vp L L L
    520 #
    521 vop_openextattr {
    522 	IN LOCKED=YES struct vnode *vp;
    523 	IN kauth_cred_t cred;
    524 };
    525 
    526 #
    527 #% deleteextattr vp L L L
    528 #
    529 vop_deleteextattr {
    530 	IN LOCKED=YES struct vnode *vp;
    531 	IN int attrnamespace;
    532 	IN const char *name;
    533 	IN kauth_cred_t cred;
    534 };
    535 
    536 #
    537 #% setextattr	vp L L L
    538 #
    539 vop_setextattr {
    540 	IN LOCKED=YES struct vnode *vp;
    541 	IN int attrnamespace;
    542 	IN const char *name;
    543 	INOUT struct uio *uio;
    544 	IN kauth_cred_t cred;
    545 };
    546