1# $NetBSD: vnode_if.src,v 1.54 2007/07/27 08:26:38 pooka 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. All advertising materials mentioning features or use of this software 15# must display the following acknowledgement: 16# This product includes software developed by the University of 17# California, Berkeley and its contributors. 18# 4. Neither the name of the University nor the names of its contributors 19# may be used to endorse or promote products derived from this software 20# without specific prior written permission. 21# 22# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32# SUCH DAMAGE. 33# 34# @(#)vnode_if.src 8.14 (Berkeley) 8/6/95 35# 36# 37 38# 39# Above each of the vop descriptors is a specification of the locking 40# protocol used by each vop call. The first column is the name of 41# the variable, the remaining three columns are in, out and error 42# respectively. The "in" column defines the lock state on input, 43# the "out" column defines the state on successful return, and the 44# "error" column defines the locking state on error exit. 45# 46# The locking value can take the following values: 47# L: locked. 48# U: unlocked. 49# -: not applicable. vnode does not yet (or no longer) exists. 50# =: the same on input and output, may be either L or U. 51# X: locked if not nil. 52# 53# For operations other than VOP_LOOKUP which require a component name 54# parameter, the flags required for the initial namei() call are listed. 55# Additional flags may be added to the namei() call, but these are required. 56# 57 58# 59#% lookup dvp L L L 60#% lookup vpp - L - 61# 62# XXX - the lookup locking protocol defies simple description. 63# Note especially that *vpp may equal dvp. 64# 65# More details: 66# There are three types of lookups: ".", ".." (ISDOTDOT), and other. 67# On successful lookup of ".", a reference is added to dvp, and it 68# is returned in *vpp. 69# To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and 70# then dvp is relocked. This preserves the protocol of always 71# locking nodes from root ("/") downward and prevents deadlock. 72# Other lookups find the named node (creating the vnode if needed) and 73# return it, locked, in *vpp. 74# On failure, *vpp is NULL, and *dvp is left locked. 75# 76# *vpp is always locked on return if the operation succeeds. 77# Typically, if *vpp == dvp, you need to release twice, but 78# unlock only once. 79# 80# See sys/sys/namei.h for a description of the SAVENAME and SAVESTART 81# flags. 82# 83vop_lookup { 84 IN struct vnode *dvp; 85 INOUT WILLMAKE struct vnode **vpp; 86 IN struct componentname *cnp; 87}; 88 89# 90#% create dvp L U U 91#% create vpp - L - 92# 93#! create cnp CREATE, LOCKPARENT 94# 95vop_create { 96 IN LOCKED=YES WILLPUT struct vnode *dvp; 97 OUT WILLMAKE struct vnode **vpp; 98 IN struct componentname *cnp; 99 IN struct vattr *vap; 100}; 101 102# 103#% mknod dvp L U U 104#% mknod vpp - L - 105# 106#! mknod cnp CREATE, LOCKPARENT 107# 108vop_mknod { 109 IN LOCKED=YES WILLPUT struct vnode *dvp; 110 OUT WILLMAKE struct vnode **vpp; 111 IN struct componentname *cnp; 112 IN struct vattr *vap; 113}; 114 115# 116#% open vp L L L 117# 118vop_open { 119 IN LOCKED=YES struct vnode *vp; 120 IN int mode; 121 IN kauth_cred_t cred; 122 IN struct lwp *l; 123}; 124 125# 126#% close vp L L L 127# 128vop_close { 129 IN LOCKED=YES struct vnode *vp; 130 IN int fflag; 131 IN kauth_cred_t cred; 132 IN struct lwp *l; 133}; 134 135# 136#% access vp L L L 137# 138vop_access { 139 IN LOCKED=YES struct vnode *vp; 140 IN int mode; 141 IN kauth_cred_t cred; 142 IN struct lwp *l; 143}; 144 145# 146#% getattr vp = = = 147# 148vop_getattr { 149 IN struct vnode *vp; 150 IN struct vattr *vap; 151 IN kauth_cred_t cred; 152 IN struct lwp *l; 153}; 154 155# 156#% setattr vp L L L 157# 158vop_setattr { 159 IN LOCKED=YES struct vnode *vp; 160 IN struct vattr *vap; 161 IN kauth_cred_t cred; 162 IN struct lwp *l; 163}; 164 165# 166#% read vp L L L 167# 168vop_read { 169 IN LOCKED=YES struct vnode *vp; 170 INOUT struct uio *uio; 171 IN int ioflag; 172 IN kauth_cred_t cred; 173}; 174 175# 176#% write vp L L L 177# 178vop_write { 179 IN LOCKED=YES struct vnode *vp; 180 INOUT struct uio *uio; 181 IN int ioflag; 182 IN kauth_cred_t cred; 183}; 184 185# 186#% ioctl vp U U U 187# 188vop_ioctl { 189 IN LOCKED=NO struct vnode *vp; 190 IN u_long command; 191 IN void *data; 192 IN int fflag; 193 IN kauth_cred_t cred; 194 IN struct lwp *l; 195}; 196 197# 198#% fcntl vp U U U 199# 200vop_fcntl { 201 IN LOCKED=NO struct vnode *vp; 202 IN u_int command; 203 IN void *data; 204 IN int fflag; 205 IN kauth_cred_t cred; 206 IN struct lwp *l; 207}; 208 209# 210#% poll vp U U U 211# 212vop_poll { 213 IN LOCKED=NO struct vnode *vp; 214 IN int events; 215 IN struct lwp *l; 216}; 217 218# 219#% kqfilter vp U U U 220# 221vop_kqfilter { 222 IN LOCKED=NO struct vnode *vp; 223 IN struct knote *kn; 224}; 225 226# 227#% revoke vp U U U 228# 229vop_revoke { 230 IN LOCKED=NO struct vnode *vp; 231 IN int flags; 232}; 233 234# 235#% mmap vp = = = 236# 237vop_mmap { 238 IN struct vnode *vp; 239 IN vm_prot_t prot; 240 IN kauth_cred_t cred; 241 IN struct lwp *l; 242}; 243 244# 245#% fsync vp L L L 246# 247vop_fsync { 248 IN LOCKED=YES struct vnode *vp; 249 IN kauth_cred_t cred; 250 IN int flags; 251 IN off_t offlo; 252 IN off_t offhi; 253 IN struct lwp *l; 254}; 255 256# 257# Needs work: Is newoff right? What's it mean? 258# XXX Locking protocol? 259# 260vop_seek { 261 IN struct vnode *vp; 262 IN off_t oldoff; 263 IN off_t newoff; 264 IN kauth_cred_t cred; 265}; 266 267# 268#% remove dvp L U U 269#% remove vp L U U 270# 271#! remove cnp DELETE, LOCKPARENT | LOCKLEAF 272# 273vop_remove { 274 IN LOCKED=YES WILLPUT struct vnode *dvp; 275 IN LOCKED=YES WILLPUT struct vnode *vp; 276 IN struct componentname *cnp; 277}; 278 279# 280#% link dvp L U U 281#% link vp U U U 282# 283#! link cnp CREATE, LOCKPARENT 284# 285vop_link { 286 IN LOCKED=YES WILLPUT struct vnode *dvp; 287 IN LOCKED=NO struct vnode *vp; 288 IN struct componentname *cnp; 289}; 290 291# 292#% rename fdvp U U U 293#% rename fvp U U U 294#% rename tdvp L U U 295#% rename tvp X U U 296# 297#! rename fcnp DELETE, LOCKPARENT | SAVESTART 298#! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART 299# 300# XXX the vop_rename routines should REALLY NOT be depending on SAVESTART! 301# 302vop_rename { 303 IN LOCKED=NO WILLRELE struct vnode *fdvp; 304 IN LOCKED=NO WILLRELE struct vnode *fvp; 305 IN struct componentname *fcnp; 306 IN LOCKED=YES WILLPUT struct vnode *tdvp; 307 IN WILLPUT struct vnode *tvp; 308 IN struct componentname *tcnp; 309}; 310 311# 312#% mkdir dvp L U U 313#% mkdir vpp - L - 314# 315#! mkdir cnp CREATE, LOCKPARENT 316# 317vop_mkdir { 318 IN LOCKED=YES WILLPUT struct vnode *dvp; 319 OUT WILLMAKE struct vnode **vpp; 320 IN struct componentname *cnp; 321 IN struct vattr *vap; 322}; 323 324# 325#% rmdir dvp L U U 326#% rmdir vp L U U 327# 328#! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF 329# 330vop_rmdir { 331 IN LOCKED=YES WILLPUT struct vnode *dvp; 332 IN LOCKED=YES WILLPUT struct vnode *vp; 333 IN struct componentname *cnp; 334}; 335 336# 337#% symlink dvp L U U 338#% symlink vpp - L - 339# 340#! symlink cnp CREATE, LOCKPARENT 341# 342vop_symlink { 343 IN LOCKED=YES WILLPUT struct vnode *dvp; 344 OUT WILLMAKE struct vnode **vpp; 345 IN struct componentname *cnp; 346 IN struct vattr *vap; 347 IN char *target; 348}; 349 350# 351#% readdir vp L L L 352# 353vop_readdir { 354 IN LOCKED=YES struct vnode *vp; 355 INOUT struct uio *uio; 356 IN kauth_cred_t cred; 357 OUT int *eofflag; 358 OUT off_t **cookies; 359 IN int *ncookies; 360}; 361 362# 363#% readlink vp L L L 364# 365vop_readlink { 366 IN LOCKED=YES struct vnode *vp; 367 INOUT struct uio *uio; 368 IN kauth_cred_t cred; 369}; 370 371# 372#% abortop dvp = = = 373# 374#! abortop cnp as appropriate. 375# 376vop_abortop { 377 IN struct vnode *dvp; 378 IN struct componentname *cnp; 379}; 380 381# 382#% inactive vp L U U 383# 384vop_inactive { 385 IN LOCKED=YES WILLUNLOCK struct vnode *vp; 386 IN struct lwp *l; 387}; 388 389# 390#% reclaim vp U U U 391# 392vop_reclaim { 393 IN LOCKED=NO struct vnode *vp; 394 IN struct lwp *l; 395}; 396 397# 398#% lock vp U L U 399# 400vop_lock { 401 IN LOCKED=NO struct vnode *vp; 402 IN int flags; 403}; 404 405# 406#% unlock vp L U L 407# 408vop_unlock { 409 IN LOCKED=YES struct vnode *vp; 410 IN int flags; 411}; 412 413# 414#% bmap vp = = = 415#% bmap vpp - U - 416# 417vop_bmap { 418 IN struct vnode *vp; 419 IN daddr_t bn; 420 OUT struct vnode **vpp; 421 IN daddr_t *bnp; 422 OUT int *runp; 423}; 424 425# 426#% strategy vp = = = 427# 428vop_strategy { 429 IN struct vnode *vp; 430 IN struct buf *bp; 431}; 432 433# 434#% print vp = = = 435# 436vop_print { 437 IN struct vnode *vp; 438}; 439 440# 441#% islocked vp = = = 442# 443vop_islocked { 444 IN struct vnode *vp; 445}; 446 447# 448#% pathconf vp L L L 449# 450vop_pathconf { 451 IN LOCKED=YES struct vnode *vp; 452 IN int name; 453 OUT register_t *retval; 454}; 455 456# 457#% advlock vp U U U 458# 459vop_advlock { 460 IN LOCKED=NO struct vnode *vp; 461 IN void *id; 462 IN int op; 463 IN struct flock *fl; 464 IN int flags; 465}; 466 467# 468#% lease vp = = = 469# 470vop_lease { 471 IN struct vnode *vp; 472 IN struct lwp *l; 473 IN kauth_cred_t cred; 474 IN int flag; 475}; 476 477# 478#% whiteout dvp L L L 479#% whiteout cnp - - - 480#% whiteout flag - - - 481# 482#! whiteout cnp CREATE, LOCKPARENT 483# 484vop_whiteout { 485 IN LOCKED=YES struct vnode *dvp; 486 IN struct componentname *cnp; 487 IN int flags; 488}; 489 490# 491# Needs work: no vp? 492# 493#vop_bwrite { 494# IN struct buf *bp; 495#}; 496 497# 498#% getpages vp = = = 499# 500vop_getpages { 501 IN struct vnode *vp; 502 IN voff_t offset; 503 IN struct vm_page **m; 504 IN int *count; 505 IN int centeridx; 506 IN vm_prot_t access_type; 507 IN int advice; 508 IN int flags; 509}; 510 511# 512#% putpages vp = = = 513# 514vop_putpages { 515 IN struct vnode *vp; 516 IN voff_t offlo; 517 IN voff_t offhi; 518 IN int flags; 519}; 520 521# 522#% closeextattr vp L L L 523# 524vop_closeextattr { 525 IN LOCKED=YES struct vnode *vp; 526 IN int commit; 527 IN kauth_cred_t cred; 528 IN struct lwp *l; 529}; 530 531# 532#% getextattr vp L L L 533# 534vop_getextattr { 535 IN LOCKED=YES struct vnode *vp; 536 IN int attrnamespace; 537 IN const char *name; 538 INOUT struct uio *uio; 539 OUT size_t *size; 540 IN kauth_cred_t cred; 541 IN struct lwp *l; 542}; 543 544# 545#% listextattr vp L L L 546# 547vop_listextattr { 548 IN LOCKED=YES struct vnode *vp; 549 IN int attrnamespace; 550 INOUT struct uio *uio; 551 OUT size_t *size; 552 IN kauth_cred_t cred; 553 IN struct lwp *l; 554}; 555 556# 557#% openextattr vp L L L 558# 559vop_openextattr { 560 IN LOCKED=YES struct vnode *vp; 561 IN kauth_cred_t cred; 562 IN struct lwp *l; 563}; 564 565# 566#% deleteextattr vp L L L 567# 568vop_deleteextattr { 569 IN LOCKED=YES struct vnode *vp; 570 IN int attrnamespace; 571 IN const char *name; 572 IN kauth_cred_t cred; 573 IN struct lwp *l; 574}; 575 576# 577#% setextattr vp L L L 578# 579vop_setextattr { 580 IN LOCKED=YES struct vnode *vp; 581 IN int attrnamespace; 582 IN const char *name; 583 INOUT struct uio *uio; 584 IN kauth_cred_t cred; 585 IN struct lwp *l; 586}; 587