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 L L L 300 301vop_fsync { 302 IN struct vnode *vp; 303 IN int waitfor; 304 IN struct thread *td; 305}; 306 307 308%% remove dvp E E E 309%% remove vp E E E 310%! remove pre vop_remove_pre 311%! remove post vop_remove_post 312 313vop_remove { 314 IN struct vnode *dvp; 315 IN struct vnode *vp; 316 IN struct componentname *cnp; 317}; 318 319 320%% link tdvp E E E 321%% link vp E E E 322%! link pre vop_link_pre 323%! link post vop_link_post 324 325vop_link { 326 IN struct vnode *tdvp; 327 IN struct vnode *vp; 328 IN struct componentname *cnp; 329}; 330 331 332%! rename pre vop_rename_pre 333%! rename post vop_rename_post 334 335vop_rename { 336 IN WILLRELE struct vnode *fdvp; 337 IN WILLRELE struct vnode *fvp; 338 IN struct componentname *fcnp; 339 IN WILLRELE struct vnode *tdvp; 340 IN WILLRELE struct vnode *tvp; 341 IN struct componentname *tcnp; 342}; 343 344 345%% mkdir dvp E E E 346%% mkdir vpp - E - 347%! mkdir pre vop_mkdir_pre 348%! mkdir post vop_mkdir_post 349%! mkdir debugpost vop_mkdir_debugpost 350 351vop_mkdir { 352 IN struct vnode *dvp; 353 OUT struct vnode **vpp; 354 IN struct componentname *cnp; 355 IN struct vattr *vap; 356}; 357 358 359%% rmdir dvp E E E 360%% rmdir vp E E E 361%! rmdir pre vop_rmdir_pre 362%! rmdir post vop_rmdir_post 363 364vop_rmdir { 365 IN struct vnode *dvp; 366 IN struct vnode *vp; 367 IN struct componentname *cnp; 368}; 369 370 371%% symlink dvp E E E 372%% symlink vpp - E - 373%! symlink pre vop_symlink_pre 374%! symlink post vop_symlink_post 375 376vop_symlink { 377 IN struct vnode *dvp; 378 OUT struct vnode **vpp; 379 IN struct componentname *cnp; 380 IN struct vattr *vap; 381 IN const char *target; 382}; 383 384 385%% readdir vp L L L 386%! readdir post vop_readdir_post 387 388vop_readdir { 389 IN struct vnode *vp; 390 INOUT struct uio *uio; 391 IN struct ucred *cred; 392 INOUT int *eofflag; 393 OUT int *ncookies; 394 INOUT u_long **cookies; 395}; 396 397 398%% readlink vp L L L 399 400vop_readlink { 401 IN struct vnode *vp; 402 INOUT struct uio *uio; 403 IN struct ucred *cred; 404}; 405 406 407%% inactive vp E E E 408 409vop_inactive { 410 IN struct vnode *vp; 411}; 412 413%! need_inactive debugpre vop_need_inactive_debugpre 414%! need_inactive debugpost vop_need_inactive_debugpost 415 416vop_need_inactive { 417 IN struct vnode *vp; 418}; 419 420%% reclaim vp E E E 421%! reclaim post vop_reclaim_post 422 423vop_reclaim { 424 IN struct vnode *vp; 425}; 426 427 428%! lock1 debugpre vop_lock_debugpre 429%! lock1 debugpost vop_lock_debugpost 430 431vop_lock1 { 432 IN struct vnode *vp; 433 IN int flags; 434 IN const char *file; 435 IN int line; 436}; 437 438 439%! unlock debugpre vop_unlock_debugpre 440 441vop_unlock { 442 IN struct vnode *vp; 443}; 444 445 446%% bmap vp L L L 447 448vop_bmap { 449 IN struct vnode *vp; 450 IN daddr_t bn; 451 OUT struct bufobj **bop; 452 IN daddr_t *bnp; 453 OUT int *runp; 454 OUT int *runb; 455}; 456 457 458%% strategy vp L L L 459%! strategy debugpre vop_strategy_debugpre 460 461vop_strategy { 462 IN struct vnode *vp; 463 IN struct buf *bp; 464}; 465 466 467%% getwritemount vp = = = 468 469vop_getwritemount { 470 IN struct vnode *vp; 471 OUT struct mount **mpp; 472}; 473 474 475%% print vp - - - 476 477vop_print { 478 IN struct vnode *vp; 479}; 480 481 482%% pathconf vp L L L 483 484vop_pathconf { 485 IN struct vnode *vp; 486 IN int name; 487 OUT long *retval; 488}; 489 490 491%% advlock vp U U U 492 493vop_advlock { 494 IN struct vnode *vp; 495 IN void *id; 496 IN int op; 497 IN struct flock *fl; 498 IN int flags; 499}; 500 501 502%% advlockasync vp U U U 503 504vop_advlockasync { 505 IN struct vnode *vp; 506 IN void *id; 507 IN int op; 508 IN struct flock *fl; 509 IN int flags; 510 IN struct task *task; 511 INOUT void **cookiep; 512}; 513 514 515%% advlockpurge vp E E E 516 517vop_advlockpurge { 518 IN struct vnode *vp; 519}; 520 521 522%% reallocblks vp E E E 523 524vop_reallocblks { 525 IN struct vnode *vp; 526 IN struct cluster_save *buflist; 527}; 528 529 530%% getpages vp L L L 531 532vop_getpages { 533 IN struct vnode *vp; 534 IN vm_page_t *m; 535 IN int count; 536 IN int *rbehind; 537 IN int *rahead; 538}; 539 540 541%% getpages_async vp L L L 542 543vop_getpages_async { 544 IN struct vnode *vp; 545 IN vm_page_t *m; 546 IN int count; 547 IN int *rbehind; 548 IN int *rahead; 549 IN vop_getpages_iodone_t *iodone; 550 IN void *arg; 551}; 552 553 554%% putpages vp L L L 555 556vop_putpages { 557 IN struct vnode *vp; 558 IN vm_page_t *m; 559 IN int count; 560 IN int sync; 561 IN int *rtvals; 562}; 563 564 565%% getacl vp L L L 566 567vop_getacl { 568 IN struct vnode *vp; 569 IN acl_type_t type; 570 OUT struct acl *aclp; 571 IN struct ucred *cred; 572 IN struct thread *td; 573}; 574 575 576%% setacl vp E E E 577%! setacl pre vop_setacl_pre 578%! setacl post vop_setacl_post 579 580vop_setacl { 581 IN struct vnode *vp; 582 IN acl_type_t type; 583 IN struct acl *aclp; 584 IN struct ucred *cred; 585 IN struct thread *td; 586}; 587 588 589%% aclcheck vp = = = 590 591vop_aclcheck { 592 IN struct vnode *vp; 593 IN acl_type_t type; 594 IN struct acl *aclp; 595 IN struct ucred *cred; 596 IN struct thread *td; 597}; 598 599 600%% closeextattr vp L L L 601 602vop_closeextattr { 603 IN struct vnode *vp; 604 IN int commit; 605 IN struct ucred *cred; 606 IN struct thread *td; 607}; 608 609 610%% getextattr vp L L L 611 612vop_getextattr { 613 IN struct vnode *vp; 614 IN int attrnamespace; 615 IN const char *name; 616 INOUT struct uio *uio; 617 OUT size_t *size; 618 IN struct ucred *cred; 619 IN struct thread *td; 620}; 621 622 623%% listextattr vp L L L 624 625vop_listextattr { 626 IN struct vnode *vp; 627 IN int attrnamespace; 628 INOUT struct uio *uio; 629 OUT size_t *size; 630 IN struct ucred *cred; 631 IN struct thread *td; 632}; 633 634 635%% openextattr vp L L L 636 637vop_openextattr { 638 IN struct vnode *vp; 639 IN struct ucred *cred; 640 IN struct thread *td; 641}; 642 643 644%% deleteextattr vp E E E 645%! deleteextattr pre vop_deleteextattr_pre 646%! deleteextattr post vop_deleteextattr_post 647 648vop_deleteextattr { 649 IN struct vnode *vp; 650 IN int attrnamespace; 651 IN const char *name; 652 IN struct ucred *cred; 653 IN struct thread *td; 654}; 655 656 657%% setextattr vp E E E 658%! setextattr pre vop_setextattr_pre 659%! setextattr post vop_setextattr_post 660 661vop_setextattr { 662 IN struct vnode *vp; 663 IN int attrnamespace; 664 IN const char *name; 665 INOUT struct uio *uio; 666 IN struct ucred *cred; 667 IN struct thread *td; 668}; 669 670 671%% setlabel vp E E E 672 673vop_setlabel { 674 IN struct vnode *vp; 675 IN struct label *label; 676 IN struct ucred *cred; 677 IN struct thread *td; 678}; 679 680 681%% vptofh vp = = = 682 683vop_vptofh { 684 IN struct vnode *vp; 685 IN struct fid *fhp; 686}; 687 688 689%% vptocnp vp L L L 690%% vptocnp vpp - U - 691 692vop_vptocnp { 693 IN struct vnode *vp; 694 OUT struct vnode **vpp; 695 INOUT char *buf; 696 INOUT size_t *buflen; 697}; 698 699 700%% allocate vp E E E 701 702vop_allocate { 703 IN struct vnode *vp; 704 INOUT off_t *offset; 705 INOUT off_t *len; 706}; 707 708 709%% advise vp U U U 710 711vop_advise { 712 IN struct vnode *vp; 713 IN off_t start; 714 IN off_t end; 715 IN int advice; 716}; 717 718 719%% unp_bind vp E E E 720 721vop_unp_bind { 722 IN struct vnode *vp; 723 IN struct unpcb *unpcb; 724}; 725 726 727%% unp_connect vp L L L 728 729vop_unp_connect { 730 IN struct vnode *vp; 731 OUT struct unpcb **unpcb; 732}; 733 734 735%% unp_detach vp = = = 736 737vop_unp_detach { 738 IN struct vnode *vp; 739}; 740 741 742%% is_text vp L L L 743 744vop_is_text { 745 IN struct vnode *vp; 746}; 747 748 749%% set_text vp = = = 750 751vop_set_text { 752 IN struct vnode *vp; 753}; 754 755 756%% vop_unset_text vp L L L 757 758vop_unset_text { 759 IN struct vnode *vp; 760}; 761 762 763%% add_writecount vp L L L 764 765vop_add_writecount { 766 IN struct vnode *vp; 767 IN int inc; 768}; 769 770 771%% fdatasync vp L L L 772 773vop_fdatasync { 774 IN struct vnode *vp; 775 IN struct thread *td; 776}; 777 778 779%% copy_file_range invp U U U 780%% copy_file_range outvp U U U 781 782vop_copy_file_range { 783 IN struct vnode *invp; 784 INOUT off_t *inoffp; 785 IN struct vnode *outvp; 786 INOUT off_t *outoffp; 787 INOUT size_t *lenp; 788 IN unsigned int flags; 789 IN struct ucred *incred; 790 IN struct ucred *outcred; 791 IN struct thread *fsizetd; 792}; 793 794 795%% vput_pair dvp E - - 796 797vop_vput_pair { 798 IN struct vnode *dvp; 799 INOUT struct vnode **vpp; 800 IN bool unlock_vp; 801}; 802 803 804# The VOPs below are spares at the end of the table to allow new VOPs to be 805# added in stable branches without breaking the KBI. New VOPs in HEAD should 806# be added above these spares. When merging a new VOP to a stable branch, 807# the new VOP should replace one of the spares. 808 809vop_spare1 { 810 IN struct vnode *vp; 811}; 812 813vop_spare2 { 814 IN struct vnode *vp; 815}; 816 817vop_spare3 { 818 IN struct vnode *vp; 819}; 820 821vop_spare4 { 822 IN struct vnode *vp; 823}; 824 825vop_spare5 { 826 IN struct vnode *vp; 827}; 828