1# $NetBSD: vnode_if.src,v 1.61 2011/04/02 23:05:50 rmind 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#% lookup dvp L L L 56#% lookup vpp - L - 57# 58# XXX - the lookup locking protocol defies simple description. 59# Note especially that *vpp may equal dvp. 60# 61# More details: 62# There are three types of lookups: ".", ".." (ISDOTDOT), and other. 63# On successful lookup of ".", a reference is added to dvp, and it 64# is returned in *vpp. 65# To look up ISDOTDOT, dvp is unlocked, the ".." node is locked, and 66# then dvp is relocked. This preserves the protocol of always 67# locking nodes from root ("/") downward and prevents deadlock. 68# Other lookups find the named node (creating the vnode if needed) and 69# return it, locked, in *vpp. 70# On failure, *vpp is NULL, and *dvp is left locked. 71# 72# *vpp is always locked on return if the operation succeeds. 73# Typically, if *vpp == dvp, you need to release twice, but 74# unlock only once. 75# 76vop_lookup { 77 IN struct vnode *dvp; 78 OUT WILLMAKE struct vnode **vpp; 79 IN struct componentname *cnp; 80}; 81 82# 83#% create dvp L U U 84#% create vpp - L - 85# 86#! create cnp CREATE, LOCKPARENT 87# 88vop_create { 89 IN LOCKED=YES WILLPUT struct vnode *dvp; 90 OUT WILLMAKE struct vnode **vpp; 91 IN struct componentname *cnp; 92 IN struct vattr *vap; 93}; 94 95# 96#% mknod dvp L U U 97#% mknod vpp - L - 98# 99#! mknod cnp CREATE, LOCKPARENT 100# 101vop_mknod { 102 IN LOCKED=YES WILLPUT struct vnode *dvp; 103 OUT WILLMAKE struct vnode **vpp; 104 IN struct componentname *cnp; 105 IN struct vattr *vap; 106}; 107 108# 109#% open vp L L L 110# 111vop_open { 112 IN LOCKED=YES struct vnode *vp; 113 IN int mode; 114 IN kauth_cred_t cred; 115}; 116 117# 118#% close vp L L L 119# 120vop_close { 121 IN LOCKED=YES struct vnode *vp; 122 IN int fflag; 123 IN kauth_cred_t cred; 124}; 125 126# 127#% access vp L L L 128# 129vop_access { 130 IN LOCKED=YES struct vnode *vp; 131 IN int mode; 132 IN kauth_cred_t cred; 133}; 134 135# 136#% getattr vp = = = 137# 138vop_getattr { 139 IN struct vnode *vp; 140 IN struct vattr *vap; 141 IN kauth_cred_t cred; 142}; 143 144# 145#% setattr vp L L L 146# 147vop_setattr { 148 IN LOCKED=YES struct vnode *vp; 149 IN struct vattr *vap; 150 IN kauth_cred_t cred; 151}; 152 153# 154#% read vp L L L 155# 156vop_read { 157 IN LOCKED=YES struct vnode *vp; 158 INOUT struct uio *uio; 159 IN int ioflag; 160 IN kauth_cred_t cred; 161}; 162 163# 164#% write vp L L L 165# 166vop_write { 167 IN LOCKED=YES struct vnode *vp; 168 INOUT struct uio *uio; 169 IN int ioflag; 170 IN kauth_cred_t cred; 171}; 172 173# 174#% ioctl vp U U U 175# 176vop_ioctl { 177 IN LOCKED=NO struct vnode *vp; 178 IN u_long command; 179 IN void *data; 180 IN int fflag; 181 IN kauth_cred_t cred; 182}; 183 184# 185#% fcntl vp U U U 186# 187vop_fcntl { 188 IN LOCKED=NO struct vnode *vp; 189 IN u_int command; 190 IN void *data; 191 IN int fflag; 192 IN kauth_cred_t cred; 193}; 194 195# 196#% poll vp U U U 197# 198vop_poll { 199 IN LOCKED=NO struct vnode *vp; 200 IN int events; 201}; 202 203# 204#% kqfilter vp U U U 205# 206vop_kqfilter { 207 IN LOCKED=NO struct vnode *vp; 208 IN struct knote *kn; 209}; 210 211# 212#% revoke vp U U U 213# 214vop_revoke { 215 IN LOCKED=NO struct vnode *vp; 216 IN int flags; 217}; 218 219# 220#% mmap vp = = = 221# 222vop_mmap { 223 IN struct vnode *vp; 224 IN vm_prot_t prot; 225 IN kauth_cred_t cred; 226}; 227 228# 229#% fsync vp L L L 230# 231vop_fsync { 232 IN LOCKED=YES struct vnode *vp; 233 IN kauth_cred_t cred; 234 IN int flags; 235 IN off_t offlo; 236 IN off_t offhi; 237}; 238 239# 240# Needs work: Is newoff right? What's it mean? 241# XXX Locking protocol? 242# 243vop_seek { 244 IN struct vnode *vp; 245 IN off_t oldoff; 246 IN off_t newoff; 247 IN kauth_cred_t cred; 248}; 249 250# 251#% remove dvp L U U 252#% remove vp L U U 253# 254#! remove cnp DELETE, LOCKPARENT | LOCKLEAF 255# 256vop_remove { 257 IN LOCKED=YES WILLPUT struct vnode *dvp; 258 IN LOCKED=YES WILLPUT struct vnode *vp; 259 IN struct componentname *cnp; 260}; 261 262# 263#% link dvp L U U 264#% link vp U U U 265# 266#! link cnp CREATE, LOCKPARENT 267# 268vop_link { 269 IN LOCKED=YES WILLPUT struct vnode *dvp; 270 IN LOCKED=NO struct vnode *vp; 271 IN struct componentname *cnp; 272}; 273 274# 275#% rename fdvp U U U 276#% rename fvp U U U 277#% rename tdvp L U U 278#% rename tvp X U U 279# 280#! rename fcnp DELETE, LOCKPARENT 281#! rename tcnp RENAME, LOCKPARENT | LOCKLEAF | NOCACHE 282# 283vop_rename { 284 IN LOCKED=NO WILLRELE struct vnode *fdvp; 285 IN LOCKED=NO WILLRELE struct vnode *fvp; 286 IN struct componentname *fcnp; 287 IN LOCKED=YES WILLPUT struct vnode *tdvp; 288 IN WILLPUT struct vnode *tvp; 289 IN struct componentname *tcnp; 290}; 291 292# 293#% mkdir dvp L U U 294#% mkdir vpp - L - 295# 296#! mkdir cnp CREATE, LOCKPARENT 297# 298vop_mkdir { 299 IN LOCKED=YES WILLPUT struct vnode *dvp; 300 OUT WILLMAKE struct vnode **vpp; 301 IN struct componentname *cnp; 302 IN struct vattr *vap; 303}; 304 305# 306#% rmdir dvp L U U 307#% rmdir vp L U U 308# 309#! rmdir cnp DELETE, LOCKPARENT | LOCKLEAF 310# 311vop_rmdir { 312 IN LOCKED=YES WILLPUT struct vnode *dvp; 313 IN LOCKED=YES WILLPUT struct vnode *vp; 314 IN struct componentname *cnp; 315}; 316 317# 318#% symlink dvp L U U 319#% symlink vpp - L - 320# 321#! symlink cnp CREATE, LOCKPARENT 322# 323vop_symlink { 324 IN LOCKED=YES WILLPUT struct vnode *dvp; 325 OUT WILLMAKE struct vnode **vpp; 326 IN struct componentname *cnp; 327 IN struct vattr *vap; 328 IN char *target; 329}; 330 331# 332#% readdir vp L L L 333# 334vop_readdir { 335 IN LOCKED=YES struct vnode *vp; 336 INOUT struct uio *uio; 337 IN kauth_cred_t cred; 338 OUT int *eofflag; 339 OUT off_t **cookies; 340 IN int *ncookies; 341}; 342 343# 344#% readlink vp L L L 345# 346vop_readlink { 347 IN LOCKED=YES struct vnode *vp; 348 INOUT struct uio *uio; 349 IN kauth_cred_t cred; 350}; 351 352# 353#% abortop dvp = = = 354# 355#! abortop cnp as appropriate. 356# 357vop_abortop { 358 IN struct vnode *dvp; 359 IN struct componentname *cnp; 360}; 361 362# 363#% inactive vp L U U 364# 365vop_inactive { 366 IN LOCKED=YES WILLUNLOCK struct vnode *vp; 367 INOUT bool *recycle; 368}; 369 370# 371#% reclaim vp U U U 372# 373vop_reclaim { 374 IN LOCKED=NO struct vnode *vp; 375}; 376 377# 378#% lock vp U L U 379# 380vop_lock { 381 IN LOCKED=NO struct vnode *vp; 382 IN int flags; 383}; 384 385# 386#% unlock vp L U L 387# 388vop_unlock { 389 IN LOCKED=YES struct vnode *vp; 390}; 391 392# 393#% bmap vp = = = 394#% bmap vpp - U - 395# 396vop_bmap { 397 IN struct vnode *vp; 398 IN daddr_t bn; 399 OUT struct vnode **vpp; 400 IN daddr_t *bnp; 401 OUT int *runp; 402}; 403 404# 405#% strategy vp = = = 406# 407vop_strategy { 408 IN struct vnode *vp; 409 IN struct buf *bp; 410}; 411 412# 413#% print vp = = = 414# 415vop_print { 416 IN struct vnode *vp; 417}; 418 419# 420#% islocked vp = = = 421# 422vop_islocked { 423 IN struct vnode *vp; 424}; 425 426# 427#% pathconf vp L L L 428# 429vop_pathconf { 430 IN LOCKED=YES struct vnode *vp; 431 IN int name; 432 OUT register_t *retval; 433}; 434 435# 436#% advlock vp U U U 437# 438vop_advlock { 439 IN LOCKED=NO struct vnode *vp; 440 IN void *id; 441 IN int op; 442 IN struct flock *fl; 443 IN int flags; 444}; 445 446# 447#% whiteout dvp L L L 448#% whiteout cnp - - - 449#% whiteout flag - - - 450# 451#! whiteout cnp CREATE, LOCKPARENT 452# 453vop_whiteout { 454 IN LOCKED=YES struct vnode *dvp; 455 IN struct componentname *cnp; 456 IN int flags; 457}; 458 459# 460# Needs work: no vp? 461# 462#vop_bwrite { 463# IN struct buf *bp; 464#}; 465 466# 467#% getpages vp = = = 468# 469vop_getpages { 470 IN struct vnode *vp; 471 IN voff_t offset; 472 IN struct vm_page **m; 473 IN int *count; 474 IN int centeridx; 475 IN vm_prot_t access_type; 476 IN int advice; 477 IN int flags; 478}; 479 480# 481#% putpages vp = = = 482# 483vop_putpages { 484 IN struct vnode *vp; 485 IN voff_t offlo; 486 IN voff_t offhi; 487 IN int flags; 488}; 489 490# 491#% closeextattr vp L L L 492# 493vop_closeextattr { 494 IN LOCKED=YES struct vnode *vp; 495 IN int commit; 496 IN kauth_cred_t cred; 497}; 498 499# 500#% getextattr vp L L L 501# 502vop_getextattr { 503 IN LOCKED=YES struct vnode *vp; 504 IN int attrnamespace; 505 IN const char *name; 506 INOUT struct uio *uio; 507 OUT size_t *size; 508 IN kauth_cred_t cred; 509}; 510 511# 512#% listextattr vp L L L 513# 514vop_listextattr { 515 IN LOCKED=YES struct vnode *vp; 516 IN int attrnamespace; 517 INOUT struct uio *uio; 518 OUT size_t *size; 519 IN kauth_cred_t cred; 520}; 521 522# 523#% openextattr vp L L L 524# 525vop_openextattr { 526 IN LOCKED=YES struct vnode *vp; 527 IN kauth_cred_t cred; 528}; 529 530# 531#% deleteextattr vp L L L 532# 533vop_deleteextattr { 534 IN LOCKED=YES struct vnode *vp; 535 IN int attrnamespace; 536 IN const char *name; 537 IN kauth_cred_t cred; 538}; 539 540# 541#% setextattr vp L L L 542# 543vop_setextattr { 544 IN LOCKED=YES struct vnode *vp; 545 IN int attrnamespace; 546 IN const char *name; 547 INOUT struct uio *uio; 548 IN kauth_cred_t cred; 549}; 550