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# 4. 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# X: locked if not nil. 48# 49# The paramater named "vpp" is assumed to be always used with double 50# indirection (**vpp) and that name is hard-coded in vnode_if.awk ! 51# 52# Lines starting with %! specify a pre or post-condition function 53# to call before/after the vop call. 54# 55# If other such parameters are introduced, they have to be added to 56# the AWK script at the head of the definition of "add_debug_code()". 57# 58 59vop_islocked { 60 IN struct vnode *vp; 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%% cachedlookup dvp L L L 77%% cachedlookup vpp - L - 78 79# This must be an exact copy of lookup. See kern/vfs_cache.c for details. 80 81vop_cachedlookup { 82 IN struct vnode *dvp; 83 INOUT struct vnode **vpp; 84 IN struct componentname *cnp; 85}; 86 87%% create dvp E E E 88%% create vpp - L - 89%! create post vop_create_post 90 91vop_create { 92 IN struct vnode *dvp; 93 OUT struct vnode **vpp; 94 IN struct componentname *cnp; 95 IN struct vattr *vap; 96}; 97 98 99%% whiteout dvp E E E 100 101vop_whiteout { 102 IN struct vnode *dvp; 103 IN struct componentname *cnp; 104 IN int flags; 105}; 106 107 108%% mknod dvp E E E 109%% mknod vpp - L - 110%! mknod post vop_mknod_post 111 112vop_mknod { 113 IN struct vnode *dvp; 114 OUT struct vnode **vpp; 115 IN struct componentname *cnp; 116 IN struct vattr *vap; 117}; 118 119 120%% open vp L L L 121%! open post vop_open_post 122 123vop_open { 124 IN struct vnode *vp; 125 IN int mode; 126 IN struct ucred *cred; 127 IN struct thread *td; 128 IN struct file *fp; 129}; 130 131 132%% close vp L L L 133%! close post vop_close_post 134 135vop_close { 136 IN struct vnode *vp; 137 IN int fflag; 138 IN struct ucred *cred; 139 IN struct thread *td; 140}; 141 142 143%% access vp L L L 144 145vop_access { 146 IN struct vnode *vp; 147 IN accmode_t accmode; 148 IN struct ucred *cred; 149 IN struct thread *td; 150}; 151 152 153%% accessx vp L L L 154 155vop_accessx { 156 IN struct vnode *vp; 157 IN accmode_t accmode; 158 IN struct ucred *cred; 159 IN struct thread *td; 160}; 161 162 163%% getattr vp L L L 164 165vop_getattr { 166 IN struct vnode *vp; 167 OUT struct vattr *vap; 168 IN struct ucred *cred; 169}; 170 171 172%% setattr vp E E E 173%! setattr post vop_setattr_post 174 175vop_setattr { 176 IN struct vnode *vp; 177 IN struct vattr *vap; 178 IN struct ucred *cred; 179}; 180 181%% markatime vp L L L 182 183vop_markatime { 184 IN struct vnode *vp; 185}; 186 187%% read vp L L L 188%! read post vop_read_post 189 190vop_read { 191 IN struct vnode *vp; 192 INOUT struct uio *uio; 193 IN int ioflag; 194 IN struct ucred *cred; 195}; 196 197 198%% write vp L L L 199%! write pre VOP_WRITE_PRE 200%! write post VOP_WRITE_POST 201 202vop_write { 203 IN struct vnode *vp; 204 INOUT struct uio *uio; 205 IN int ioflag; 206 IN struct ucred *cred; 207}; 208 209 210%% ioctl vp U U U 211 212vop_ioctl { 213 IN struct vnode *vp; 214 IN u_long command; 215 IN void *data; 216 IN int fflag; 217 IN struct ucred *cred; 218 IN struct thread *td; 219}; 220 221 222%% poll vp U U U 223 224vop_poll { 225 IN struct vnode *vp; 226 IN int events; 227 IN struct ucred *cred; 228 IN struct thread *td; 229}; 230 231 232%% kqfilter vp U U U 233 234vop_kqfilter { 235 IN struct vnode *vp; 236 IN struct knote *kn; 237}; 238 239 240%% revoke vp L L L 241 242vop_revoke { 243 IN struct vnode *vp; 244 IN int flags; 245}; 246 247 248%% fsync vp L L L 249 250vop_fsync { 251 IN struct vnode *vp; 252 IN int waitfor; 253 IN struct thread *td; 254}; 255 256 257%% remove dvp E E E 258%% remove vp E E E 259%! remove post vop_remove_post 260 261vop_remove { 262 IN struct vnode *dvp; 263 IN struct vnode *vp; 264 IN struct componentname *cnp; 265}; 266 267 268%% link tdvp E E E 269%% link vp E E E 270%! link post vop_link_post 271 272vop_link { 273 IN struct vnode *tdvp; 274 IN struct vnode *vp; 275 IN struct componentname *cnp; 276}; 277 278 279%! rename pre vop_rename_pre 280%! rename post vop_rename_post 281 282vop_rename { 283 IN WILLRELE struct vnode *fdvp; 284 IN WILLRELE struct vnode *fvp; 285 IN struct componentname *fcnp; 286 IN WILLRELE struct vnode *tdvp; 287 IN WILLRELE struct vnode *tvp; 288 IN struct componentname *tcnp; 289}; 290 291 292%% mkdir dvp E E E 293%% mkdir vpp - E - 294%! mkdir post vop_mkdir_post 295 296vop_mkdir { 297 IN struct vnode *dvp; 298 OUT struct vnode **vpp; 299 IN struct componentname *cnp; 300 IN struct vattr *vap; 301}; 302 303 304%% rmdir dvp E E E 305%% rmdir vp E E E 306%! rmdir post vop_rmdir_post 307 308vop_rmdir { 309 IN struct vnode *dvp; 310 IN struct vnode *vp; 311 IN struct componentname *cnp; 312}; 313 314 315%% symlink dvp E E E 316%% symlink vpp - E - 317%! symlink post vop_symlink_post 318 319vop_symlink { 320 IN struct vnode *dvp; 321 OUT struct vnode **vpp; 322 IN struct componentname *cnp; 323 IN struct vattr *vap; 324 IN char *target; 325}; 326 327 328%% readdir vp L L L 329%! readdir post vop_readdir_post 330 331vop_readdir { 332 IN struct vnode *vp; 333 INOUT struct uio *uio; 334 IN struct ucred *cred; 335 INOUT int *eofflag; 336 OUT int *ncookies; 337 INOUT u_long **cookies; 338}; 339 340 341%% readlink vp L L L 342 343vop_readlink { 344 IN struct vnode *vp; 345 INOUT struct uio *uio; 346 IN struct ucred *cred; 347}; 348 349 350%% inactive vp E E E 351 352vop_inactive { 353 IN struct vnode *vp; 354 IN struct thread *td; 355}; 356 357 358%% reclaim vp E E E 359%! reclaim post vop_reclaim_post 360 361vop_reclaim { 362 IN struct vnode *vp; 363 IN struct thread *td; 364}; 365 366 367%! lock1 pre vop_lock_pre 368%! lock1 post vop_lock_post 369 370vop_lock1 { 371 IN struct vnode *vp; 372 IN int flags; 373 IN char *file; 374 IN int line; 375}; 376 377 378%! unlock pre vop_unlock_pre 379%! unlock post vop_unlock_post 380 381vop_unlock { 382 IN struct vnode *vp; 383 IN int flags; 384}; 385 386 387%% bmap vp L L L 388 389vop_bmap { 390 IN struct vnode *vp; 391 IN daddr_t bn; 392 OUT struct bufobj **bop; 393 IN daddr_t *bnp; 394 OUT int *runp; 395 OUT int *runb; 396}; 397 398 399%% strategy vp L L L 400%! strategy pre vop_strategy_pre 401 402vop_strategy { 403 IN struct vnode *vp; 404 IN struct buf *bp; 405}; 406 407 408%% getwritemount vp = = = 409 410vop_getwritemount { 411 IN struct vnode *vp; 412 OUT struct mount **mpp; 413}; 414 415 416%% print vp - - - 417 418vop_print { 419 IN struct vnode *vp; 420}; 421 422 423%% pathconf vp L L L 424 425vop_pathconf { 426 IN struct vnode *vp; 427 IN int name; 428 OUT register_t *retval; 429}; 430 431 432%% advlock vp U U U 433 434vop_advlock { 435 IN struct vnode *vp; 436 IN void *id; 437 IN int op; 438 IN struct flock *fl; 439 IN int flags; 440}; 441 442 443%% advlockasync vp U U U 444 445vop_advlockasync { 446 IN struct vnode *vp; 447 IN void *id; 448 IN int op; 449 IN struct flock *fl; 450 IN int flags; 451 IN struct task *task; 452 INOUT void **cookiep; 453}; 454 455 456%% advlockpurge vp E E E 457 458vop_advlockpurge { 459 IN struct vnode *vp; 460}; 461 462 463%% reallocblks vp E E E 464 465vop_reallocblks { 466 IN struct vnode *vp; 467 IN struct cluster_save *buflist; 468}; 469 470 471%% getpages vp L L L 472 473vop_getpages { 474 IN struct vnode *vp; 475 IN vm_page_t *m; 476 IN int count; 477 IN int *rbehind; 478 IN int *rahead; 479}; 480 481 482%% getpages_async vp L L L 483 484vop_getpages_async { 485 IN struct vnode *vp; 486 IN vm_page_t *m; 487 IN int count; 488 IN int *rbehind; 489 IN int *rahead; 490 IN vop_getpages_iodone_t *iodone; 491 IN void *arg; 492}; 493 494 495%% putpages vp L L L 496 497vop_putpages { 498 IN struct vnode *vp; 499 IN vm_page_t *m; 500 IN int count; 501 IN int sync; 502 IN int *rtvals; 503}; 504 505 506%% getacl vp L L L 507 508vop_getacl { 509 IN struct vnode *vp; 510 IN acl_type_t type; 511 OUT struct acl *aclp; 512 IN struct ucred *cred; 513 IN struct thread *td; 514}; 515 516 517%% setacl vp E E E 518 519vop_setacl { 520 IN struct vnode *vp; 521 IN acl_type_t type; 522 IN struct acl *aclp; 523 IN struct ucred *cred; 524 IN struct thread *td; 525}; 526 527 528%% aclcheck vp = = = 529 530vop_aclcheck { 531 IN struct vnode *vp; 532 IN acl_type_t type; 533 IN struct acl *aclp; 534 IN struct ucred *cred; 535 IN struct thread *td; 536}; 537 538 539%% closeextattr vp L L L 540 541vop_closeextattr { 542 IN struct vnode *vp; 543 IN int commit; 544 IN struct ucred *cred; 545 IN struct thread *td; 546}; 547 548 549%% getextattr vp L L L 550 551vop_getextattr { 552 IN struct vnode *vp; 553 IN int attrnamespace; 554 IN const char *name; 555 INOUT struct uio *uio; 556 OUT size_t *size; 557 IN struct ucred *cred; 558 IN struct thread *td; 559}; 560 561 562%% listextattr vp L L L 563 564vop_listextattr { 565 IN struct vnode *vp; 566 IN int attrnamespace; 567 INOUT struct uio *uio; 568 OUT size_t *size; 569 IN struct ucred *cred; 570 IN struct thread *td; 571}; 572 573 574%% openextattr vp L L L 575 576vop_openextattr { 577 IN struct vnode *vp; 578 IN struct ucred *cred; 579 IN struct thread *td; 580}; 581 582 583%% deleteextattr vp E E E 584%! deleteextattr post vop_deleteextattr_post 585 586vop_deleteextattr { 587 IN struct vnode *vp; 588 IN int attrnamespace; 589 IN const char *name; 590 IN struct ucred *cred; 591 IN struct thread *td; 592}; 593 594 595%% setextattr vp E E E 596%! setextattr post vop_setextattr_post 597 598vop_setextattr { 599 IN struct vnode *vp; 600 IN int attrnamespace; 601 IN const char *name; 602 INOUT struct uio *uio; 603 IN struct ucred *cred; 604 IN struct thread *td; 605}; 606 607 608%% setlabel vp E E E 609 610vop_setlabel { 611 IN struct vnode *vp; 612 IN struct label *label; 613 IN struct ucred *cred; 614 IN struct thread *td; 615}; 616 617 618%% vptofh vp = = = 619 620vop_vptofh { 621 IN struct vnode *vp; 622 IN struct fid *fhp; 623}; 624 625 626%% vptocnp vp L L L 627%% vptocnp vpp - U - 628 629vop_vptocnp { 630 IN struct vnode *vp; 631 OUT struct vnode **vpp; 632 IN struct ucred *cred; 633 INOUT char *buf; 634 INOUT int *buflen; 635}; 636 637 638%% allocate vp E E E 639 640vop_allocate { 641 IN struct vnode *vp; 642 INOUT off_t *offset; 643 INOUT off_t *len; 644}; 645 646%% advise vp U U U 647 648vop_advise { 649 IN struct vnode *vp; 650 IN off_t start; 651 IN off_t end; 652 IN int advice; 653}; 654 655%% unp_bind vp E E E 656 657vop_unp_bind { 658 IN struct vnode *vp; 659 IN struct socket *socket; 660}; 661 662%% unp_connect vp L L L 663 664vop_unp_connect { 665 IN struct vnode *vp; 666 OUT struct socket **socket; 667}; 668 669%% unp_detach vp = = = 670 671vop_unp_detach { 672 IN struct vnode *vp; 673}; 674 675%% is_text vp L L L 676 677vop_is_text { 678 IN struct vnode *vp; 679}; 680 681%% set_text vp E E E 682 683vop_set_text { 684 IN struct vnode *vp; 685}; 686 687%% vop_unset_text vp E E E 688 689vop_unset_text { 690 IN struct vnode *vp; 691}; 692 693%% get_writecount vp L L L 694 695vop_get_writecount { 696 IN struct vnode *vp; 697 OUT int *writecount; 698}; 699 700%% add_writecount vp E E E 701 702vop_add_writecount { 703 IN struct vnode *vp; 704 IN int inc; 705}; 706 707# The VOPs below are spares at the end of the table to allow new VOPs to be 708# added in stable branches without breaking the KBI. New VOPs in HEAD should 709# be added above these spares. When merging a new VOP to a stable branch, 710# the new VOP should replace one of the spares. 711 712vop_spare1 { 713 IN struct vnode *vp; 714}; 715 716vop_spare2 { 717 IN struct vnode *vp; 718}; 719 720vop_spare3 { 721 IN struct vnode *vp; 722}; 723 724vop_spare4 { 725 IN struct vnode *vp; 726}; 727 728vop_spare5 { 729 IN struct vnode *vp; 730}; 731