Home | History | Annotate | Line # | Download | only in kern
vnode_if.src revision 1.71
      1 #	$NetBSD: vnode_if.src,v 1.71 2017/04/11 14:25:00 riastradh 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 LOCKED=YES 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 LOCKED=YES 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 #% fallocate  vp      L L L
    175 #
    176 vop_fallocate {
    177 	IN LOCKED=YES struct vnode *vp;
    178 	IN off_t pos;
    179 	IN off_t len;
    180 };
    181 
    182 #
    183 #% fdiscard   vp      L L L
    184 #
    185 vop_fdiscard {
    186 	IN LOCKED=YES struct vnode *vp;
    187 	IN off_t pos;
    188 	IN off_t len;
    189 };
    190 
    191 #
    192 #% ioctl      vp      U U U
    193 #
    194 vop_ioctl {
    195 	FSTRANS=NO
    196 	IN LOCKED=NO struct vnode *vp;
    197 	IN u_long command;
    198 	IN void *data;
    199 	IN int fflag;
    200 	IN kauth_cred_t cred;
    201 };
    202 
    203 #
    204 #% fcntl      vp      U U U
    205 #
    206 vop_fcntl {
    207 	FSTRANS=NO
    208 	IN LOCKED=NO struct vnode *vp;
    209 	IN u_int command;
    210 	IN void *data;
    211 	IN int fflag;
    212 	IN kauth_cred_t cred;
    213 };
    214 
    215 #
    216 #% poll     vp      U U U
    217 #
    218 vop_poll {
    219 	IN LOCKED=NO struct vnode *vp;
    220 	IN int events;
    221 };
    222 
    223 #
    224 #% kqfilter     vp      U U U
    225 #
    226 vop_kqfilter {
    227 	IN LOCKED=NO struct vnode *vp;
    228 	IN struct knote *kn;
    229 };
    230 
    231 #
    232 #% revoke     vp      U U U
    233 #
    234 vop_revoke {
    235 	FSTRANS=NO
    236 	IN LOCKED=NO struct vnode *vp;
    237 	IN int flags;
    238 };
    239 
    240 #     
    241 #% mmap      vp      = = =
    242 #
    243 vop_mmap {
    244 	IN struct vnode *vp;
    245 	IN vm_prot_t prot;
    246 	IN kauth_cred_t cred;
    247 };
    248 
    249 #
    250 #% fsync      vp      L L L
    251 #
    252 vop_fsync {
    253 	IN LOCKED=YES struct vnode *vp;
    254 	IN kauth_cred_t cred;
    255 	IN int flags;
    256 	IN off_t offlo;
    257 	IN off_t offhi;
    258 };
    259 
    260 #
    261 # Needs work: Is newoff right?  What's it mean?
    262 # XXX Locking protocol?
    263 #
    264 vop_seek {
    265 	IN struct vnode *vp;
    266 	IN off_t oldoff;
    267 	IN off_t newoff;
    268 	IN kauth_cred_t cred;
    269 };
    270 
    271 #
    272 #% remove     dvp     L U U
    273 #% remove     vp      L U U
    274 #
    275 #! remove cnp	DELETE, LOCKPARENT | LOCKLEAF
    276 #
    277 vop_remove {
    278 	IN LOCKED=YES WILLPUT struct vnode *dvp;
    279 	IN LOCKED=YES WILLPUT struct vnode *vp;
    280 	IN struct componentname *cnp;
    281 };
    282 
    283 #
    284 #% link               dvp     L L L
    285 #% link               vp      U U U
    286 #
    287 #! link	 cnp	CREATE, LOCKPARENT
    288 #
    289 vop_link {
    290 	VERSION 2
    291 	IN LOCKED=YES struct vnode *dvp;
    292 	IN LOCKED=NO struct vnode *vp;
    293 	IN struct componentname *cnp;
    294 };
    295 
    296 #
    297 #% rename     fdvp    U U U
    298 #% rename     fvp     U U U
    299 #% rename     tdvp    L U U
    300 #% rename     tvp     X U U
    301 #
    302 #! rename fcnp	DELETE,	LOCKPARENT
    303 #! rename tcnp	RENAME, LOCKPARENT | LOCKLEAF | NOCACHE
    304 #
    305 vop_rename {
    306 	IN LOCKED=NO WILLRELE struct vnode *fdvp;
    307 	IN LOCKED=NO WILLRELE struct vnode *fvp;
    308 	IN struct componentname *fcnp;
    309 	IN LOCKED=YES WILLPUT struct vnode *tdvp;
    310 	IN WILLPUT struct vnode *tvp;
    311 	IN struct componentname *tcnp;
    312 };
    313 
    314 #
    315 #% mkdir      dvp     L L L
    316 #% mkdir      vpp     - U - 
    317 #
    318 #! mkdir cnp	CREATE, LOCKPARENT
    319 #
    320 vop_mkdir {
    321 	VERSION 3
    322 	IN LOCKED=YES struct vnode *dvp;
    323 	OUT WILLMAKE struct vnode **vpp;
    324 	IN struct componentname *cnp;
    325 	IN struct vattr *vap;
    326 };
    327 
    328 #
    329 #% rmdir      dvp     L U U
    330 #% rmdir      vp      L U U
    331 #
    332 #! rmdir cnp	DELETE, LOCKPARENT | LOCKLEAF
    333 #
    334 vop_rmdir {
    335 	IN LOCKED=YES WILLPUT struct vnode *dvp;
    336 	IN LOCKED=YES WILLPUT struct vnode *vp;
    337 	IN struct componentname *cnp;
    338 };
    339 
    340 #
    341 #% symlink    dvp     L L L
    342 #% symlink    vpp     - U -
    343 #
    344 #! symlink cnp	CREATE, LOCKPARENT
    345 #
    346 vop_symlink {
    347 	VERSION 3
    348 	IN LOCKED=YES struct vnode *dvp;
    349 	OUT WILLMAKE struct vnode **vpp;
    350 	IN struct componentname *cnp;
    351 	IN struct vattr *vap;
    352 	IN char *target;
    353 };
    354 
    355 #
    356 #% readdir    vp      L L L   
    357 #
    358 vop_readdir {
    359 	IN LOCKED=YES struct vnode *vp;
    360 	INOUT struct uio *uio;
    361 	IN kauth_cred_t cred;
    362 	OUT int *eofflag;
    363 	OUT off_t **cookies;
    364 	IN int *ncookies;
    365 };
    366 
    367 #
    368 #% readlink   vp      L L L
    369 #
    370 vop_readlink {
    371 	IN LOCKED=YES struct vnode *vp;
    372 	INOUT struct uio *uio;
    373 	IN kauth_cred_t cred;
    374 };
    375 
    376 #
    377 #% abortop    dvp     = = =
    378 #
    379 #! abortop cnp	as appropriate.
    380 #
    381 vop_abortop {
    382 	IN struct vnode *dvp;
    383 	IN struct componentname *cnp;
    384 };
    385 
    386 #
    387 #% inactive   vp      L L L
    388 #
    389 vop_inactive {
    390 	VERSION 2
    391 	IN LOCKED=YES struct vnode *vp;
    392 	INOUT bool *recycle;
    393 };
    394 
    395 #
    396 #% reclaim    vp      U U U
    397 #
    398 vop_reclaim {
    399 	FSTRANS=NO
    400 	IN LOCKED=NO struct vnode *vp;
    401 };
    402 
    403 #
    404 #% lock               vp      U L U
    405 #
    406 vop_lock {
    407 	FSTRANS=NO
    408 	IN LOCKED=NO struct vnode *vp;
    409 	IN int flags;
    410 };
    411 
    412 #
    413 #% unlock     vp      L U L
    414 #
    415 vop_unlock {
    416 	FSTRANS=NO
    417 	IN LOCKED=YES struct vnode *vp;
    418 };
    419 
    420 #
    421 #% bmap               vp      = = =
    422 #% bmap               vpp     - U -
    423 #
    424 vop_bmap {
    425 	IN struct vnode *vp;
    426 	IN daddr_t bn;
    427 	OUT struct vnode **vpp;
    428 	IN daddr_t *bnp;
    429 	OUT int *runp;
    430 };
    431 
    432 #
    433 #% strategy   vp      = = =
    434 #
    435 vop_strategy {
    436 	IN struct vnode *vp;
    437 	IN struct buf *bp;
    438 };
    439 
    440 #
    441 #% print      vp      = = =
    442 #
    443 vop_print {
    444 	IN struct vnode *vp;
    445 };
    446 
    447 #
    448 #% islocked   vp      = = =
    449 #
    450 vop_islocked {
    451 	FSTRANS=NO
    452 	IN struct vnode *vp;
    453 };
    454 
    455 #
    456 #% pathconf   vp      L L L
    457 #
    458 vop_pathconf {
    459 	IN LOCKED=YES struct vnode *vp;
    460 	IN int name;
    461 	OUT register_t *retval;
    462 };
    463 
    464 #
    465 #% advlock    vp      U U U
    466 #
    467 vop_advlock {
    468 	IN LOCKED=NO struct vnode *vp;
    469 	IN void *id;
    470 	IN int op;
    471 	IN struct flock *fl;
    472 	IN int flags;
    473 };
    474 
    475 #
    476 #% whiteout   dvp     L L L
    477 #% whiteout   cnp     - - -
    478 #% whiteout   flag    - - -
    479 #
    480 #! whiteout cnp	CREATE, LOCKPARENT
    481 # 
    482 vop_whiteout {
    483 	IN LOCKED=YES struct vnode *dvp;
    484 	IN struct componentname *cnp;
    485 	IN int flags;
    486 };
    487 
    488 #
    489 #% getpages	vp = = =
    490 #
    491 vop_getpages {
    492 	FSTRANS=NO
    493 	IN struct vnode *vp;
    494 	IN voff_t offset;
    495 	IN struct vm_page **m;
    496 	IN int *count;
    497 	IN int centeridx;
    498 	IN vm_prot_t access_type;
    499 	IN int advice;
    500 	IN int flags;
    501 };
    502 
    503 #
    504 #% putpages	vp = = =
    505 #
    506 vop_putpages {
    507 	FSTRANS=NO
    508 	IN struct vnode *vp;
    509 	IN voff_t offlo;
    510 	IN voff_t offhi;
    511 	IN int flags;
    512 };
    513 
    514 #
    515 #% closeextattr	vp L L L
    516 #
    517 vop_closeextattr {
    518 	IN LOCKED=YES struct vnode *vp;
    519 	IN int commit;
    520 	IN kauth_cred_t cred;
    521 };
    522 
    523 #
    524 #% getextattr	vp L L L
    525 #
    526 vop_getextattr {
    527 	IN LOCKED=YES struct vnode *vp;
    528 	IN int attrnamespace;
    529 	IN const char *name;
    530 	INOUT struct uio *uio;
    531 	OUT size_t *size;
    532 	IN kauth_cred_t cred;
    533 };
    534 
    535 #
    536 #% listextattr	vp L L L
    537 #
    538 vop_listextattr {
    539 	IN LOCKED=YES struct vnode *vp;
    540 	IN int attrnamespace;
    541 	INOUT struct uio *uio;
    542 	OUT size_t *size;
    543 	IN int flag;
    544 	IN kauth_cred_t cred;
    545 };
    546 
    547 #
    548 #% openextattr	vp L L L
    549 #
    550 vop_openextattr {
    551 	IN LOCKED=YES struct vnode *vp;
    552 	IN kauth_cred_t cred;
    553 };
    554 
    555 #
    556 #% deleteextattr vp L L L
    557 #
    558 vop_deleteextattr {
    559 	IN LOCKED=YES struct vnode *vp;
    560 	IN int attrnamespace;
    561 	IN const char *name;
    562 	IN kauth_cred_t cred;
    563 };
    564 
    565 #
    566 #% setextattr	vp L L L
    567 #
    568 vop_setextattr {
    569 	IN LOCKED=YES struct vnode *vp;
    570 	IN int attrnamespace;
    571 	IN const char *name;
    572 	INOUT struct uio *uio;
    573 	IN kauth_cred_t cred;
    574 };
    575