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