1#- 2# Copyright (c) 1992, 1993 3# The Regents of the University of California. All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 3. Neither the name of the University nor the names of its contributors 14# may be used to endorse or promote products derived from this software 15# without specific prior written permission. 16# 17# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27# SUCH DAMAGE. 28# 29# @(#)vnode_if.src 8.12 (Berkeley) 5/14/95 30# $FreeBSD$ 31# 32 33# 34# Above each of the vop descriptors in lines starting with %% 35# is a specification of the locking protocol used by each vop call. 36# The first column is the name of the variable, the remaining three 37# columns are in, out and error respectively. The "in" column defines 38# the lock state on input, the "out" column defines the state on successful 39# return, and the "error" column defines the locking state on error exit. 40# 41# The locking value can take the following values: 42# L: locked; not converted to type of lock. 43# E: locked with exclusive lock for this process. 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# 48# The paramater named "vpp" is assumed to be always used with double 49# indirection (**vpp) and that name is hard-coded in vnode_if.awk ! 50# 51# Lines starting with %! specify a pre or post-condition function 52# to call before/after the vop call. 53# 54# If other such parameters are introduced, they have to be added to 55# the AWK script at the head of the definition of "add_debug_code()". 56# 57 58vop_islocked { 59 IN struct vnode *vp; 60}; 61 62 63%% lookup dvp L L L 64%% lookup vpp - L - 65 66# XXX - the lookup locking protocol defies simple description and depends 67# on the flags and operation fields in the (cnp) structure. Note 68# especially that *vpp may equal dvp and both may be locked. 69 70vop_lookup { 71 IN struct vnode *dvp; 72 INOUT struct vnode **vpp; 73 IN struct componentname *cnp; 74}; 75 76 77%% cachedlookup dvp L L L 78%% cachedlookup vpp - L - 79 80# This must be an exact copy of lookup. See kern/vfs_cache.c for details. 81 82vop_cachedlookup { 83 IN struct vnode *dvp; 84 INOUT struct vnode **vpp; 85 IN struct componentname *cnp; 86}; 87 88 89%% create dvp E E E 90%% create vpp - L - 91%! create pre vop_create_pre 92%! create post vop_create_post 93 94vop_create { 95 IN struct vnode *dvp; 96 OUT struct vnode **vpp; 97 IN struct componentname *cnp; 98 IN struct vattr *vap; 99}; 100 101 102%% whiteout dvp E E E 103%! whiteout pre vop_whiteout_pre 104%! whiteout post vop_whiteout_post 105 106vop_whiteout { 107 IN struct vnode *dvp; 108 IN struct componentname *cnp; 109 IN int flags; 110}; 111 112 113%% mknod dvp E E E 114%% mknod vpp - L - 115%! mknod pre vop_mknod_pre 116%! mknod post vop_mknod_post 117 118vop_mknod { 119 IN struct vnode *dvp; 120 OUT struct vnode **vpp; 121 IN struct componentname *cnp; 122 IN struct vattr *vap; 123}; 124 125 126%% open vp L L L 127%! open post vop_open_post 128 129vop_open { 130 IN struct vnode *vp; 131 IN int mode; 132 IN struct ucred *cred; 133 IN struct thread *td; 134 IN struct file *fp; 135}; 136 137 138%% close vp L L L 139%! close post vop_close_post 140 141vop_close { 142 IN struct vnode *vp; 143 IN int fflag; 144 IN struct ucred *cred; 145 IN struct thread *td; 146}; 147 148 149%% fplookup_vexec vp - - - 150%! fplookup_vexec debugpre vop_fplookup_vexec_debugpre 151%! fplookup_vexec debugpost vop_fplookup_vexec_debugpost 152 153vop_fplookup_vexec { 154 IN struct vnode *vp; 155 IN struct ucred *cred; 156}; 157 158 159%% fplookup_symlink vp - - - 160%! fplookup_symlink debugpre vop_fplookup_symlink_debugpre 161%! fplookup_symlink debugpost vop_fplookup_symlink_debugpost 162 163vop_fplookup_symlink { 164 IN struct vnode *vp; 165 IN struct cache_fpl *fpl; 166}; 167 168 169%% access vp L L L 170 171vop_access { 172 IN struct vnode *vp; 173 IN accmode_t accmode; 174 IN struct ucred *cred; 175 IN struct thread *td; 176}; 177 178 179%% accessx vp L L L 180 181vop_accessx { 182 IN struct vnode *vp; 183 IN accmode_t accmode; 184 IN struct ucred *cred; 185 IN struct thread *td; 186}; 187 188 189%% stat vp L L L 190 191vop_stat { 192 IN struct vnode *vp; 193 OUT struct stat *sb; 194 IN struct ucred *active_cred; 195 IN struct ucred *file_cred; 196 IN struct thread *td; 197}; 198 199 200%% getattr vp L L L 201 202vop_getattr { 203 IN struct vnode *vp; 204 OUT struct vattr *vap; 205 IN struct ucred *cred; 206}; 207 208 209%% setattr vp E E E 210%! setattr pre vop_setattr_pre 211%! setattr post vop_setattr_post 212 213vop_setattr { 214 IN struct vnode *vp; 215 IN struct vattr *vap; 216 IN struct ucred *cred; 217}; 218 219 220%% mmapped vp L L L 221 222vop_mmapped { 223 IN struct vnode *vp; 224}; 225 226 227%% read vp L L L 228%! read post vop_read_post 229 230vop_read { 231 IN struct vnode *vp; 232 INOUT struct uio *uio; 233 IN int ioflag; 234 IN struct ucred *cred; 235}; 236 237 238%% read_pgcache vp - - - 239%! read_pgcache post vop_read_pgcache_post 240 241vop_read_pgcache { 242 IN struct vnode *vp; 243 INOUT struct uio *uio; 244 IN int ioflag; 245 IN struct ucred *cred; 246}; 247 248 249%% write vp L L L 250%! write pre VOP_WRITE_PRE 251%! write post VOP_WRITE_POST 252 253vop_write { 254 IN struct vnode *vp; 255 INOUT struct uio *uio; 256 IN int ioflag; 257 IN struct ucred *cred; 258}; 259 260 261%% ioctl vp U U U 262 263vop_ioctl { 264 IN struct vnode *vp; 265 IN u_long command; 266 IN void *data; 267 IN int fflag; 268 IN struct ucred *cred; 269 IN struct thread *td; 270}; 271 272 273%% poll vp U U U 274 275vop_poll { 276 IN struct vnode *vp; 277 IN int events; 278 IN struct ucred *cred; 279 IN struct thread *td; 280}; 281 282 283%% kqfilter vp U U U 284 285vop_kqfilter { 286 IN struct vnode *vp; 287 IN struct knote *kn; 288}; 289 290 291%% revoke vp L L L 292 293vop_revoke { 294 IN struct vnode *vp; 295 IN int flags; 296}; 297 298 299%% fsync vp - - - 300%! fsync pre vop_fsync_debugpre 301%! fsync post vop_fsync_debugpost 302 303vop_fsync { 304 IN struct vnode *vp; 305 IN int waitfor; 306 IN struct thread *td; 307}; 308 309 310%% remove dvp E E E 311%% remove vp E E E 312%! remove pre vop_remove_pre 313%! remove post vop_remove_post 314 315vop_remove { 316 IN struct vnode *dvp; 317 IN struct vnode *vp; 318 IN struct componentname *cnp; 319}; 320 321 322%% link tdvp E E E 323%% link vp E E E 324%! link pre vop_link_pre 325%! link post vop_link_post 326 327vop_link { 328 IN struct vnode *tdvp; 329 IN struct vnode *vp; 330 IN struct componentname *cnp; 331}; 332 333 334%! rename pre vop_rename_pre 335%! rename post vop_rename_post 336 337vop_rename { 338 IN WILLRELE struct vnode *fdvp; 339 IN WILLRELE struct vnode *fvp; 340 IN struct componentname *fcnp; 341 IN WILLRELE struct vnode *tdvp; 342 IN WILLRELE struct vnode *tvp; 343 IN struct componentname *tcnp; 344}; 345 346 347%% mkdir dvp E E E 348%% mkdir vpp - E - 349%! mkdir pre vop_mkdir_pre 350%! mkdir post vop_mkdir_post 351%! mkdir debugpost vop_mkdir_debugpost 352 353vop_mkdir { 354 IN struct vnode *dvp; 355 OUT struct vnode **vpp; 356 IN struct componentname *cnp; 357 IN struct vattr *vap; 358}; 359 360 361%% rmdir dvp E E E 362%% rmdir vp E E E 363%! rmdir pre vop_rmdir_pre 364%! rmdir post vop_rmdir_post 365 366vop_rmdir { 367 IN struct vnode *dvp; 368 IN struct vnode *vp; 369 IN struct componentname *cnp; 370}; 371 372 373%% symlink dvp E E E 374%% symlink vpp - E - 375%! symlink pre vop_symlink_pre 376%! symlink post vop_symlink_post 377 378vop_symlink { 379 IN struct vnode *dvp; 380 OUT struct vnode **vpp; 381 IN struct componentname *cnp; 382 IN struct vattr *vap; 383 IN const char *target; 384}; 385 386 387%% readdir vp L L L 388%! readdir post vop_readdir_post 389 390vop_readdir { 391 IN struct vnode *vp; 392 INOUT struct uio *uio; 393 IN struct ucred *cred; 394 INOUT int *eofflag; 395 OUT int *ncookies; 396 INOUT u_long **cookies; 397}; 398 399 400%% readlink vp L L L 401 402vop_readlink { 403 IN struct vnode *vp; 404 INOUT struct uio *uio; 405 IN struct ucred *cred; 406}; 407 408 409%% inactive vp E E E 410 411vop_inactive { 412 IN struct vnode *vp; 413}; 414 415%! need_inactive debugpre vop_need_inactive_debugpre 416%! need_inactive debugpost vop_need_inactive_debugpost 417 418vop_need_inactive { 419 IN struct vnode *vp; 420}; 421 422%% reclaim vp E E E 423%! reclaim post vop_reclaim_post 424 425vop_reclaim { 426 IN struct vnode *vp; 427}; 428 429 430%! lock1 debugpre vop_lock_debugpre 431%! lock1 debugpost vop_lock_debugpost 432 433vop_lock1 { 434 IN struct vnode *vp; 435 IN int flags; 436 IN const char *file; 437 IN int line; 438}; 439 440 441%! unlock debugpre vop_unlock_debugpre 442 443vop_unlock { 444 IN struct vnode *vp; 445}; 446 447 448%% bmap vp L L L 449 450vop_bmap { 451 IN struct vnode *vp; 452 IN daddr_t bn; 453 OUT struct bufobj **bop; 454 IN daddr_t *bnp; 455 OUT int *runp; 456 OUT int *runb; 457}; 458 459 460%% strategy vp L L L 461%! strategy debugpre vop_strategy_debugpre 462 463vop_strategy { 464 IN struct vnode *vp; 465 IN struct buf *bp; 466}; 467 468 469%% getwritemount vp = = = 470 471vop_getwritemount { 472 IN struct vnode *vp; 473 OUT struct mount **mpp; 474}; 475 476 477%% print vp - - - 478 479vop_print { 480 IN struct vnode *vp; 481}; 482 483 484%% pathconf vp L L L 485 486vop_pathconf { 487 IN struct vnode *vp; 488 IN int name; 489 OUT long *retval; 490}; 491 492 493%% advlock vp U U U 494 495vop_advlock { 496 IN struct vnode *vp; 497 IN void *id; 498 IN int op; 499 IN struct flock *fl; 500 IN int flags; 501}; 502 503 504%% advlockasync vp U U U 505 506vop_advlockasync { 507 IN struct vnode *vp; 508 IN void *id; 509 IN int op; 510 IN struct flock *fl; 511 IN int flags; 512 IN struct task *task; 513 INOUT void **cookiep; 514}; 515 516 517%% advlockpurge vp E E E 518 519vop_advlockpurge { 520 IN struct vnode *vp; 521}; 522 523 524%% reallocblks vp E E E 525 526vop_reallocblks { 527 IN struct vnode *vp; 528 IN struct cluster_save *buflist; 529}; 530 531 532%% getpages vp L L L 533 534vop_getpages { 535 IN struct vnode *vp; 536 IN vm_page_t *m; 537 IN int count; 538 IN int *rbehind; 539 IN int *rahead; 540}; 541 542 543%% getpages_async vp L L L 544 545vop_getpages_async { 546 IN struct vnode *vp; 547 IN vm_page_t *m; 548 IN int count; 549 IN int *rbehind; 550 IN int *rahead; 551 IN vop_getpages_iodone_t *iodone; 552 IN void *arg; 553}; 554 555 556%% putpages vp L L L 557 558vop_putpages { 559 IN struct vnode *vp; 560 IN vm_page_t *m; 561 IN int count; 562 IN int sync; 563 IN int *rtvals; 564}; 565 566 567%% getacl vp L L L 568 569vop_getacl { 570 IN struct vnode *vp; 571 IN acl_type_t type; 572 OUT struct acl *aclp; 573 IN struct ucred *cred; 574 IN struct thread *td; 575}; 576 577 578%% setacl vp E E E 579%! setacl pre vop_setacl_pre 580%! setacl post vop_setacl_post 581 582vop_setacl { 583 IN struct vnode *vp; 584 IN acl_type_t type; 585 IN struct acl *aclp; 586 IN struct ucred *cred; 587 IN struct thread *td; 588}; 589 590 591%% aclcheck vp = = = 592 593vop_aclcheck { 594 IN struct vnode *vp; 595 IN acl_type_t type; 596 IN struct acl *aclp; 597 IN struct ucred *cred; 598 IN struct thread *td; 599}; 600 601 602%% closeextattr vp L L L 603 604vop_closeextattr { 605 IN struct vnode *vp; 606 IN int commit; 607 IN struct ucred *cred; 608 IN struct thread *td; 609}; 610 611 612%% getextattr vp L L L 613 614vop_getextattr { 615 IN struct vnode *vp; 616 IN int attrnamespace; 617 IN const char *name; 618 INOUT struct uio *uio; 619 OUT size_t *size; 620 IN struct ucred *cred; 621 IN struct thread *td; 622}; 623 624 625%% listextattr vp L L L 626 627vop_listextattr { 628 IN struct vnode *vp; 629 IN int attrnamespace; 630 INOUT struct uio *uio; 631 OUT size_t *size; 632 IN struct ucred *cred; 633 IN struct thread *td; 634}; 635 636 637%% openextattr vp L L L 638 639vop_openextattr { 640 IN struct vnode *vp; 641 IN struct ucred *cred; 642 IN struct thread *td; 643}; 644 645 646%% deleteextattr vp E E E 647%! deleteextattr pre vop_deleteextattr_pre 648%! deleteextattr post vop_deleteextattr_post 649 650vop_deleteextattr { 651 IN struct vnode *vp; 652 IN int attrnamespace; 653 IN const char *name; 654 IN struct ucred *cred; 655 IN struct thread *td; 656}; 657 658 659%% setextattr vp E E E 660%! setextattr pre vop_setextattr_pre 661%! setextattr post vop_setextattr_post 662 663vop_setextattr { 664 IN struct vnode *vp; 665 IN int attrnamespace; 666 IN const char *name; 667 INOUT struct uio *uio; 668 IN struct ucred *cred; 669 IN struct thread *td; 670}; 671 672 673%% setlabel vp E E E 674 675vop_setlabel { 676 IN struct vnode *vp; 677 IN struct label *label; 678 IN struct ucred *cred; 679 IN struct thread *td; 680}; 681 682 683%% vptofh vp = = = 684 685vop_vptofh { 686 IN struct vnode *vp; 687 IN struct fid *fhp; 688}; 689 690 691%% vptocnp vp L L L 692%% vptocnp vpp - U - 693 694vop_vptocnp { 695 IN struct vnode *vp; 696 OUT struct vnode **vpp; 697 INOUT char *buf; 698 INOUT size_t *buflen; 699}; 700 701 702%% allocate vp E E E 703 704vop_allocate { 705 IN struct vnode *vp; 706 INOUT off_t *offset; 707 INOUT off_t *len; 708 IN int ioflag; 709 IN struct ucred *cred; 710}; 711 712 713%% advise vp U U U 714 715vop_advise { 716 IN struct vnode *vp; 717 IN off_t start; 718 IN off_t end; 719 IN int advice; 720}; 721 722 723%% unp_bind vp E E E 724 725vop_unp_bind { 726 IN struct vnode *vp; 727 IN struct unpcb *unpcb; 728}; 729 730 731%% unp_connect vp L L L 732 733vop_unp_connect { 734 IN struct vnode *vp; 735 OUT struct unpcb **unpcb; 736}; 737 738 739%% unp_detach vp = = = 740 741vop_unp_detach { 742 IN struct vnode *vp; 743}; 744 745 746%% is_text vp L L L 747 748vop_is_text { 749 IN struct vnode *vp; 750}; 751 752 753%% set_text vp = = = 754 755vop_set_text { 756 IN struct vnode *vp; 757}; 758 759 760%% vop_unset_text vp L L L 761 762vop_unset_text { 763 IN struct vnode *vp; 764}; 765 766 767%% add_writecount vp L L L 768 769vop_add_writecount { 770 IN struct vnode *vp; 771 IN int inc; 772}; 773 774 775%% fdatasync vp - - - 776%! fdatasync pre vop_fdatasync_debugpre 777%! fdatasync post vop_fdatasync_debugpost 778 779vop_fdatasync { 780 IN struct vnode *vp; 781 IN struct thread *td; 782}; 783 784 785%% copy_file_range invp U U U 786%% copy_file_range outvp U U U 787 788vop_copy_file_range { 789 IN struct vnode *invp; 790 INOUT off_t *inoffp; 791 IN struct vnode *outvp; 792 INOUT off_t *outoffp; 793 INOUT size_t *lenp; 794 IN unsigned int flags; 795 IN struct ucred *incred; 796 IN struct ucred *outcred; 797 IN struct thread *fsizetd; 798}; 799 800 801%% vput_pair dvp E - - 802 803vop_vput_pair { 804 IN struct vnode *dvp; 805 INOUT struct vnode **vpp; 806 IN bool unlock_vp; 807}; 808 809 810# The VOPs below are spares at the end of the table to allow new VOPs to be 811# added in stable branches without breaking the KBI. New VOPs in HEAD should 812# be added above these spares. When merging a new VOP to a stable branch, 813# the new VOP should replace one of the spares. 814 815vop_spare1 { 816 IN struct vnode *vp; 817}; 818 819vop_spare2 { 820 IN struct vnode *vp; 821}; 822 823vop_spare3 { 824 IN struct vnode *vp; 825}; 826 827vop_spare4 { 828 IN struct vnode *vp; 829}; 830 831vop_spare5 { 832 IN struct vnode *vp; 833}; 834