1 2/* 3 * Copyright (c) 2000-2014 Apple Computer, Inc. All rights reserved. 4 * 5 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 6 * 7 * This file contains Original Code and/or Modifications of Original Code 8 * as defined in and that are subject to the Apple Public Source License 9 * Version 2.0 (the 'License'). You may not use this file except in 10 * compliance with the License. The rights granted to you under the License 11 * may not be used to create, or enable the creation or redistribution of, 12 * unlawful or unlicensed copies of an Apple operating system, or to 13 * circumvent, violate, or enable the circumvention or violation of, any 14 * terms of an Apple operating system software license agreement. 15 * 16 * Please obtain a copy of the License at 17 * http://www.opensource.apple.com/apsl/ and read it before using this file. 18 * 19 * The Original Code and all software distributed under the License are 20 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 21 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 22 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 23 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 24 * Please see the License for the specific language governing rights and 25 * limitations under the License. 26 * 27 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 28 */ 29/* 30 * Copyright (c) 1995 NeXT Computer, Inc. All Rights Reserved 31 * Copyright (c) 1992, 1993, 1994, 1995 32 * The Regents of the University of California. All rights reserved. 33 * 34 * Redistribution and use in source and binary forms, with or without 35 * modification, are permitted provided that the following conditions 36 * are met: 37 * 1. Redistributions of source code must retain the above copyright 38 * notice, this list of conditions and the following disclaimer. 39 * 2. Redistributions in binary form must reproduce the above copyright 40 * notice, this list of conditions and the following disclaimer in the 41 * documentation and/or other materials provided with the distribution. 42 * 3. All advertising materials mentioning features or use of this software 43 * must display the following acknowledgement: 44 * This product includes software developed by the University of 45 * California, Berkeley and its contributors. 46 * 4. Neither the name of the University nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS AND 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * SUCH DAMAGE. 61 */ 62/* 63 * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce 64 * support for mandatory and extensible security protections. This notice 65 * is included in support of clause 2.2 (b) of the Apple Public License, 66 * Version 2.0. 67 */ 68 69/* 70 * Warning: This file is generated automatically. 71 * (Modifications made here may easily be lost!) 72 * 73 * Created by the script: 74 * @(#)vnode_if.sh 8.7 (Berkeley) 5/11/95 75 */ 76 77 78#ifndef _SYS_VNODE_IF_H_ 79#define _SYS_VNODE_IF_H_ 80 81#include <sys/appleapiopts.h> 82#include <sys/cdefs.h> 83#include <sys/kernel_types.h> 84#include <sys/buf.h> 85#ifdef BSD_KERNEL_PRIVATE 86#include <sys/vm.h> 87#endif 88#include <mach/memory_object_types.h> 89 90 91#ifdef KERNEL 92 93extern struct vnodeop_desc vnop_default_desc; 94extern struct vnodeop_desc vnop_lookup_desc; 95#ifdef KERNEL_PRIVATE 96extern struct vnodeop_desc vnop_compound_open_desc; 97extern struct vnodeop_desc vnop_compound_remove_desc; 98extern struct vnodeop_desc vnop_compound_rename_desc; 99extern struct vnodeop_desc vnop_compound_mkdir_desc; 100extern struct vnodeop_desc vnop_compound_rmdir_desc; 101#endif /* KERNEL_PRIVATE */ 102extern struct vnodeop_desc vnop_create_desc; 103extern struct vnodeop_desc vnop_whiteout_desc; // obsolete 104extern struct vnodeop_desc vnop_mknod_desc; 105extern struct vnodeop_desc vnop_open_desc; 106extern struct vnodeop_desc vnop_close_desc; 107extern struct vnodeop_desc vnop_access_desc; 108extern struct vnodeop_desc vnop_getattr_desc; 109extern struct vnodeop_desc vnop_setattr_desc; 110extern struct vnodeop_desc vnop_read_desc; 111extern struct vnodeop_desc vnop_write_desc; 112extern struct vnodeop_desc vnop_ioctl_desc; 113extern struct vnodeop_desc vnop_select_desc; 114extern struct vnodeop_desc vnop_exchange_desc; 115extern struct vnodeop_desc vnop_revoke_desc; 116extern struct vnodeop_desc vnop_mmap_desc; 117extern struct vnodeop_desc vnop_mnomap_desc; 118extern struct vnodeop_desc vnop_fsync_desc; 119extern struct vnodeop_desc vnop_remove_desc; 120extern struct vnodeop_desc vnop_link_desc; 121extern struct vnodeop_desc vnop_rename_desc; 122extern struct vnodeop_desc vnop_mkdir_desc; 123extern struct vnodeop_desc vnop_rmdir_desc; 124extern struct vnodeop_desc vnop_symlink_desc; 125extern struct vnodeop_desc vnop_readdir_desc; 126extern struct vnodeop_desc vnop_readdirattr_desc; 127extern struct vnodeop_desc vnop_getattrlistbulk_desc; 128extern struct vnodeop_desc vnop_readlink_desc; 129extern struct vnodeop_desc vnop_inactive_desc; 130extern struct vnodeop_desc vnop_reclaim_desc; 131extern struct vnodeop_desc vnop_print_desc; 132extern struct vnodeop_desc vnop_pathconf_desc; 133extern struct vnodeop_desc vnop_advlock_desc; 134extern struct vnodeop_desc vnop_truncate_desc; 135extern struct vnodeop_desc vnop_allocate_desc; 136extern struct vnodeop_desc vnop_pagein_desc; 137extern struct vnodeop_desc vnop_pageout_desc; 138extern struct vnodeop_desc vnop_searchfs_desc; 139extern struct vnodeop_desc vnop_copyfile_desc; 140extern struct vnodeop_desc vnop_blktooff_desc; 141extern struct vnodeop_desc vnop_offtoblk_desc; 142extern struct vnodeop_desc vnop_blockmap_desc; 143extern struct vnodeop_desc vnop_strategy_desc; 144extern struct vnodeop_desc vnop_bwrite_desc; 145 146#ifdef __APPLE_API_UNSTABLE 147 148#if NAMEDSTREAMS 149extern struct vnodeop_desc vnop_getnamedstream_desc; 150extern struct vnodeop_desc vnop_makenamedstream_desc; 151extern struct vnodeop_desc vnop_removenamedstream_desc; 152#endif 153 154#endif 155 156__BEGIN_DECLS 157 158struct vnop_lookup_args { 159 struct vnodeop_desc *a_desc; 160 vnode_t a_dvp; 161 vnode_t *a_vpp; 162 struct componentname *a_cnp; 163 vfs_context_t a_context; 164}; 165 166/*! 167 @function VNOP_LOOKUP 168 @abstract Call down to a filesystem to look for a directory entry by name. 169 @discussion VNOP_LOOKUP is the key pathway through which VFS asks a filesystem to find a file. The vnode 170 should be returned with an iocount to be dropped by the caller. A VNOP_LOOKUP() calldown can come without 171 a preceding VNOP_OPEN(). 172 @param dvp Directory in which to look up file. 173 @param vpp Destination for found vnode. 174 @param cnp Structure describing filename to find, reason for lookup, and various other data. 175 @param ctx Context against which to authenticate lookup request. 176 @return 0 for success or a filesystem-specific error. 177 */ 178#ifdef XNU_KERNEL_PRIVATE 179extern errno_t VNOP_LOOKUP(vnode_t, vnode_t *, struct componentname *, vfs_context_t); 180#endif /* XNU_KERNEL_PRIVATE */ 181 182struct vnop_create_args { 183 struct vnodeop_desc *a_desc; 184 vnode_t a_dvp; 185 vnode_t *a_vpp; 186 struct componentname *a_cnp; 187 struct vnode_attr *a_vap; 188 vfs_context_t a_context; 189}; 190 191/*! 192 @function VNOP_CREATE 193 @abstract Call down to a filesystem to create a regular file (VREG). 194 @discussion If file creation succeeds, "vpp" should be returned with an iocount to be dropped by the caller. 195 A VNOP_CREATE() calldown can come without a preceding VNOP_OPEN(). 196 @param dvp Directory in which to create file. 197 @param vpp Destination for vnode for newly created file. 198 @param cnp Description of filename to create. 199 @param vap File creation properties, as seen in vnode_getattr(). Manipulated with VATTR_ISACTIVE, VATTR_RETURN, 200 VATTR_SET_SUPPORTED, and so forth. 201 @param ctx Context against which to authenticate file creation. 202 @return 0 for success or a filesystem-specific error. 203 */ 204#ifdef XNU_KERNEL_PRIVATE 205extern errno_t VNOP_CREATE(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); 206#endif /* XNU_KERNEL_PRIVATE */ 207 208struct vnop_whiteout_args { 209 struct vnodeop_desc *a_desc; 210 vnode_t a_dvp; 211 struct componentname *a_cnp; 212 int a_flags; 213 vfs_context_t a_context; 214}; 215 216/*! 217 @function VNOP_WHITEOUT 218 @abstract Obsolete - no longer supported. 219 @discussion Whiteouts are used to support the union filesystem, whereby one filesystem is mounted "transparently" 220 on top of another. A whiteout in the upper layer of a union mount is a "deletion" of a file in the lower layer; 221 lookups will catch the whiteout and fail, setting ISWHITEOUT in the componentname structure, even if an underlying 222 file of the same name exists. The whiteout vnop is used for creation, deletion, and checking whether a directory 223 supports whiteouts (see flags). 224 also support the LOOKUP flag, which is used to test whether a directory supports whiteouts. 225 @param dvp Directory in which to create. 226 @param cnp Name information for whiteout. 227 @param flags CREATE: create a whiteout. LOOKUP: check whether a directory supports whiteouts, DELETE: remove a whiteout. 228 @param ctx Context against which to authenticate whiteout creation. 229 @return 0 for success or a filesystem-specific error. Returning 0 for LOOKUP indicates that a directory does support whiteouts. 230 */ 231#ifdef XNU_KERNEL_PRIVATE 232extern errno_t VNOP_WHITEOUT(vnode_t, struct componentname *, int, vfs_context_t); 233#endif /* XNU_KERNEL_PRIVATE */ 234 235struct vnop_mknod_args { 236 struct vnodeop_desc *a_desc; 237 vnode_t a_dvp; 238 vnode_t *a_vpp; 239 struct componentname *a_cnp; 240 struct vnode_attr *a_vap; 241 vfs_context_t a_context; 242}; 243 244/*! 245 @function VNOP_MKNOD 246 @abstract Call down to a filesystem to create a special file. 247 @discussion The mknod vnop is used to create character and block device files, named pipe (FIFO) files, and named sockets. 248 The newly created file should be returned with an iocount which will be dropped by the caller. A VNOP_MKNOD() call 249 can come down without a preceding VNOP_OPEN(). 250 @param dvp Directory in which to create the special file. 251 @param vpp Destination for newly created vnode. 252 @param cnp Name information for new file. 253 @param vap Attributes for new file, including type. 254 @param ctx Context against which to authenticate node creation. 255 @return 0 for success or a filesystem-specific error. 256 */ 257#ifdef XNU_KERNEL_PRIVATE 258extern errno_t VNOP_MKNOD(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); 259#endif /* XNU_KERNEL_PRIVATE */ 260 261struct vnop_open_args { 262 struct vnodeop_desc *a_desc; 263 vnode_t a_vp; 264 int a_mode; 265 vfs_context_t a_context; 266}; 267 268#ifdef KERNEL_PRIVATE 269struct vnop_compound_open_args { 270 struct vnodeop_desc *a_desc; 271 272 vnode_t a_dvp; /* Directory in which to open/create */ 273 vnode_t *a_vpp; /* Resulting vnode */ 274 int a_fmode; /* Open mode */ 275 struct componentname *a_cnp; /* Path to look up */ 276 struct vnode_attr *a_vap; /* Attributes with which to create, if appropriate */ 277 uint32_t a_flags; /* VNOP-control flags */ 278 uint32_t *a_status; /* Information about results */ 279 280 vfs_context_t a_context; /* Authorization context */ 281 282 int (*a_open_create_authorizer)( /* Authorizer for create case */ 283 vnode_t dvp, /* Directory in which to create */ 284 struct componentname *cnp, /* As passed to VNOP */ 285 struct vnode_attr *vap, /* As passed to VNOP */ 286 vfs_context_t ctx, /* Context */ 287 void *reserved); /* Who knows */ 288 289 int (*a_open_existing_authorizer)( /* Authorizer for preexisting case */ 290 vnode_t vp, /* vp to open */ 291 struct componentname *cnp, /* Lookup state */ 292 int fmode, /* As passed to VNOP */ 293 vfs_context_t ctx, /* Context */ 294 void *reserved); /* Who knows */ 295 296 void *a_reserved; 297}; 298 299/* Results */ 300#define COMPOUND_OPEN_STATUS_DID_CREATE 0x00000001 301#endif /* KERNEL_PRIVATE */ 302 303/*! 304 @function VNOP_OPEN 305 @abstract Call down to a filesystem to open a file. 306 @discussion The open vnop gives a filesystem a chance to initialize a file for 307 operations like reading, writing, and ioctls. VFS promises to send down exactly one VNOP_CLOSE() 308 for each VNOP_OPEN(). 309 @param vp File to open. 310 @param mode FREAD and/or FWRITE. 311 @param ctx Context against which to authenticate open. 312 @return 0 for success or a filesystem-specific error. 313 */ 314#ifdef XNU_KERNEL_PRIVATE 315extern errno_t VNOP_OPEN(vnode_t, int, vfs_context_t); 316#endif /* XNU_KERNEL_PRIVATE */ 317 318#ifdef BSD_KERNEL_PRIVATE 319struct nameidata; 320extern int VNOP_COMPOUND_OPEN(vnode_t dvp, vnode_t *vpp, struct nameidata *ndp, int32_t flags, int32_t fmode, uint32_t *status, struct vnode_attr *vap, vfs_context_t ctx); 321#endif 322 323struct vnop_close_args { 324 struct vnodeop_desc *a_desc; 325 vnode_t a_vp; 326 int a_fflag; 327 vfs_context_t a_context; 328}; 329 330/*! 331 @function VNOP_CLOSE 332 @abstract Call down to a filesystem to close a file. 333 @discussion The close vnop gives a filesystem a chance to release state set up 334 by a VNOP_OPEN(). VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN(). 335 @param vp File to close. 336 @param fflag FREAD and/or FWRITE; in the case of a file opened with open(2), fflag corresponds 337 to how the file was opened. 338 @param ctx Context against which to authenticate close. 339 @return 0 for success or a filesystem-specific error. 340 */ 341#ifdef XNU_KERNEL_PRIVATE 342extern errno_t VNOP_CLOSE(vnode_t, int, vfs_context_t); 343#endif /* XNU_KERNEL_PRIVATE */ 344 345struct vnop_access_args { 346 struct vnodeop_desc *a_desc; 347 vnode_t a_vp; 348 int a_action; 349 vfs_context_t a_context; 350}; 351 352/*! 353 @function VNOP_ACCESS 354 @abstract Call down to a filesystem to see if a kauth-style operation is permitted. 355 @discussion VNOP_ACCESS is currently only called on filesystems which mark themselves 356 as doing their authentication remotely (vfs_setauthopaque(), vfs_authopaque()). A VNOP_ACCESS() 357 calldown may come without any preceding VNOP_OPEN(). 358 @param vp File to authorize action for. 359 @param action kauth-style action to be checked for permissions, e.g. KAUTH_VNODE_DELETE. 360 @param ctx Context against which to authenticate action. 361 @return 0 for success or a filesystem-specific error. 362 */ 363#ifdef XNU_KERNEL_PRIVATE 364extern errno_t VNOP_ACCESS(vnode_t, int, vfs_context_t); 365#endif /* XNU_KERNEL_PRIVATE */ 366 367struct vnop_getattr_args { 368 struct vnodeop_desc *a_desc; 369 vnode_t a_vp; 370 struct vnode_attr *a_vap; 371 vfs_context_t a_context; 372}; 373 374/*! 375 @function VNOP_GETATTR 376 @abstract Call down to a filesystem to get vnode attributes. 377 @discussion Supported attributes ("Yes, I am returning this information") are set with VATTR_SET_SUPPORTED. 378 Which attributes have been requested is checked with VATTR_IS_ACTIVE. Attributes 379 are returned with VATTR_RETURN. It is through VNOP_GETATTR that routines like stat() get their information. 380 A VNOP_GETATTR() calldown may come without any preceding VNOP_OPEN(). 381 @param vp The vnode whose attributes to get. 382 @param vap Container for which attributes are requested, which attributes are supported by the filesystem, and attribute values. 383 @param ctx Context against which to authenticate request for attributes. 384 @return 0 for success or a filesystem-specific error. VNOP_GETATTR() can return success even if not 385 all requested attributes were returned; returning an error-value should indicate that something went wrong, rather than that 386 some attribute is not supported. 387 */ 388#ifdef XNU_KERNEL_PRIVATE 389extern errno_t VNOP_GETATTR(vnode_t, struct vnode_attr *, vfs_context_t); 390#endif /* XNU_KERNEL_PRIVATE */ 391 392struct vnop_setattr_args { 393 struct vnodeop_desc *a_desc; 394 vnode_t a_vp; 395 struct vnode_attr *a_vap; 396 vfs_context_t a_context; 397}; 398 399/*! 400 @function VNOP_SETATTR 401 @abstract Call down to a filesystem to set vnode attributes. 402 @discussion Supported attributes ("Yes, I am setting this attribute.") are set with VATTR_SET_SUPPORTED. 403 Requested attributes are checked with VATTR_IS_ACTIVE. Attribute values are accessed directly through 404 structure fields. VNOP_SETATTR() is the core of the KPI function vnode_setattr(), which is used by chmod(), 405 chown(), truncate(), and many others. A VNOP_SETATTR() call may come without any preceding VNOP_OPEN(). 406 @param vp The vnode whose attributes to set. 407 @param vap Container for which attributes are to be set and their desired values, as well as for the filesystem to 408 return information about which attributes were successfully set. 409 @param ctx Context against which to authenticate request for attribute change. 410 @return 0 for success or a filesystem-specific error. VNOP_SETATTR() can return success even if not 411 all requested attributes were set; returning an error-value should indicate that something went wrong, rather than that 412 some attribute is not supported. 413 */ 414#ifdef XNU_KERNEL_PRIVATE 415extern errno_t VNOP_SETATTR(vnode_t, struct vnode_attr *, vfs_context_t); 416#endif /* XNU_KERNEL_PRIVATE */ 417 418struct vnop_read_args { 419 struct vnodeop_desc *a_desc; 420 vnode_t a_vp; 421 struct uio *a_uio; 422 int a_ioflag; 423 vfs_context_t a_context; 424}; 425 426/*! 427 @function VNOP_READ 428 @abstract Call down to a filesystem to read file data. 429 @discussion VNOP_READ() is where the hard work of of the read() system call happens. The filesystem may use 430 the buffer cache, the cluster layer, or an alternative method to get its data; uio routines will be used to see that data 431 is copied to the correct virtual address in the correct address space and will update its uio argument 432 to indicate how much data has been moved. 433 @param vp The vnode to read from. 434 @param uio Description of request, including file offset, amount of data requested, destination address for data, 435 and whether that destination is in kernel or user space. 436 @param ctx Context against which to authenticate read request. 437 @return 0 for success or a filesystem-specific error. VNOP_READ() can return success even if less data was 438 read than originally requested; returning an error value should indicate that something actually went wrong. 439 */ 440extern errno_t VNOP_READ(vnode_t, struct uio *, int, vfs_context_t); 441 442struct vnop_write_args { 443 struct vnodeop_desc *a_desc; 444 vnode_t a_vp; 445 struct uio *a_uio; 446 int a_ioflag; 447 vfs_context_t a_context; 448}; 449 450/*! 451 @function VNOP_WRITE 452 @abstract Call down to the filesystem to write file data. 453 @discussion VNOP_WRITE() is to write() as VNOP_READ() is to read(). The filesystem may use 454 the buffer cache, the cluster layer, or an alternative method to write its data; uio routines will be used to see that data 455 is copied to the correct virtual address in the correct address space and will update its uio argument 456 to indicate how much data has been moved. 457 @param vp The vnode to write to. 458 @param uio Description of request, including file offset, amount of data to write, source address for data, 459 and whether that destination is in kernel or user space. 460 @param ctx Context against which to authenticate write request. 461 @return 0 for success or a filesystem-specific error. VNOP_WRITE() can return success even if less data was 462 written than originally requested; returning an error value should indicate that something actually went wrong. 463 */ 464extern errno_t VNOP_WRITE(vnode_t, struct uio *, int, vfs_context_t); 465 466struct vnop_ioctl_args { 467 struct vnodeop_desc *a_desc; 468 vnode_t a_vp; 469 u_long a_command; 470 caddr_t a_data; 471 int a_fflag; 472 vfs_context_t a_context; 473}; 474 475/*! 476 @function VNOP_IOCTL 477 @abstract Call down to a filesystem or device driver to execute various control operations on or request data about a file. 478 @discussion Ioctl controls are typically associated with devices, but they can in fact be passed 479 down for any file; they are used to implement any of a wide range of controls and information requests. 480 fcntl() calls VNOP_IOCTL for several commands, and will attempt a VNOP_IOCTL if it is passed an unknown command, 481 though no copyin or copyout of arguments can occur in this case--the "arg" must be an integer value. 482 Filesystems can define their own fcntls using this mechanism. How ioctl commands are structured 483 is slightly complicated; see the manual page for ioctl(2). 484 @param vp The vnode to execute the command on. 485 @param command Identifier for action to take. 486 @param data Pointer to data; this can be an integer constant (of 32 bits only) or an address to be read from or written to, 487 depending on "command." If it is an address, it is valid and resides in the kernel; callers of VNOP_IOCTL() are 488 responsible for copying to and from userland. 489 @param ctx Context against which to authenticate ioctl request. 490 @return 0 for success or a filesystem-specific error. 491 */ 492extern errno_t VNOP_IOCTL(vnode_t, u_long, caddr_t, int, vfs_context_t); 493 494struct vnop_select_args { 495 struct vnodeop_desc *a_desc; 496 vnode_t a_vp; 497 int a_which; 498 int a_fflags; 499 void *a_wql; 500 vfs_context_t a_context; 501}; 502 503/*! 504 @function VNOP_SELECT 505 @abstract Call down to a filesystem or device to check if a file is ready for I/O and request later notification if it is not currently ready. 506 @discussion In general, regular are always "ready for I/O" and their select vnops simply return "1." 507 Devices, though, may or may not be read; they keep track of who is selecting on them and send notifications 508 when they become ready. xnu provides structures and routines for tracking threads waiting for I/O and waking up 509 those threads: see selrecord(), selthreadclear(), seltrue(), selwait(), selwakeup(), and the selinfo structure (sys/select.h). 510 @param vp The vnode to check for I/O readiness. 511 @param which What kind of I/O is desired: FREAD, FWRITE. 512 @param fflags Flags from fileglob as seen in fcntl.h, e.g. O_NONBLOCK, O_APPEND. 513 @param wql Opaque object to pass to selrecord(). 514 @param ctx Context to authenticate for select request. 515 @return Nonzero indicates that a file is ready for I/O. 0 indicates that the file is not ready for I/O; 516 there is no way to return an error. 0 should be returned if the device (or file) is not ready for I/O 517 and the driver (or filesystem) is going to track the request and provide subsequent wakeups. 518 the device (or filesystem) will provide a wakeup. 519 */ 520#ifdef XNU_KERNEL_PRIVATE 521extern errno_t VNOP_SELECT(vnode_t, int, int, void *, vfs_context_t); 522#endif /* XNU_KERNEL_PRIVATE */ 523 524struct vnop_exchange_args { 525 struct vnodeop_desc *a_desc; 526 vnode_t a_fvp; 527 vnode_t a_tvp; 528 int a_options; 529 vfs_context_t a_context; 530}; 531 532/*! 533 @function VNOP_EXCHANGE 534 @abstract Call down to a filesystem to atomically exchange the data of two files. 535 @discussion VNOP_EXCHANGE() is currently only called by the exchangedata() system call. It will only 536 be applied to files on the same volume. 537 @param fvp First vnode. 538 @param tvp Second vnode. 539 @param options Unused. 540 @param ctx Context to authenticate for exchangedata request. 541 @return 0 for success, else an error code. 542 */ 543#ifdef XNU_KERNEL_PRIVATE 544extern errno_t VNOP_EXCHANGE(vnode_t, vnode_t, int, vfs_context_t); 545#endif /* XNU_KERNEL_PRIVATE */ 546 547struct vnop_revoke_args { 548 struct vnodeop_desc *a_desc; 549 vnode_t a_vp; 550 int a_flags; 551 vfs_context_t a_context; 552}; 553 554/*! 555 @function VNOP_REVOKE 556 @abstract Call down to a filesystem to invalidate all open file descriptors for a vnode. 557 @discussion This function is typically called as part of a TTY revoke, but can also be 558 used on regular files. Most filesystems simply use nop_revoke(), which calls vn_revoke(), 559 as their revoke vnop implementation. 560 @param vp The vnode to revoke. 561 @param flags Unused. 562 @param ctx Context to authenticate for revoke request. 563 @return 0 for success, else an error code. 564 */ 565#ifdef XNU_KERNEL_PRIVATE 566extern errno_t VNOP_REVOKE(vnode_t, int, vfs_context_t); 567#endif /* XNU_KERNEL_PRIVATE */ 568 569struct vnop_mmap_args { 570 struct vnodeop_desc *a_desc; 571 vnode_t a_vp; 572 int a_fflags; 573 vfs_context_t a_context; 574}; 575 576/*! 577 @function VNOP_MMAP 578 @abstract Notify a filesystem that a file is being mmap-ed. 579 @discussion VNOP_MMAP is an advisory calldown to say that the system is mmap-ing a file. 580 @param vp The vnode being mmapped. 581 @param flags Memory protection: PROT_READ, PROT_WRITE, PROT_EXEC. 582 @param ctx Context to authenticate for mmap request. 583 @return 0 for success; all errors except EPERM are ignored. 584 */ 585#ifdef XNU_KERNEL_PRIVATE 586extern errno_t VNOP_MMAP(vnode_t, int, vfs_context_t); 587#endif /* XNU_KERNEL_PRIVATE */ 588 589struct vnop_mnomap_args { 590 struct vnodeop_desc *a_desc; 591 vnode_t a_vp; 592 vfs_context_t a_context; 593}; 594 595/*! 596 @function VNOP_MNOMAP 597 @abstract Inform a filesystem that a file is no longer mapped. 598 @discussion In general, no action is required of a filesystem for VNOP_MNOMAP. 599 @param vp The vnode which is no longer mapped. 600 @param ctx Context to authenticate for mnomap request. 601 @return Return value is ignored. 602 */ 603#ifdef XNU_KERNEL_PRIVATE 604extern errno_t VNOP_MNOMAP(vnode_t, vfs_context_t); 605#endif /* XNU_KERNEL_PRIVATE */ 606 607struct vnop_fsync_args { 608 struct vnodeop_desc *a_desc; 609 vnode_t a_vp; 610 int a_waitfor; 611 vfs_context_t a_context; 612}; 613 614/*! 615 @function VNOP_FSYNC 616 @abstract Call down to a filesystem to synchronize a file with on-disk state. 617 @discussion VNOP_FSYNC is called whenever we need to make sure that a file's data has been 618 pushed to backing store, for example when recycling; it is also the heart of the fsync() system call. 619 @param vp The vnode whose data to flush to backing store. 620 @param ctx Context to authenticate for fsync request. 621 @return 0 for success, else an error code. 622 */ 623extern errno_t VNOP_FSYNC(vnode_t, int, vfs_context_t); 624 625struct vnop_remove_args { 626 struct vnodeop_desc *a_desc; 627 vnode_t a_dvp; 628 vnode_t a_vp; 629 struct componentname *a_cnp; 630 int a_flags; 631 vfs_context_t a_context; 632}; 633 634/*! 635 @function VNOP_REMOVE 636 @abstract Call down to a filesystem to delete a file. 637 @discussion VNOP_REMOVE is called to remove a file from a filesystem's namespace, for example by unlink(). 638 It can operate on regular files, named pipes, special files, and in some cases on directories. 639 @param dvp Directory in which to delete a file. 640 @param vp The file to delete. 641 @param cnp Filename information. 642 @param ctx Context to authenticate for fsync request. 643 @return 0 for success, else an error code. 644 */ 645#ifdef XNU_KERNEL_PRIVATE 646extern errno_t VNOP_REMOVE(vnode_t, vnode_t, struct componentname *, int, vfs_context_t); 647#endif /* XNU_KERNEL_PRIVATE */ 648 649#ifdef KERNEL_PRIVATE 650struct vnop_compound_remove_args { 651 struct vnodeop_desc *a_desc; 652 vnode_t a_dvp; /* Directory in which to lookup and remove */ 653 vnode_t *a_vpp; /* File to remove; may or may not point to NULL pointer */ 654 struct componentname *a_cnp; /* Name of file to remove */ 655 struct vnode_attr *a_vap; /* Destination for file attributes on successful delete */ 656 uint32_t a_flags; /* Control flags (unused) */ 657 vfs_context_t a_context; /* Authorization context */ 658 int (*a_remove_authorizer)( /* Authorizer callback */ 659 vnode_t dvp, /* Directory in which to delete */ 660 vnode_t vp, /* File to delete */ 661 struct componentname *cnp, /* As passed to VNOP */ 662 vfs_context_t ctx, /* As passed to VNOP */ 663 void *reserved); /* Always NULL */ 664 void *a_reserved; /* Unused */ 665}; 666#endif /* KERNEL_PRIVATE */ 667 668#ifdef BSD_KERNEL_PRIVATE 669extern errno_t VNOP_COMPOUND_REMOVE(vnode_t, vnode_t*, struct nameidata *, int32_t flags, struct vnode_attr *vap, vfs_context_t); 670#endif 671struct vnop_link_args { 672 struct vnodeop_desc *a_desc; 673 vnode_t a_vp; 674 vnode_t a_tdvp; 675 struct componentname *a_cnp; 676 vfs_context_t a_context; 677}; 678 679/*! 680 @function VNOP_LINK 681 @abstract Call down to a filesystem to create a hardlink to a file. 682 @discussion See "man 2 link". 683 @param vp File to link to. 684 @param dvp Directory in which to create the link. 685 @param cnp Filename information for new link. 686 @param ctx Context to authenticate for link request. 687 @return 0 for success, else an error code. 688 */ 689#ifdef XNU_KERNEL_PRIVATE 690extern errno_t VNOP_LINK(vnode_t, vnode_t, struct componentname *, vfs_context_t); 691#endif /* XNU_KERNEL_PRIVATE */ 692 693struct vnop_rename_args { 694 struct vnodeop_desc *a_desc; 695 vnode_t a_fdvp; 696 vnode_t a_fvp; 697 struct componentname *a_fcnp; 698 vnode_t a_tdvp; 699 vnode_t a_tvp; 700 struct componentname *a_tcnp; 701 vfs_context_t a_context; 702}; 703 704/*! 705 @function VNOP_RENAME 706 @abstract Call down to a filesystem to rename a file. 707 @discussion VNOP_RENAME() will only be called with a source and target on the same volume. 708 @param fdvp Directory in which source file resides. 709 @param fvp File being renamed. 710 @param fcnp Name information for source file. 711 @param tdvp Directory file is being moved to. 712 @param tvp Existing file with same name as target, should one exist. 713 @param tcnp Name information for target path. 714 @param ctx Context to authenticate for rename request. 715 @return 0 for success, else an error code. 716 */ 717#ifdef XNU_KERNEL_PRIVATE 718extern errno_t VNOP_RENAME(vnode_t, vnode_t, struct componentname *, vnode_t, vnode_t, struct componentname *, vfs_context_t); 719#endif /* XNU_KERNEL_PRIVATE */ 720 721#ifdef KERNEL_PRIVATE 722struct vnop_compound_rename_args { 723 struct vnodeop_desc *a_desc; 724 725 vnode_t a_fdvp; /* Directory from which to rename */ 726 vnode_t *a_fvpp; /* Vnode to rename (can point to a NULL pointer) */ 727 struct componentname *a_fcnp; /* Source name */ 728 struct vnode_attr *a_fvap; 729 730 vnode_t a_tdvp; /* Directory to which to rename */ 731 vnode_t *a_tvpp; /* Vnode to rename over (can point to a NULL pointer) */ 732 struct componentname *a_tcnp; /* Destination name */ 733 struct vnode_attr *a_tvap; 734 735 uint32_t a_flags; /* Control flags: currently unused */ 736 vfs_context_t a_context; /* Authorization context */ 737 int (*a_rename_authorizer)( /* Authorization callback */ 738 vnode_t fdvp, /* As passed to VNOP */ 739 vnode_t fvp, /* Vnode to rename */ 740 struct componentname *fcnp, /* As passed to VNOP */ 741 vnode_t tdvp, /* As passed to VNOP */ 742 vnode_t tvp, /* Vnode to rename over (can be NULL) */ 743 struct componentname *tcnp, /* As passed to VNOP */ 744 vfs_context_t ctx, /* As passed to VNOP */ 745 void *reserved); /* Always NULL */ 746 void *a_reserved; /* Currently unused */ 747}; 748#endif /* KERNEL_PRIVATE */ 749 750#ifdef XNU_KERNEL_PRIVATE 751errno_t 752VNOP_COMPOUND_RENAME( 753 struct vnode *fdvp, struct vnode **fvpp, struct componentname *fcnp, struct vnode_attr *fvap, 754 struct vnode *tdvp, struct vnode **tvpp, struct componentname *tcnp, struct vnode_attr *tvap, 755 uint32_t flags,vfs_context_t ctx); 756#endif /* XNU_KERNEL_PRIVATE */ 757 758struct vnop_mkdir_args { 759 struct vnodeop_desc *a_desc; 760 vnode_t a_dvp; 761 vnode_t *a_vpp; 762 struct componentname *a_cnp; 763 struct vnode_attr *a_vap; 764 vfs_context_t a_context; 765}; 766 767/*! 768 @function VNOP_MKDIR 769 @abstract Call down to a filesystem to create a directory. 770 @discussion The newly created directory should be returned with an iocount which will be dropped by the caller. 771 @param dvp Directory in which to create new directory. 772 @param vpp Destination for pointer to new directory's vnode. 773 @param cnp Name information for new directory. 774 @param vap Attributes for new directory. 775 @param ctx Context to authenticate for mkdir request. 776 @return 0 for success, else an error code. 777 */ 778#ifdef XNU_KERNEL_PRIVATE 779extern errno_t VNOP_MKDIR(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, vfs_context_t); 780#endif /* XNU_KERNEL_PRIVATE */ 781 782 783#ifdef KERNEL_PRIVATE 784struct vnop_compound_mkdir_args { 785 struct vnodeop_desc *a_desc; 786 vnode_t a_dvp; /* Directory in which to create */ 787 vnode_t *a_vpp; /* Destination for found or created vnode */ 788 struct componentname *a_cnp; /* Name of directory to create */ 789 struct vnode_attr *a_vap; /* Creation attributes */ 790 uint32_t a_flags; /* Control flags (unused) */ 791 vfs_context_t a_context; /* Authorization context */ 792#if 0 793 int (*a_mkdir_authorizer)(vnode_t dvp, struct componentname *cnp, struct vnode_attr *vap, vfs_context_t ctx, void *reserved); 794#endif /* 0 */ 795 void *a_reserved; /* Unused */ 796}; 797#endif /* KERNEL_PRIVATE */ 798 799#ifdef XNU_KERNEL_PRIVATE 800extern errno_t VNOP_COMPOUND_MKDIR(vnode_t, vnode_t *, struct nameidata *, struct vnode_attr *, vfs_context_t); 801#endif /* XNU_KERNEL_PRIVATE */ 802 803struct vnop_rmdir_args { 804 struct vnodeop_desc *a_desc; 805 vnode_t a_dvp; 806 vnode_t a_vp; 807 struct componentname *a_cnp; 808 vfs_context_t a_context; 809}; 810 811/*! 812 @function VNOP_RMDIR 813 @abstract Call down to a filesystem to delete a directory. 814 @param dvp Parent of directory to be removed. 815 @param vp Directory to remove. 816 @param cnp Name information for directory to be deleted. 817 @param ctx Context to authenticate for rmdir request. 818 @return 0 for success, else an error code. 819 */ 820#ifdef XNU_KERNEL_PRIVATE 821extern errno_t VNOP_RMDIR(vnode_t, vnode_t, struct componentname *, vfs_context_t); 822#endif /* XNU_KERNEL_PRIVATE */ 823 824#ifdef KERNEL_PRIVATE 825struct vnop_compound_rmdir_args { 826 struct vnodeop_desc *a_desc; 827 vnode_t a_dvp; /* Directory in which to look up and delete */ 828 vnode_t *a_vpp; /* Destination for found vnode */ 829 struct componentname *a_cnp; /* Name to delete */ 830 struct vnode_attr *a_vap; /* Location in which to store attributes if delete succeeds (can be NULL) */ 831 uint32_t a_flags; /* Control flags (currently unused) */ 832 vfs_context_t a_context; /* Context for authorization */ 833 int (*a_rmdir_authorizer)( /* Authorization callback */ 834 vnode_t dvp, /* As passed to VNOP */ 835 vnode_t vp, /* Directory to delete */ 836 struct componentname *cnp, /* As passed to VNOP */ 837 vfs_context_t ctx, /* As passed to VNOP */ 838 void *reserved); /* Always NULL */ 839 void *a_reserved; /* Unused */ 840}; 841#endif /* KERNEL_PRIVATE */ 842 843#ifdef XNU_KERNEL_PRIVATE 844extern errno_t VNOP_COMPOUND_RMDIR(vnode_t, vnode_t*, struct nameidata *, struct vnode_attr *vap, vfs_context_t); 845#endif /* XNU_KERNEL_PRIVATE */ 846 847 848struct vnop_symlink_args { 849 struct vnodeop_desc *a_desc; 850 vnode_t a_dvp; 851 vnode_t *a_vpp; 852 struct componentname *a_cnp; 853 struct vnode_attr *a_vap; 854 char *a_target; 855 vfs_context_t a_context; 856}; 857 858/*! 859 @function VNOP_SYMLINK 860 @abstract Call down to a filesystem to create a symbolic link. 861 @param If VNOP_SYMLINK() is successful, the new file should be returned with an iocount which will 862 be dropped by the caller. VFS does not ensure that the target path will have a length shorter 863 than the max symlink length for the filesystem. 864 @param dvp Parent directory for new symlink file. 865 @param vpp 866 @param cnp Name information for new symlink. 867 @param vap Attributes for symlink. 868 @param target Path for symlink to store; for "ln -s /var/vardir linktovardir", "target" would be "/var/vardir" 869 @param ctx Context to authenticate for symlink request. 870 @return 0 for success, else an error code. 871 */ 872#ifdef XNU_KERNEL_PRIVATE 873extern errno_t VNOP_SYMLINK(vnode_t, vnode_t *, struct componentname *, struct vnode_attr *, char *, vfs_context_t); 874#endif /* XNU_KERNEL_PRIVATE */ 875 876/* 877 * 878 * When VNOP_READDIR is called from the NFS Server, the nfs_data 879 * argument is non-NULL. 880 * 881 * The value of nfs_eofflag should be set to TRUE if the end of 882 * the directory was reached while reading. 883 * 884 * The directory seek offset (cookies) are returned to the NFS client and 885 * may be used later to restart a directory read part way through 886 * the directory. There is one cookie returned for each directory 887 * entry returned and its size is determince from nfs_sizeofcookie. 888 * The value of the cookie should be the logical offset within the 889 * directory where the on-disc version of the appropriate directory 890 * entry starts. Memory for the cookies is allocated from M_TEMP 891 * and it is freed by the caller of VNOP_READDIR. 892 * 893 */ 894 895struct vnop_readdir_args { 896 struct vnodeop_desc *a_desc; 897 vnode_t a_vp; 898 struct uio *a_uio; 899 int a_flags; 900 int *a_eofflag; 901 int *a_numdirent; 902 vfs_context_t a_context; 903}; 904 905/*! 906 @function VNOP_READDIR 907 @abstract Call down to a filesystem to enumerate directory entries. 908 @discussion VNOP_READDIR() packs a buffer with "struct dirent" directory entry representations as described 909 by the "getdirentries" manual page. 910 @param vp Directory to enumerate. 911 @param uio Destination information for resulting direntries. 912 @param flags VNODE_READDIR_EXTENDED, VNODE_READDIR_REQSEEKOFF, VNODE_READDIR_SEEKOFF32: Apple-internal flags. 913 @param eofflag Should be set to 1 if the end of the directory has been reached. 914 @param numdirent Should be set to number of entries written into buffer. 915 @param ctx Context to authenticate for readdir request. 916 @return 0 for success, else an error code. 917 */ 918#ifdef XNU_KERNEL_PRIVATE 919extern errno_t VNOP_READDIR(vnode_t, struct uio *, int, int *, int *, vfs_context_t); 920#endif /* XNU_KERNEL_PRIVATE */ 921 922struct vnop_readdirattr_args { 923 struct vnodeop_desc *a_desc; 924 vnode_t a_vp; 925 struct attrlist *a_alist; 926 struct uio *a_uio; 927 uint32_t a_maxcount; 928 uint32_t a_options; 929 uint32_t *a_newstate; 930 int *a_eofflag; 931 uint32_t *a_actualcount; 932 vfs_context_t a_context; 933}; 934 935/*! 936 @function VNOP_READDIRATTR 937 @abstract Call down to get file attributes for many files in a directory at once. 938 @discussion VNOP_READDIRATTR() packs a buffer with file attributes, as if the results of many "getattrlist" calls. 939 @param vp Directory in which to enumerate entries' attributes. 940 @param alist Which attributes are wanted for each directory entry. 941 @param uio Destination information for resulting attributes. 942 @param maxcount Maximum count of files to get attributes for. 943 @param options FSOPT_NOFOLLOW: do not follow symbolic links. FSOPT_NOINMEMUPDATE: do not use data which have been 944 updated since an inode was loaded into memory. 945 @param newstate The "newstate" should be set to a value which changes if the contents of a directory change 946 through an addition or deletion but stays the same otherwise. 947 @param eofflag Should be set to 1 if the end of the directory has been reached. 948 @param actualcount Should be set to number of files whose attributes were written into buffer. 949 @param ctx Context to authenticate for readdirattr request. 950 @return 0 for success, else an error code. 951 */ 952#ifdef XNU_KERNEL_PRIVATE 953extern errno_t VNOP_READDIRATTR(vnode_t, struct attrlist *, struct uio *, uint32_t, uint32_t, uint32_t *, int *, uint32_t *, vfs_context_t); 954#endif /* XNU_KERNEL_PRIVATE */ 955 956struct vnop_getattrlistbulk_args { 957 struct vnodeop_desc *a_desc; 958 vnode_t a_vp; 959 struct attrlist *a_alist; 960 struct vnode_attr *a_vap; 961 struct uio *a_uio; 962 void *a_private; 963 uint64_t a_options; 964 int32_t *a_eofflag; 965 int32_t *a_actualcount; 966 vfs_context_t a_context; 967}; 968 969/*! 970 @function VNOP_GETATTRLISTBULK 971 @abstract Call down to get file attributes for many files in a directory at once. 972 @discussion VNOP_GETATTRLISTBULK() packs a buffer with file attributes, as if the results of many "getattrlist" calls. 973 @param vp Directory in which to enumerate entries' attributes. 974 @param alist Which attributes are wanted for each directory entry. 975 @param uio Destination information for resulting attributes. 976 @param vap initialised vnode_attr structure pointer. This structure also has memory allocated (MAXPATHLEN bytes) and assigned to the va_name field for filesystems to use. 977 @param private reserved for future use. 978 @param options 979 @param eofflag Should be set to 1 if the end of the directory has been reached. 980 @param actualcount Should be set to number of files whose attributes were written into buffer. 981 @param ctx Context to authenticate for getattrlistbulk request. 982 @return 0 for success, else an error code. 983 */ 984#ifdef XNU_KERNEL_PRIVATE 985extern errno_t VNOP_GETATTRLISTBULK(vnode_t, struct attrlist *, struct vnode_attr *, uio_t, void *, uint64_t, int32_t *, int32_t *, vfs_context_t); 986#endif /* XNU_KERNEL_PRIVATE */ 987 988struct vnop_readlink_args { 989 struct vnodeop_desc *a_desc; 990 vnode_t a_vp; 991 struct uio *a_uio; 992 vfs_context_t a_context; 993}; 994 995/*! 996 @function VNOP_READLINK 997 @abstract Call down to a filesystem to get the pathname represented by a symbolic link. 998 @discussion VNOP_READLINK() gets the path stored in a symbolic link; it is called by namei() and the readlink() system call. 999 @param vp Symbolic link to read from. 1000 @param uio Destination information for link path. 1001 @param ctx Context to authenticate for readlink request. 1002 @return 0 for success, else an error code. 1003 */ 1004#ifdef XNU_KERNEL_PRIVATE 1005extern errno_t VNOP_READLINK(vnode_t, struct uio *, vfs_context_t); 1006#endif /* XNU_KERNEL_PRIVATE */ 1007 1008struct vnop_inactive_args { 1009 struct vnodeop_desc *a_desc; 1010 vnode_t a_vp; 1011 vfs_context_t a_context; 1012}; 1013 1014/*! 1015 @function VNOP_INACTIVE 1016 @abstract Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped. 1017 @discussion VNOP_INACTVE() gives a filesystem a chance to aggressively release resources assocated with a vnode, perhaps 1018 even to call vnode_recycle(), but no action is prescribed; it is acceptable for VNOP_INACTIVE to be a no-op and 1019 to defer all reclamation until VNOP_RECLAIM(). 1020 VNOP_INACTVE() will not be called on a vnode if no persistent reference is ever taken; an 1021 important example is a stat(), which takes an iocount, reads its data, and drops that iocount. 1022 @param vp The vnode which is now inactive. 1023 @param ctx Context to authenticate for inactive message. 1024 @return 0 for success, else an error code, but return value is currently ignored. 1025 */ 1026#ifdef XNU_KERNEL_PRIVATE 1027extern errno_t VNOP_INACTIVE(vnode_t, vfs_context_t); 1028#endif /* XNU_KERNEL_PRIVATE */ 1029 1030struct vnop_reclaim_args { 1031 struct vnodeop_desc *a_desc; 1032 vnode_t a_vp; 1033 vfs_context_t a_context; 1034}; 1035 1036/*! 1037 @function VNOP_RECLAIM 1038 @abstract Release filesystem-internal resources for a vnode. 1039 @discussion VNOP_RECLAIM() is called as part of the process of recycling a vnode. During 1040 a reclaim routine, a filesystem should remove a vnode from its hash and deallocate any resources 1041 allocated to that vnode. VFS guarantees that when VNOP_RECLAIM() is called, there are no more 1042 iocount references on a vnode (though there may still be usecount references--these are invalidated 1043 by the reclaim) and that no more will be granted. This means in practice that there will be no 1044 filesystem calls on the vnode being reclaimed until the reclaim has finished and the vnode has 1045 been reused. 1046 @param vp The vnode to reclaim. 1047 @param ctx Context to authenticate for reclaim. 1048 @return 0 for success, or an error code. A nonzero return value results in a panic. 1049 */ 1050#ifdef XNU_KERNEL_PRIVATE 1051extern errno_t VNOP_RECLAIM(vnode_t, vfs_context_t); 1052#endif /* XNU_KERNEL_PRIVATE */ 1053 1054struct vnop_pathconf_args { 1055 struct vnodeop_desc *a_desc; 1056 vnode_t a_vp; 1057 int a_name; 1058 int32_t *a_retval; 1059 vfs_context_t a_context; 1060}; 1061 1062/*! 1063 @function VNOP_PATHCONF 1064 @abstract Query a filesystem for path properties. 1065 @param vp The vnode whose filesystem to query. 1066 @param name Which property to request: see unistd.h. For example: _PC_CASE_SENSITIVE (is 1067 a filesystem case-sensitive?). Only one property can be requested at a time. 1068 @param retval Destination for value of property. 1069 @param ctx Context to authenticate for pathconf request. 1070 @return 0 for success, or an error code. 1071 */ 1072#ifdef XNU_KERNEL_PRIVATE 1073extern errno_t VNOP_PATHCONF(vnode_t, int, int32_t *, vfs_context_t); 1074#endif /* XNU_KERNEL_PRIVATE */ 1075 1076struct vnop_advlock_args { 1077 struct vnodeop_desc *a_desc; 1078 vnode_t a_vp; 1079 caddr_t a_id; 1080 int a_op; 1081 struct flock *a_fl; 1082 int a_flags; 1083 vfs_context_t a_context; 1084 struct timespec *a_timeout; 1085}; 1086 1087/*! 1088 @function VNOP_ADVLOCK 1089 @abstract Aquire or release and advisory lock on a vnode. 1090 @discussion Advisory locking is somewhat complicated. VNOP_ADVLOCK is overloaded for 1091 both flock() and POSIX advisory locking usage, though not all filesystems support both (or any). VFS 1092 provides an advisory locking mechanism for filesystems which can take advantage of it; vfs_setlocklocal() 1093 marks a filesystem as using VFS advisory locking support. 1094 @param vp The vnode to lock or unlock. 1095 @param id Identifier for lock holder: ignored by most filesystems. 1096 @param op Which locking operation: F_SETLK: set locking information about a region. 1097 F_GETLK: get locking information about the specified region. F_UNLCK: Unlock a region. 1098 @param fl Description of file region to lock. l_whence is as with "lseek." 1099 Includes a type: F_RDLCK (shared lock), F_UNLCK (unlock) , and F_WRLCK (exclusive lock). 1100 @param flags F_FLOCK: use flock() semantics. F_POSIX: use POSIX semantics. F_WAIT: sleep if necessary. 1101 F_PROV: Non-coelesced provisional lock (unused in xnu). 1102 @param ctx Context to authenticate for advisory locking request. 1103 @param timeout Timespec for timeout in case of F_SETLKWTIMEOUT. 1104 @return 0 for success, or an error code. 1105 */ 1106#ifdef XNU_KERNEL_PRIVATE 1107extern errno_t VNOP_ADVLOCK(vnode_t, caddr_t, int, struct flock *, int, vfs_context_t, struct timespec *); 1108#endif /* XNU_KERNEL_PRIVATE */ 1109 1110struct vnop_allocate_args { 1111 struct vnodeop_desc *a_desc; 1112 vnode_t a_vp; 1113 off_t a_length; 1114 u_int32_t a_flags; 1115 off_t *a_bytesallocated; 1116 off_t a_offset; 1117 vfs_context_t a_context; 1118}; 1119 1120/*! 1121 @function VNOP_ALLOCATE 1122 @abstract Pre-allocate space for a file. 1123 @discussion VNOP_ALLOCATE() changes the amount of backing store set aside to 1124 a file. It can be used to either shrink or grow a file. If the file shrinks, 1125 its ubc size will be modified accordingly, but if it grows, then the ubc size is unchanged; 1126 space is set aside without being actively used by the file. VNOP_ALLOCATE() is currently only 1127 called as part of the F_PREALLOCATE fcntl. 1128 @param vp The vnode for which to preallocate space. 1129 @param length Desired preallocated file length. 1130 @param flags 1131 PREALLOCATE: preallocate allocation blocks. 1132 ALLOCATECONTIG: allocate contigious space. 1133 ALLOCATEALL: allocate all requested space or no space at all. 1134 FREEREMAINDER: deallocate allocated but unfilled blocks. 1135 ALLOCATEFROMPEOF: allocate from the physical eof. 1136 ALLOCATEFROMVOL: allocate from the volume offset. 1137 @param bytesallocated Additional bytes set aside for file. Set to 0 if none are allocated 1138 OR if the file is contracted. 1139 @param offset Hint for where to find free blocks. 1140 @param ctx Context to authenticate for allocation request. 1141 @return 0 for success, or an error code. 1142 */ 1143#ifdef XNU_KERNEL_PRIVATE 1144extern errno_t VNOP_ALLOCATE(vnode_t, off_t, u_int32_t, off_t *, off_t, vfs_context_t); 1145#endif /* XNU_KERNEL_PRIVATE */ 1146 1147struct vnop_pagein_args { 1148 struct vnodeop_desc *a_desc; 1149 vnode_t a_vp; 1150 upl_t a_pl; 1151 upl_offset_t a_pl_offset; 1152 off_t a_f_offset; 1153 size_t a_size; 1154 int a_flags; 1155 vfs_context_t a_context; 1156}; 1157 1158/*! 1159 @function VNOP_PAGEIN 1160 @abstract Pull file data into memory. 1161 @discussion VNOP_PAGEIN() is called by when a process faults on data mapped from a file or 1162 when madvise() demands pre-fetching. It is conceptually somewhat similar to VNOP_READ(). Filesystems 1163 are typically expected to call cluster_pagein() to handle the labor of mapping and committing the UPL. 1164 @param vp The vnode for which to page in data. 1165 @param pl UPL describing pages needing to be paged in. 1166 @param pl_offset Offset in UPL at which to start placing data. 1167 @param f_offset Offset in file of data needing to be paged in. 1168 @param size Amount of data to page in (in bytes). 1169 @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. 1170 Filesystems should generally leave it to the cluster layer to handle these flags. See the 1171 memory_object_types.h header in the kernel framework if interested. 1172 @param ctx Context to authenticate for pagein request. 1173 @return 0 for success, or an error code. 1174 */ 1175#ifdef XNU_KERNEL_PRIVATE 1176extern errno_t VNOP_PAGEIN(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t); 1177#endif /* XNU_KERNEL_PRIVATE */ 1178 1179struct vnop_pageout_args { 1180 struct vnodeop_desc *a_desc; 1181 vnode_t a_vp; 1182 upl_t a_pl; 1183 upl_offset_t a_pl_offset; 1184 off_t a_f_offset; 1185 size_t a_size; 1186 int a_flags; 1187 vfs_context_t a_context; 1188}; 1189 1190/*! 1191 @function VNOP_PAGEOUT 1192 @abstract Write data from a mapped file back to disk. 1193 @discussion VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either 1194 because of an msync() call or due to memory pressure. Filesystems are for the most part expected to 1195 just call cluster_pageout(). However, if they opt into the VFC_VFSVNOP_PAGEOUTV2 flag, then 1196 they will be responsible for creating their own UPLs. 1197 @param vp The vnode for which to page out data. 1198 @param pl UPL describing pages needed to be paged out. If UPL is NULL, then it means the filesystem 1199 has opted into VFC_VFSVNOP_PAGEOUTV2 semantics, which means that it will create and operate on its own UPLs 1200 as opposed to relying on the one passed down into the filesystem. This means that the filesystem must be 1201 responsible for N cluster_pageout calls for N dirty ranges in the UPL. 1202 @param pl_offset Offset in UPL from which to start paging out data. Under the new VFC_VFSVNOP_PAGEOUTV2 1203 semantics, this is the offset in the range specified that must be paged out if the associated page is dirty. 1204 @param f_offset Offset in file of data needing to be paged out. Under the new VFC_VFSVNOP_PAGEOUTV2 1205 semantics, this represents the offset in the file where we should start looking for dirty pages. 1206 @param size Amount of data to page out (in bytes). Under VFC_VFSVNOP_PAGEOUTV2, this represents 1207 the size of the range to be considered. The fileystem is free to extend or shrink the specified range 1208 to better fit its blocking model as long as the page at 'pl_offset' is included. 1209 @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. 1210 Filesystems should generally leave it to the cluster layer to handle these flags. See the 1211 memory_object_types.h header in the kernel framework if interested. 1212 @param ctx Context to authenticate for pageout request. 1213 @return 0 for success, or an error code. 1214 */ 1215#ifdef XNU_KERNEL_PRIVATE 1216extern errno_t VNOP_PAGEOUT(vnode_t, upl_t, upl_offset_t, off_t, size_t, int, vfs_context_t); 1217#endif /* XNU_KERNEL_PRIVATE */ 1218 1219struct vnop_searchfs_args { 1220 struct vnodeop_desc *a_desc; 1221 vnode_t a_vp; 1222 void *a_searchparams1; 1223 void *a_searchparams2; 1224 struct attrlist *a_searchattrs; 1225 uint32_t a_maxmatches; 1226 struct timeval *a_timelimit; 1227 struct attrlist *a_returnattrs; 1228 uint32_t *a_nummatches; 1229 uint32_t a_scriptcode; 1230 uint32_t a_options; 1231 struct uio *a_uio; 1232 struct searchstate *a_searchstate; 1233 vfs_context_t a_context; 1234}; 1235 1236/* 1237 @function VNOP_SEARCHFS 1238 @abstract Search a filesystem quickly for files or directories that match the passed-in search criteria. 1239 @discussion VNOP_SEARCHFS is a getattrlist-based system call which is implemented almost entirely inside 1240 supported filesystems. Callers provide a set of criteria to match against, and the filesystem is responsible 1241 for finding all files or directories that match the criteria. Once these files or directories are found, 1242 the user-requested attributes of these files is provided as output. The set of searchable attributes is a 1243 subset of the getattrlist attributes. For example, ATTR_CMN_UUID is not a valid searchable attribute as of 1244 10.6. A common usage scenario could be to request all files whose mod dates is greater than time X, less than 1245 time Y, and provide the inode ID and filename of the matching objects as output. 1246 @param vp The vnode representing the mountpoint of the filesystem to be searched. 1247 @param a_searchparams1 If one-argument search criteria is requested, the search criteria would go here. However, 1248 some search criteria, like ATTR_CMN_MODTIME, can be bounded. The user could request files modified between time X 1249 and time Y. In this case, the lower bound goes in a_searchparams1. 1250 @param a_searchparams2 If two-argument search criteria is requested, the upper bound goes in here. 1251 @param a_searchattrs Contains the getattrlist-style attribute bits which are requested by the current search. 1252 @param a_maxmatches The maximum number of matches to return in a single system call. 1253 @param a_timelimit The suggested maximum amount of time we can spend in the kernel to service this system call. 1254 Filesystems should use this as a guide only, and set their own internal maximum time to avoid denial of service. 1255 @param a_returnattrs The getattrlist-style attributes to return for items in the filesystem that match the search 1256 criteria above. 1257 @param a_scriptcode Currently ignored. 1258 @param a_uio The uio in which to write out the search matches. 1259 @param a_searchstate Sometimes searches cannot be completed in a single system call. In this case, we provide 1260 an identifier back to the user which indicates where to resume a previously-started search. This is an opaque structure 1261 used by the filesystem to identify where to resume said search. 1262 @param a_context The context in which to perform the filesystem search. 1263 @return 0 on success, EAGAIN for searches which could not be completed in 1 call, and other ERRNOS as needed. 1264 */ 1265 1266#ifdef XNU_KERNEL_PRIVATE 1267extern errno_t VNOP_SEARCHFS(vnode_t, void *, void *, struct attrlist *, uint32_t, struct timeval *, struct attrlist *, uint32_t *, uint32_t, uint32_t, struct uio *, struct searchstate *, vfs_context_t); 1268#endif /* XNU_KERNEL_PRIVATE */ 1269 1270struct vnop_copyfile_args { 1271 struct vnodeop_desc *a_desc; 1272 vnode_t a_fvp; 1273 vnode_t a_tdvp; 1274 vnode_t a_tvp; 1275 struct componentname *a_tcnp; 1276 int a_mode; 1277 int a_flags; 1278 vfs_context_t a_context; 1279}; 1280 1281#ifdef XNU_KERNEL_PRIVATE 1282extern errno_t VNOP_COPYFILE(vnode_t, vnode_t, vnode_t, struct componentname *, int, int, vfs_context_t); 1283#endif /* XNU_KERNEL_PRIVATE */ 1284 1285struct vnop_getxattr_args { 1286 struct vnodeop_desc *a_desc; 1287 vnode_t a_vp; 1288 const char * a_name; 1289 uio_t a_uio; 1290 size_t *a_size; 1291 int a_options; 1292 vfs_context_t a_context; 1293}; 1294extern struct vnodeop_desc vnop_getxattr_desc; 1295 1296/*! 1297 @function VNOP_GETXATTR 1298 @abstract Get extended file attributes. 1299 @param vp The vnode to get extended attributes for. 1300 @param name Which property to extract. 1301 @param uio Destination information for attribute value. 1302 @param size Should be set to the amount of data written. 1303 @param options XATTR_NOSECURITY: bypass security-checking. 1304 @param ctx Context to authenticate for getxattr request. 1305 @return 0 for success, or an error code. 1306 */ 1307extern errno_t VNOP_GETXATTR(vnode_t, const char *, uio_t, size_t *, int, vfs_context_t); 1308 1309struct vnop_setxattr_args { 1310 struct vnodeop_desc *a_desc; 1311 vnode_t a_vp; 1312 const char * a_name; 1313 uio_t a_uio; 1314 int a_options; 1315 vfs_context_t a_context; 1316}; 1317extern struct vnodeop_desc vnop_setxattr_desc; 1318 1319/*! 1320 @function VNOP_SETXATTR 1321 @abstract Set extended file attributes. 1322 @param vp The vnode to set extended attributes for. 1323 @param name Which property to extract. 1324 @param uio Source information for attribute value. 1325 @param options XATTR_NOSECURITY: bypass security-checking. XATTR_CREATE: set value, fail if exists. 1326 XATTR_REPLACE: set value, fail if does not exist. 1327 @param ctx Context to authenticate for setxattr request. 1328 @return 0 for success, or an error code. 1329 */ 1330extern errno_t VNOP_SETXATTR(vnode_t, const char *, uio_t, int, vfs_context_t); 1331 1332struct vnop_removexattr_args { 1333 struct vnodeop_desc *a_desc; 1334 vnode_t a_vp; 1335 const char * a_name; 1336 int a_options; 1337 vfs_context_t a_context; 1338}; 1339extern struct vnodeop_desc vnop_removexattr_desc; 1340 1341/*! 1342 @function VNOP_REMOVEXATTR 1343 @abstract Remove extended file attributes. 1344 @param vp The vnode from which to remove extended attributes. 1345 @param name Which attribute to delete. 1346 @param options XATTR_NOSECURITY: bypass security-checking. 1347 @param ctx Context to authenticate for attribute delete request. 1348 @return 0 for success, or an error code. 1349 */ 1350#ifdef XNU_KERNEL_PRIVATE 1351extern errno_t VNOP_REMOVEXATTR(vnode_t, const char *, int, vfs_context_t); 1352#endif /* XNU_KERNEL_PRIVATE */ 1353 1354struct vnop_listxattr_args { 1355 struct vnodeop_desc *a_desc; 1356 vnode_t a_vp; 1357 uio_t a_uio; 1358 size_t *a_size; 1359 int a_options; 1360 vfs_context_t a_context; 1361}; 1362extern struct vnodeop_desc vnop_listxattr_desc; 1363 1364/*! 1365 @function VNOP_LISTXATTR 1366 @abstract List extended attribute keys. 1367 @discussion Should write a sequence of unseparated, null-terminated extended-attribute 1368 names into the space described by the provided uio. These keys can then be passed to 1369 getxattr() (and VNOP_GETXATTR()). 1370 @param vp The vnode for which to get extended attribute keys. 1371 @param uio Description of target memory for attribute keys. 1372 @param size Should be set to amount of data written to buffer. 1373 @param options XATTR_NOSECURITY: bypass security checking. 1374 @param ctx Context to authenticate for attribute name request. 1375 */ 1376#ifdef XNU_KERNEL_PRIVATE 1377extern errno_t VNOP_LISTXATTR(vnode_t, uio_t, size_t *, int, vfs_context_t); 1378#endif /* XNU_KERNEL_PRIVATE */ 1379 1380struct vnop_blktooff_args { 1381 struct vnodeop_desc *a_desc; 1382 vnode_t a_vp; 1383 daddr64_t a_lblkno; 1384 off_t *a_offset; 1385}; 1386 1387/*! 1388 @function VNOP_BLKTOOFF 1389 @abstract Call down to a filesystem to convert a logical block number to a file offset. 1390 @discussion VNOP_BLKTOOFF() converts a logical block to a file offset in bytes. That offset 1391 can be passed to VNOP_BLOCKMAP(), then, to get a physical block number--buf_strategy() does this. 1392 @param vp The vnode for which to convert a logical block to an offset. 1393 @param lblkno Logical block number to turn into offset. 1394 @param offset Destination for file offset. 1395 @return 0 for success, else an error code. 1396 */ 1397#ifdef XNU_KERNEL_PRIVATE 1398extern errno_t VNOP_BLKTOOFF(vnode_t, daddr64_t, off_t *); 1399#endif /* XNU_KERNEL_PRIVATE */ 1400 1401struct vnop_offtoblk_args { 1402 struct vnodeop_desc *a_desc; 1403 vnode_t a_vp; 1404 off_t a_offset; 1405 daddr64_t *a_lblkno; 1406}; 1407 1408/*! 1409 @function VNOP_OFFTOBLK 1410 @abstract Call down to a filesystem to convert a file offset to a logical block number. 1411 @param vp The vnode for which to convert an offset to a logical block number. 1412 @param offset File offset to convert. 1413 @param lblkno Destination for corresponding logical block number. 1414 @return 0 for success, else an error code. 1415 */ 1416#ifdef XNU_KERNEL_PRIVATE 1417extern errno_t VNOP_OFFTOBLK(vnode_t, off_t, daddr64_t *); 1418#endif /* XNU_KERNEL_PRIVATE */ 1419 1420struct vnop_blockmap_args { 1421 struct vnodeop_desc *a_desc; 1422 vnode_t a_vp; 1423 off_t a_foffset; 1424 size_t a_size; 1425 daddr64_t *a_bpn; 1426 size_t *a_run; 1427 void *a_poff; 1428 int a_flags; 1429 vfs_context_t a_context; 1430}; 1431 1432/*! 1433 @function VNOP_BLOCKMAP 1434 @abstract Call down to a filesystem to get information about the on-disk layout of a file region. 1435 @discussion VNOP_BLOCKMAP() returns the information required to pass a request for a contiguous region 1436 down to a device's strategy routine. 1437 @param vp The vnode for which to get on-disk information. 1438 @param foffset Offset (in bytes) at which region starts. 1439 @param size Size of region. 1440 @param bpn Destination for physical block number at which region begins on disk. 1441 @param run Destination for number of bytes which can be found contiguously on-disk before 1442 first discontinuity. 1443 @param poff Currently unused. 1444 @param flags VNODE_READ: request is for a read. VNODE_WRITE: request is for a write. 1445 @param ctx Context to authenticate for blockmap request; currently often set to NULL. 1446 @return 0 for success, else an error code. 1447 */ 1448#ifdef XNU_KERNEL_PRIVATE 1449extern errno_t VNOP_BLOCKMAP(vnode_t, off_t, size_t, daddr64_t *, size_t *, void *, 1450 int, vfs_context_t); 1451#endif /* XNU_KERNEL_PRIVATE */ 1452 1453struct vnop_strategy_args { 1454 struct vnodeop_desc *a_desc; 1455 struct buf *a_bp; 1456}; 1457 1458/*! 1459 @function VNOP_STRATEGY 1460 @abstract Initiate I/O on a file (both read and write). 1461 @discussion A filesystem strategy routine takes a buffer, performs whatever manipulations are necessary for passing 1462 the I/O request down to the device layer, and calls the appropriate device's strategy routine. Most filesystems should 1463 just call buf_strategy() with "bp" as the argument. 1464 @param bp Complete specificiation of requested I/O: region of data involved, whether request is for read or write, and so on. 1465 @return 0 for success, else an error code. 1466 */ 1467extern errno_t VNOP_STRATEGY(struct buf *bp); 1468 1469struct vnop_bwrite_args { 1470 struct vnodeop_desc *a_desc; 1471 buf_t a_bp; 1472}; 1473 1474/*! 1475 @function VNOP_BWRITE 1476 @abstract Write a buffer to backing store. 1477 @discussion VNOP_BWRITE() is called by buf_bawrite() (asynchronous write) and potentially by buf_bdwrite() (delayed write) 1478 but not by buf_bwrite(). A filesystem may choose to perform some kind of manipulation of the buffer in this routine; it 1479 generally will end up calling VFS's default implementation, vn_bwrite() (which calls buf_bwrite() without further ado). 1480 @param bp The buffer to write. 1481 @return 0 for success, else an error code. 1482 */ 1483extern errno_t VNOP_BWRITE(buf_t); 1484 1485struct vnop_kqfilt_add_args { 1486 struct vnodeop_desc *a_desc; 1487 struct vnode *a_vp; 1488 struct knote *a_kn; 1489 vfs_context_t a_context; 1490}; 1491extern struct vnodeop_desc vnop_kqfilt_add_desc; 1492 1493#ifdef XNU_KERNEL_PRIVATE 1494extern errno_t VNOP_KQFILT_ADD(vnode_t , struct knote *, vfs_context_t); 1495#endif /* XNU_KERNEL_PRIVATE */ 1496 1497struct vnop_kqfilt_remove_args { 1498 struct vnodeop_desc *a_desc; 1499 struct vnode *a_vp; 1500 uintptr_t a_ident; 1501 vfs_context_t a_context; 1502}; 1503extern struct vnodeop_desc vnop_kqfilt_remove_desc; 1504 1505#ifdef XNU_KERNEL_PRIVATE 1506errno_t VNOP_KQFILT_REMOVE(vnode_t , uintptr_t , vfs_context_t); 1507#endif /* XNU_KERNEL_PRIVATE */ 1508 1509 1510#ifdef KERNEL_PRIVATE 1511#define VNODE_MONITOR_BEGIN 0x01 1512#define VNODE_MONITOR_END 0x02 1513#define VNODE_MONITOR_UPDATE 0x04 1514struct vnop_monitor_args { 1515 struct vnodeop_desc *a_desc; 1516 vnode_t a_vp; 1517 uint32_t a_events; 1518 uint32_t a_flags; 1519 void *a_handle; 1520 vfs_context_t a_context; 1521}; 1522extern struct vnodeop_desc vnop_monitor_desc; 1523#endif /* KERNEL_PRIVATE */ 1524 1525#ifdef XNU_KERNEL_PRIVATE 1526/*! 1527 @function VNOP_MONITOR 1528 @abstract Indicate to a filesystem that the number of watchers of a file has changed. 1529 @param vp The vnode whose watch state has changed. 1530 @param events Unused. Filesystems can ignore this parameter. 1531 @param flags Type of change to the watch state. VNODE_MONITOR_BEGIN is passed when the kernel 1532 begins tracking a new watcher of a file. VNODE_MONITOR_END is passed when a watcher stops watching a file. 1533 VNODE_MONITOR_UPDATE is currently unused. A filesystem is guaranteed that each VNODE_MONITOR_BEGIN 1534 will be matched by a VNODE_MONITOR_END with the same "handle" argument. 1535 @param handle Unique identifier for a given watcher. A VNODE_MONITOR_BEGIN for a given handle will be matched with a 1536 VNODE_MONITOR_END for the same handle; a filesystem need not consider this parameter unless 1537 it for some reason wants be able to match specific VNOP_MONITOR calls rather than just keeping 1538 a count. 1539 @param ctx The context which is starting to monitor a file or ending a watch on a file. A matching 1540 pair of VNODE_MONITOR_BEGIN and VNODE_MONITOR_END need not have the same context. 1541 @discussion VNOP_MONITOR() is intended to let networked filesystems know when they should bother 1542 listening for changes to files which occur remotely, so that they can post notifications using 1543 vnode_notify(). Local filesystems should not implement a monitor vnop. 1544 It is called when there is a new watcher for a file or when a watcher for a file goes away. 1545 Each BEGIN will be matched with an END with the same handle. Note that vnode_ismonitored() can 1546 be used to see if there are currently watchers for a file. 1547 */ 1548errno_t VNOP_MONITOR(vnode_t , uint32_t, uint32_t, void*, vfs_context_t); 1549#endif /* XNU_KERNEL_PRIVATE */ 1550 1551struct label; 1552struct vnop_setlabel_args { 1553 struct vnodeop_desc *a_desc; 1554 struct vnode *a_vp; 1555 struct label *a_vl; 1556 vfs_context_t a_context; 1557}; 1558extern struct vnodeop_desc vnop_setlabel_desc; 1559 1560/*! 1561 @function VNOP_SETLABEL 1562 @abstract Associate a MACF label with a file. 1563 @param vp The vnode to label. 1564 @param label The desired label. 1565 @param ctx Context to authenticate for label change. 1566 @return 0 for success, else an error code. 1567 */ 1568#ifdef XNU_KERNEL_PRIVATE 1569errno_t VNOP_SETLABEL(vnode_t, struct label *, vfs_context_t); 1570#endif /* XNU_KERNEL_PRIVATE */ 1571 1572#ifdef __APPLE_API_UNSTABLE 1573 1574#if NAMEDSTREAMS 1575 1576enum nsoperation { NS_OPEN, NS_CREATE, NS_DELETE }; 1577 1578struct vnop_getnamedstream_args { 1579 struct vnodeop_desc *a_desc; 1580 vnode_t a_vp; 1581 vnode_t *a_svpp; 1582 const char *a_name; 1583 enum nsoperation a_operation; 1584 int a_flags; 1585 vfs_context_t a_context; 1586}; 1587 1588/*! 1589 @function VNOP_GETNAMEDSTREAM 1590 @abstract Get a named stream associated with a file. 1591 @discussion If this call sucecss, svpp should be returned with an iocount which the caller 1592 will drop. VFS provides a facility for simulating named streams when interacting with filesystems 1593 which do not support them. 1594 @param vp The vnode for which to get a named stream. 1595 @param svpp Destination for pointer to named stream's vnode. 1596 @param name The name of the named stream, e.g. "com.apple.ResourceFork". 1597 @param operation Operation to perform. In HFS and AFP, this parameter is only considered as follows: 1598 if the resource fork has not been opened and the operation is not NS_OPEN, fail with ENOATTR. Currently 1599 only passed as NS_OPEN by VFS. 1600 @param flags Currently unused. 1601 @param ctx Context to authenticate for getting named stream. 1602 @return 0 for success, else an error code. 1603 */ 1604#ifdef XNU_KERNEL_PRIVATE 1605extern errno_t VNOP_GETNAMEDSTREAM(vnode_t, vnode_t *, const char *, enum nsoperation, int flags, vfs_context_t); 1606#endif /* XNU_KERNEL_PRIVATE */ 1607 1608struct vnop_makenamedstream_args { 1609 struct vnodeop_desc *a_desc; 1610 vnode_t *a_svpp; 1611 vnode_t a_vp; 1612 const char *a_name; 1613 int a_flags; 1614 vfs_context_t a_context; 1615}; 1616 1617/*! 1618 @function VNOP_MAKENAMEDSTREAM 1619 @abstract Create a named stream associated with a file. 1620 @discussion If this call succeeds, svpp should be returned with an iocount which the caller will drop. 1621 VFS provides a facility for simulating named streams when interacting with filesystems 1622 which do not support them. 1623 @param vp The vnode for which to get a named stream. 1624 @param svpp Destination for pointer to named stream's vnode. 1625 @param name The name of the named stream, e.g. "com.apple.ResourceFork". 1626 @param flags Currently unused. 1627 @param ctx Context to authenticate creating named stream. 1628 @return 0 for success, else an error code. 1629 */ 1630#ifdef XNU_KERNEL_PRIVATE 1631extern errno_t VNOP_MAKENAMEDSTREAM(vnode_t, vnode_t *, const char *, int flags, vfs_context_t); 1632#endif /* XNU_KERNEL_PRIVATE */ 1633 1634struct vnop_removenamedstream_args { 1635 struct vnodeop_desc *a_desc; 1636 vnode_t a_vp; 1637 vnode_t a_svp; 1638 const char *a_name; 1639 int a_flags; 1640 vfs_context_t a_context; 1641}; 1642 1643/*! 1644 @function VNOP_REMOVENAMEDSTREAM 1645 @abstract Delete a named stream associated with a file. 1646 @discussion VFS provides a facility for simulating named streams when interacting with filesystems 1647 which do not support them. 1648 @param vp The vnode to which the named stream belongs. 1649 @param svp The named stream's vnode. 1650 @param name The name of the named stream, e.g. "com.apple.ResourceFork". 1651 @param flags Currently unused. 1652 @param ctx Context to authenticate deleting named stream. 1653 @return 0 for success, else an error code. 1654 */ 1655#ifdef XNU_KERNEL_PRIVATE 1656extern errno_t VNOP_REMOVENAMEDSTREAM(vnode_t, vnode_t, const char *, int flags, vfs_context_t); 1657#endif /* XNU_KERNEL_PRIVATE */ 1658#endif 1659 1660#endif 1661 1662__END_DECLS 1663 1664#endif /* KERNEL */ 1665 1666#endif /* !_SYS_VNODE_IF_H_ */ 1667