3 * Copyright (c) 2000-2002 Apple Computer, Inc. All rights reserved.
5 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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.
27 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
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.
34 * Redistribution and use in source and binary forms, with or without
35 * modification, are permitted provided that the following conditions
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.
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
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,
70 * Warning: This file is generated automatically.
71 * (Modifications made here may easily be lost!)
73 * Created by the script:
74 * @(#)vnode_if.sh 8.7 (Berkeley) 5/11/95
78 #ifndef _SYS_VNODE_IF_H_
79 #define _SYS_VNODE_IF_H_
81 #include <sys/appleapiopts.h>
82 #include <sys/cdefs.h>
83 #include <sys/kernel_types.h>
85 #ifdef BSD_KERNEL_PRIVATE
88 #include <mach/memory_object_types.h>
93 extern struct vnodeop_desc vnop_default_desc
;
94 extern struct vnodeop_desc vnop_lookup_desc
;
95 extern struct vnodeop_desc vnop_create_desc
;
96 extern struct vnodeop_desc vnop_whiteout_desc
;
97 extern struct vnodeop_desc vnop_mknod_desc
;
98 extern struct vnodeop_desc vnop_open_desc
;
99 extern struct vnodeop_desc vnop_close_desc
;
100 extern struct vnodeop_desc vnop_access_desc
;
101 extern struct vnodeop_desc vnop_getattr_desc
;
102 extern struct vnodeop_desc vnop_setattr_desc
;
103 extern struct vnodeop_desc vnop_read_desc
;
104 extern struct vnodeop_desc vnop_write_desc
;
105 extern struct vnodeop_desc vnop_ioctl_desc
;
106 extern struct vnodeop_desc vnop_select_desc
;
107 extern struct vnodeop_desc vnop_exchange_desc
;
108 extern struct vnodeop_desc vnop_revoke_desc
;
109 extern struct vnodeop_desc vnop_mmap_desc
;
110 extern struct vnodeop_desc vnop_mnomap_desc
;
111 extern struct vnodeop_desc vnop_fsync_desc
;
112 extern struct vnodeop_desc vnop_remove_desc
;
113 extern struct vnodeop_desc vnop_link_desc
;
114 extern struct vnodeop_desc vnop_rename_desc
;
115 extern struct vnodeop_desc vnop_mkdir_desc
;
116 extern struct vnodeop_desc vnop_rmdir_desc
;
117 extern struct vnodeop_desc vnop_symlink_desc
;
118 extern struct vnodeop_desc vnop_readdir_desc
;
119 extern struct vnodeop_desc vnop_readdirattr_desc
;
120 extern struct vnodeop_desc vnop_readlink_desc
;
121 extern struct vnodeop_desc vnop_inactive_desc
;
122 extern struct vnodeop_desc vnop_reclaim_desc
;
123 extern struct vnodeop_desc vnop_print_desc
;
124 extern struct vnodeop_desc vnop_pathconf_desc
;
125 extern struct vnodeop_desc vnop_advlock_desc
;
126 extern struct vnodeop_desc vnop_truncate_desc
;
127 extern struct vnodeop_desc vnop_allocate_desc
;
128 extern struct vnodeop_desc vnop_pagein_desc
;
129 extern struct vnodeop_desc vnop_pageout_desc
;
130 extern struct vnodeop_desc vnop_searchfs_desc
;
131 extern struct vnodeop_desc vnop_copyfile_desc
;
132 extern struct vnodeop_desc vnop_blktooff_desc
;
133 extern struct vnodeop_desc vnop_offtoblk_desc
;
134 extern struct vnodeop_desc vnop_blockmap_desc
;
135 extern struct vnodeop_desc vnop_strategy_desc
;
136 extern struct vnodeop_desc vnop_bwrite_desc
;
138 #ifdef __APPLE_API_UNSTABLE
141 extern struct vnodeop_desc vnop_getnamedstream_desc
;
142 extern struct vnodeop_desc vnop_makenamedstream_desc
;
143 extern struct vnodeop_desc vnop_removenamedstream_desc
;
150 struct vnop_lookup_args
{
151 struct vnodeop_desc
*a_desc
;
154 struct componentname
*a_cnp
;
155 vfs_context_t a_context
;
159 @function VNOP_LOOKUP
160 @abstract Call down to a filesystem to look for a directory entry by name.
161 @discussion VNOP_LOOKUP is the key pathway through which VFS asks a filesystem to find a file. The vnode
162 should be returned with an iocount to be dropped by the caller. A VNOP_LOOKUP() calldown can come without
163 a preceding VNOP_OPEN().
164 @param dvp Directory in which to look up file.
165 @param vpp Destination for found vnode.
166 @param cnp Structure describing filename to find, reason for lookup, and various other data.
167 @param ctx Context against which to authenticate lookup request.
168 @return 0 for success or a filesystem-specific error.
170 #ifdef XNU_KERNEL_PRIVATE
171 extern errno_t
VNOP_LOOKUP(vnode_t
, vnode_t
*, struct componentname
*, vfs_context_t
);
172 #endif /* XNU_KERNEL_PRIVATE */
174 struct vnop_create_args
{
175 struct vnodeop_desc
*a_desc
;
178 struct componentname
*a_cnp
;
179 struct vnode_attr
*a_vap
;
180 vfs_context_t a_context
;
184 @function VNOP_CREATE
185 @abstract Call down to a filesystem to create a regular file (VREG).
186 @discussion If file creation succeeds, "vpp" should be returned with an iocount to be dropped by the caller.
187 A VNOP_CREATE() calldown can come without a preceding VNOP_OPEN().
188 @param dvp Directory in which to create file.
189 @param vpp Destination for vnode for newly created file.
190 @param cnp Description of filename to create.
191 @param vap File creation properties, as seen in vnode_getattr(). Manipulated with VATTR_ISACTIVE, VATTR_RETURN,
192 VATTR_SET_SUPPORTED, and so forth.
193 @param ctx Context against which to authenticate file creation.
194 @return 0 for success or a filesystem-specific error.
196 #ifdef XNU_KERNEL_PRIVATE
197 extern errno_t
VNOP_CREATE(vnode_t
, vnode_t
*, struct componentname
*, struct vnode_attr
*, vfs_context_t
);
198 #endif /* XNU_KERNEL_PRIVATE */
200 struct vnop_whiteout_args
{
201 struct vnodeop_desc
*a_desc
;
203 struct componentname
*a_cnp
;
205 vfs_context_t a_context
;
209 @function VNOP_WHITEOUT
210 @abstract Call down to a filesystem to create a whiteout.
211 @discussion Whiteouts are used to support the union filesystem, whereby one filesystem is mounted "transparently"
212 on top of another. A whiteout in the upper layer of a union mount is a "deletion" of a file in the lower layer;
213 lookups will catch the whiteout and fail, setting ISWHITEOUT in the componentname structure, even if an underlying
214 file of the same name exists. The whiteout vnop is used for creation, deletion, and checking whether a directory
215 supports whiteouts (see flags).
216 also support the LOOKUP flag, which is used to test whether a directory supports whiteouts.
217 @param dvp Directory in which to create.
218 @param cnp Name information for whiteout.
219 @param flags CREATE: create a whiteout. LOOKUP: check whether a directory supports whiteouts, DELETE: remove a whiteout.
220 @param ctx Context against which to authenticate whiteout creation.
221 @return 0 for success or a filesystem-specific error. Returning 0 for LOOKUP indicates that a directory does support whiteouts.
223 #ifdef XNU_KERNEL_PRIVATE
224 extern errno_t
VNOP_WHITEOUT(vnode_t
, struct componentname
*, int, vfs_context_t
);
225 #endif /* XNU_KERNEL_PRIVATE */
227 struct vnop_mknod_args
{
228 struct vnodeop_desc
*a_desc
;
231 struct componentname
*a_cnp
;
232 struct vnode_attr
*a_vap
;
233 vfs_context_t a_context
;
238 @abstract Call down to a filesystem to create a special file.
239 @discussion The mknod vnop is used to create character and block device files, named pipe (FIFO) files, and named sockets.
240 The newly created file should be returned with an iocount which will be dropped by the caller. A VNOP_MKNOD() call
241 can come down without a preceding VNOP_OPEN().
242 @param dvp Directory in which to create the special file.
243 @param vpp Destination for newly created vnode.
244 @param cnp Name information for new file.
245 @param vap Attributes for new file, including type.
246 @param ctx Context against which to authenticate node creation.
247 @return 0 for success or a filesystem-specific error.
249 #ifdef XNU_KERNEL_PRIVATE
250 extern errno_t
VNOP_MKNOD(vnode_t
, vnode_t
*, struct componentname
*, struct vnode_attr
*, vfs_context_t
);
251 #endif /* XNU_KERNEL_PRIVATE */
253 struct vnop_open_args
{
254 struct vnodeop_desc
*a_desc
;
257 vfs_context_t a_context
;
262 @abstract Call down to a filesystem to open a file.
263 @discussion The open vnop gives a filesystem a chance to initialize a file for
264 operations like reading, writing, and ioctls. VFS promises to send down exactly one VNOP_CLOSE()
265 for each VNOP_OPEN().
266 @param vp File to open.
267 @param mode FREAD and/or FWRITE.
268 @param ctx Context against which to authenticate open.
269 @return 0 for success or a filesystem-specific error.
271 #ifdef XNU_KERNEL_PRIVATE
272 extern errno_t
VNOP_OPEN(vnode_t
, int, vfs_context_t
);
273 #endif /* XNU_KERNEL_PRIVATE */
275 struct vnop_close_args
{
276 struct vnodeop_desc
*a_desc
;
279 vfs_context_t a_context
;
284 @abstract Call down to a filesystem to close a file.
285 @discussion The close vnop gives a filesystem a chance to release state set up
286 by a VNOP_OPEN(). VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN().
287 @param vp File to close.
288 @param fflag FREAD and/or FWRITE; in the case of a file opened with open(2), fflag corresponds
289 to how the file was opened.
290 @param ctx Context against which to authenticate close.
291 @return 0 for success or a filesystem-specific error.
293 #ifdef XNU_KERNEL_PRIVATE
294 extern errno_t
VNOP_CLOSE(vnode_t
, int, vfs_context_t
);
295 #endif /* XNU_KERNEL_PRIVATE */
297 struct vnop_access_args
{
298 struct vnodeop_desc
*a_desc
;
301 vfs_context_t a_context
;
305 @function VNOP_ACCESS
306 @abstract Call down to a filesystem to see if a kauth-style operation is permitted.
307 @discussion VNOP_ACCESS is currently only called on filesystems which mark themselves
308 as doing their authentication remotely (vfs_setauthopaque(), vfs_authopaque()). A VNOP_ACCESS()
309 calldown may come without any preceding VNOP_OPEN().
310 @param vp File to authorize action for.
311 @param action kauth-style action to be checked for permissions, e.g. KAUTH_VNODE_DELETE.
312 @param ctx Context against which to authenticate action.
313 @return 0 for success or a filesystem-specific error.
315 #ifdef XNU_KERNEL_PRIVATE
316 extern errno_t
VNOP_ACCESS(vnode_t
, int, vfs_context_t
);
317 #endif /* XNU_KERNEL_PRIVATE */
319 struct vnop_getattr_args
{
320 struct vnodeop_desc
*a_desc
;
322 struct vnode_attr
*a_vap
;
323 vfs_context_t a_context
;
327 @function VNOP_GETATTR
328 @abstract Call down to a filesystem to get vnode attributes.
329 @discussion Supported attributes ("Yes, I am returning this information") are set with VATTR_SET_SUPPORTED.
330 Which attributes have been requested is checked with VATTR_IS_ACTIVE. Attributes
331 are returned with VATTR_RETURN. It is through VNOP_GETATTR that routines like stat() get their information.
332 A VNOP_GETATTR() calldown may come without any preceding VNOP_OPEN().
333 @param vp The vnode whose attributes to get.
334 @param vap Container for which attributes are requested, which attributes are supported by the filesystem, and attribute values.
335 @param ctx Context against which to authenticate request for attributes.
336 @return 0 for success or a filesystem-specific error. VNOP_GETATTR() can return success even if not
337 all requested attributes were returned; returning an error-value should indicate that something went wrong, rather than that
338 some attribute is not supported.
340 #ifdef XNU_KERNEL_PRIVATE
341 extern errno_t
VNOP_GETATTR(vnode_t
, struct vnode_attr
*, vfs_context_t
);
342 #endif /* XNU_KERNEL_PRIVATE */
344 struct vnop_setattr_args
{
345 struct vnodeop_desc
*a_desc
;
347 struct vnode_attr
*a_vap
;
348 vfs_context_t a_context
;
352 @function VNOP_SETATTR
353 @abstract Call down to a filesystem to set vnode attributes.
354 @discussion Supported attributes ("Yes, I am setting this attribute.") are set with VATTR_SET_SUPPORTED.
355 Requested attributes are checked with VATTR_IS_ACTIVE. Attribute values are accessed directly through
356 structure fields. VNOP_SETATTR() is the core of the KPI function vnode_setattr(), which is used by chmod(),
357 chown(), truncate(), and many others. A VNOP_SETATTR() call may come without any preceding VNOP_OPEN().
358 @param vp The vnode whose attributes to set.
359 @param vap Container for which attributes are to be set and their desired values, as well as for the filesystem to
360 return information about which attributes were successfully set.
361 @param ctx Context against which to authenticate request for attribute change.
362 @return 0 for success or a filesystem-specific error. VNOP_SETATTR() can return success even if not
363 all requested attributes were set; returning an error-value should indicate that something went wrong, rather than that
364 some attribute is not supported.
366 #ifdef XNU_KERNEL_PRIVATE
367 extern errno_t
VNOP_SETATTR(vnode_t
, struct vnode_attr
*, vfs_context_t
);
368 #endif /* XNU_KERNEL_PRIVATE */
370 struct vnop_read_args
{
371 struct vnodeop_desc
*a_desc
;
375 vfs_context_t a_context
;
380 @abstract Call down to a filesystem to read file data.
381 @discussion VNOP_READ() is where the hard work of of the read() system call happens. The filesystem may use
382 the buffer cache, the cluster layer, or an alternative method to get its data; uio routines will be used to see that data
383 is copied to the correct virtual address in the correct address space and will update its uio argument
384 to indicate how much data has been moved. Filesystems will not receive a read request on a file without having
385 first received a VNOP_OPEN().
386 @param vp The vnode to read from.
387 @param uio Description of request, including file offset, amount of data requested, destination address for data,
388 and whether that destination is in kernel or user space.
389 @param ctx Context against which to authenticate read request.
390 @return 0 for success or a filesystem-specific error. VNOP_READ() can return success even if less data was
391 read than originally requested; returning an error value should indicate that something actually went wrong.
393 extern errno_t
VNOP_READ(vnode_t
, struct uio
*, int, vfs_context_t
);
395 struct vnop_write_args
{
396 struct vnodeop_desc
*a_desc
;
400 vfs_context_t a_context
;
405 @abstract Call down to the filesystem to write file data.
406 @discussion VNOP_WRITE() is to write() as VNOP_READ() is to read(). The filesystem may use
407 the buffer cache, the cluster layer, or an alternative method to write its data; uio routines will be used to see that data
408 is copied to the correct virtual address in the correct address space and will update its uio argument
409 to indicate how much data has been moved. Filesystems will not receive a write request on a file without having
410 first received a VNOP_OPEN().
411 @param vp The vnode to write to.
412 @param uio Description of request, including file offset, amount of data to write, source address for data,
413 and whether that destination is in kernel or user space.
414 @param ctx Context against which to authenticate write request.
415 @return 0 for success or a filesystem-specific error. VNOP_WRITE() can return success even if less data was
416 written than originally requested; returning an error value should indicate that something actually went wrong.
418 extern errno_t
VNOP_WRITE(vnode_t
, struct uio
*, int, vfs_context_t
);
420 struct vnop_ioctl_args
{
421 struct vnodeop_desc
*a_desc
;
426 vfs_context_t a_context
;
431 @abstract Call down to a filesystem or device driver to execute various control operations on or request data about a file.
432 @discussion Ioctl controls are typically associated with devices, but they can in fact be passed
433 down for any file; they are used to implement any of a wide range of controls and information requests.
434 fcntl() calls VNOP_IOCTL for several commands, and will attempt a VNOP_IOCTL if it is passed an unknown command,
435 though no copyin or copyout of arguments can occur in this case--the "arg" must be an integer value.
436 Filesystems can define their own fcntls using this mechanism. How ioctl commands are structured
437 is slightly complicated; see the manual page for ioctl(2).
438 @param vp The vnode to execute the command on.
439 @param command Identifier for action to take.
440 @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,
441 depending on "command." If it is an address, it is valid and resides in the kernel; callers of VNOP_IOCTL() are
442 responsible for copying to and from userland.
443 @param ctx Context against which to authenticate ioctl request.
444 @return 0 for success or a filesystem-specific error.
446 extern errno_t
VNOP_IOCTL(vnode_t
, u_long
, caddr_t
, int, vfs_context_t
);
448 struct vnop_select_args
{
449 struct vnodeop_desc
*a_desc
;
454 vfs_context_t a_context
;
458 @function VNOP_SELECT
459 @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.
460 @discussion In general, regular are always "ready for I/O" and their select vnops simply return "1."
461 Devices, though, may or may not be read; they keep track of who is selecting on them and send notifications
462 when they become ready. xnu provides structures and routines for tracking threads waiting for I/O and waking up
463 those threads: see selrecord(), selthreadclear(), seltrue(), selwait(), selwakeup(), and the selinfo structure (sys/select.h).
464 @param vp The vnode to check for I/O readiness.
465 @param which What kind of I/O is desired: FREAD, FWRITE.
466 @param fflags Flags from fileglob as seen in fcntl.h, e.g. O_NONBLOCK, O_APPEND.
467 @param wql Opaque object to pass to selrecord().
468 @param ctx Context to authenticate for select request.
469 @return Nonzero indicates that a file is ready for I/O. 0 indicates that the file is not ready for I/O;
470 there is no way to return an error. 0 should be returned if the device (or file) is not ready for I/O
471 and the driver (or filesystem) is going to track the request and provide subsequent wakeups.
472 the device (or filesystem) will provide a wakeup.
474 #ifdef XNU_KERNEL_PRIVATE
475 extern errno_t
VNOP_SELECT(vnode_t
, int, int, void *, vfs_context_t
);
476 #endif /* XNU_KERNEL_PRIVATE */
478 struct vnop_exchange_args
{
479 struct vnodeop_desc
*a_desc
;
483 vfs_context_t a_context
;
487 @function VNOP_EXCHANGE
488 @abstract Call down to a filesystem to atomically exchange the data of two files.
489 @discussion VNOP_EXCHANGE() is currently only called by the exchangedata() system call. It will only
490 be applied to files on the same volume.
491 @param fvp First vnode.
492 @param tvp Second vnode.
493 @param options Unused.
494 @param ctx Context to authenticate for exchangedata request.
495 @return 0 for success, else an error code.
497 #ifdef XNU_KERNEL_PRIVATE
498 extern errno_t
VNOP_EXCHANGE(vnode_t
, vnode_t
, int, vfs_context_t
);
499 #endif /* XNU_KERNEL_PRIVATE */
501 struct vnop_revoke_args
{
502 struct vnodeop_desc
*a_desc
;
505 vfs_context_t a_context
;
509 @function VNOP_REVOKE
510 @abstract Call down to a filesystem to invalidate all open file descriptors for a vnode.
511 @discussion This function is typically called as part of a TTY revoke, but can also be
512 used on regular files. Most filesystems simply use nop_revoke(), which calls vn_revoke(),
513 as their revoke vnop implementation.
514 @param vp The vnode to revoke.
516 @param ctx Context to authenticate for revoke request.
517 @return 0 for success, else an error code.
519 #ifdef XNU_KERNEL_PRIVATE
520 extern errno_t
VNOP_REVOKE(vnode_t
, int, vfs_context_t
);
521 #endif /* XNU_KERNEL_PRIVATE */
523 struct vnop_mmap_args
{
524 struct vnodeop_desc
*a_desc
;
527 vfs_context_t a_context
;
532 @abstract Notify a filesystem that a file is being mmap-ed.
533 @discussion VNOP_MMAP is an advisory calldown to say that the system is mmap-ing a file.
534 @param vp The vnode being mmapped.
535 @param flags Memory protection: PROT_READ, PROT_WRITE, PROT_EXEC.
536 @param ctx Context to authenticate for mmap request.
537 @return 0 for success; all errors except EPERM are ignored.
539 #ifdef XNU_KERNEL_PRIVATE
540 extern errno_t
VNOP_MMAP(vnode_t
, int, vfs_context_t
);
541 #endif /* XNU_KERNEL_PRIVATE */
543 struct vnop_mnomap_args
{
544 struct vnodeop_desc
*a_desc
;
546 vfs_context_t a_context
;
550 @function VNOP_MNOMAP
551 @abstract Inform a filesystem that a file is no longer mapped.
552 @discussion In general, no action is required of a filesystem for VNOP_MNOMAP.
553 @param vp The vnode which is no longer mapped.
554 @param ctx Context to authenticate for mnomap request.
555 @return Return value is ignored.
557 #ifdef XNU_KERNEL_PRIVATE
558 extern errno_t
VNOP_MNOMAP(vnode_t
, vfs_context_t
);
559 #endif /* XNU_KERNEL_PRIVATE */
561 struct vnop_fsync_args
{
562 struct vnodeop_desc
*a_desc
;
565 vfs_context_t a_context
;
570 @abstract Call down to a filesystem to synchronize a file with on-disk state.
571 @discussion VNOP_FSYNC is called whenever we need to make sure that a file's data has been
572 pushed to backing store, for example when recycling; it is also the heart of the fsync() system call.
573 @param vp The vnode whose data to flush to backing store.
574 @param ctx Context to authenticate for fsync request.
575 @return 0 for success, else an error code.
577 extern errno_t
VNOP_FSYNC(vnode_t
, int, vfs_context_t
);
579 struct vnop_remove_args
{
580 struct vnodeop_desc
*a_desc
;
583 struct componentname
*a_cnp
;
585 vfs_context_t a_context
;
589 @function VNOP_REMOVE
590 @abstract Call down to a filesystem to delete a file.
591 @discussion VNOP_REMOVE is called to remove a file from a filesystem's namespace, for example by unlink().
592 It can operate on regular files, named pipes, special files, and in some cases on directories.
593 @param dvp Directory in which to delete a file.
594 @param vp The file to delete.
595 @param cnp Filename information.
596 @param ctx Context to authenticate for fsync request.
597 @return 0 for success, else an error code.
599 #ifdef XNU_KERNEL_PRIVATE
600 extern errno_t
VNOP_REMOVE(vnode_t
, vnode_t
, struct componentname
*, int, vfs_context_t
);
601 #endif /* XNU_KERNEL_PRIVATE */
603 struct vnop_link_args
{
604 struct vnodeop_desc
*a_desc
;
607 struct componentname
*a_cnp
;
608 vfs_context_t a_context
;
613 @abstract Call down to a filesystem to create a hardlink to a file.
614 @discussion See "man 2 link".
615 @param vp File to link to.
616 @param dvp Directory in which to create the link.
617 @param cnp Filename information for new link.
618 @param ctx Context to authenticate for link request.
619 @return 0 for success, else an error code.
621 #ifdef XNU_KERNEL_PRIVATE
622 extern errno_t
VNOP_LINK(vnode_t
, vnode_t
, struct componentname
*, vfs_context_t
);
623 #endif /* XNU_KERNEL_PRIVATE */
625 struct vnop_rename_args
{
626 struct vnodeop_desc
*a_desc
;
629 struct componentname
*a_fcnp
;
632 struct componentname
*a_tcnp
;
633 vfs_context_t a_context
;
637 @function VNOP_RENAME
638 @abstract Call down to a filesystem to rename a file.
639 @discussion VNOP_RENAME() will only be called with a source and target on the same volume.
640 @param fdvp Directory in which source file resides.
641 @param fvp File being renamed.
642 @param fcnp Name information for source file.
643 @param tdvp Directory file is being moved to.
644 @param tvp Existing file with same name as target, should one exist.
645 @param tcnp Name information for target path.
646 @param ctx Context to authenticate for rename request.
647 @return 0 for success, else an error code.
649 #ifdef XNU_KERNEL_PRIVATE
650 extern errno_t
VNOP_RENAME(vnode_t
, vnode_t
, struct componentname
*, vnode_t
, vnode_t
, struct componentname
*, vfs_context_t
);
651 #endif /* XNU_KERNEL_PRIVATE */
653 struct vnop_mkdir_args
{
654 struct vnodeop_desc
*a_desc
;
657 struct componentname
*a_cnp
;
658 struct vnode_attr
*a_vap
;
659 vfs_context_t a_context
;
664 @abstract Call down to a filesystem to create a directory.
665 @discussion The newly created directory should be returned with an iocount which will be dropped by the caller.
666 @param dvp Directory in which to create new directory.
667 @param vpp Destination for pointer to new directory's vnode.
668 @param cnp Name information for new directory.
669 @param vap Attributes for new directory.
670 @param ctx Context to authenticate for mkdir request.
671 @return 0 for success, else an error code.
673 #ifdef XNU_KERNEL_PRIVATE
674 extern errno_t
VNOP_MKDIR(vnode_t
, vnode_t
*, struct componentname
*, struct vnode_attr
*, vfs_context_t
);
675 #endif /* XNU_KERNEL_PRIVATE */
677 struct vnop_rmdir_args
{
678 struct vnodeop_desc
*a_desc
;
681 struct componentname
*a_cnp
;
682 vfs_context_t a_context
;
687 @abstract Call down to a filesystem to delete a directory.
688 @param dvp Parent of directory to be removed.
689 @param vp Directory to remove.
690 @param cnp Name information for directory to be deleted.
691 @param ctx Context to authenticate for rmdir request.
692 @return 0 for success, else an error code.
694 #ifdef XNU_KERNEL_PRIVATE
695 extern errno_t
VNOP_RMDIR(vnode_t
, vnode_t
, struct componentname
*, vfs_context_t
);
696 #endif /* XNU_KERNEL_PRIVATE */
698 struct vnop_symlink_args
{
699 struct vnodeop_desc
*a_desc
;
702 struct componentname
*a_cnp
;
703 struct vnode_attr
*a_vap
;
705 vfs_context_t a_context
;
709 @function VNOP_SYMLINK
710 @abstract Call down to a filesystem to create a symbolic link.
711 @param If VNOP_SYMLINK() is successful, the new file should be returned with an iocount which will
712 be dropped by the caller. VFS does not ensure that the target path will have a length shorter
713 than the max symlink length for the filesystem.
714 @param dvp Parent directory for new symlink file.
716 @param cnp Name information for new symlink.
717 @param vap Attributes for symlink.
718 @param target Path for symlink to store; for "ln -s /var/vardir linktovardir", "target" would be "/var/vardir"
719 @param ctx Context to authenticate for symlink request.
720 @return 0 for success, else an error code.
722 #ifdef XNU_KERNEL_PRIVATE
723 extern errno_t
VNOP_SYMLINK(vnode_t
, vnode_t
*, struct componentname
*, struct vnode_attr
*, char *, vfs_context_t
);
724 #endif /* XNU_KERNEL_PRIVATE */
729 * When VNOP_READDIR is called from the NFS Server, the nfs_data
730 * argument is non-NULL.
732 * The value of nfs_eofflag should be set to TRUE if the end of
733 * the directory was reached while reading.
735 * The directory seek offset (cookies) are returned to the NFS client and
736 * may be used later to restart a directory read part way through
737 * the directory. There is one cookie returned for each directory
738 * entry returned and its size is determince from nfs_sizeofcookie.
739 * The value of the cookie should be the logical offset within the
740 * directory where the on-disc version of the appropriate directory
741 * entry starts. Memory for the cookies is allocated from M_TEMP
742 * and it is freed by the caller of VNOP_READDIR.
746 struct vnop_readdir_args
{
747 struct vnodeop_desc
*a_desc
;
753 vfs_context_t a_context
;
757 @function VNOP_READDIR
758 @abstract Call down to a filesystem to enumerate directory entries.
759 @discussion VNOP_READDIR() packs a buffer with "struct dirent" directory entry representations as described
760 by the "getdirentries" manual page.
761 @param vp Directory to enumerate.
762 @param uio Destination information for resulting direntries.
763 @param flags VNODE_READDIR_EXTENDED, VNODE_READDIR_REQSEEKOFF, VNODE_READDIR_SEEKOFF32: Apple-internal flags.
764 @param eofflag Should be set to 1 if the end of the directory has been reached.
765 @param numdirent Should be set to number of entries written into buffer.
766 @param ctx Context to authenticate for readdir request.
767 @return 0 for success, else an error code.
769 #ifdef XNU_KERNEL_PRIVATE
770 extern errno_t
VNOP_READDIR(vnode_t
, struct uio
*, int, int *, int *, vfs_context_t
);
771 #endif /* XNU_KERNEL_PRIVATE */
773 struct vnop_readdirattr_args
{
774 struct vnodeop_desc
*a_desc
;
776 struct attrlist
*a_alist
;
780 uint32_t *a_newstate
;
782 uint32_t *a_actualcount
;
783 vfs_context_t a_context
;
787 @function VNOP_READDIRATTR
788 @abstract Call down to get file attributes for many files in a directory at once.
789 @discussion VNOP_READDIRATTR() packs a buffer with file attributes, as if the results of many "getattrlist" calls.
790 @param vp Directory in which to enumerate entries' attributes.
791 @param alist Which attributes are wanted for each directory entry.
792 @param uio Destination information for resulting attributes.
793 @param maxcount Maximum count of files to get attributes for.
794 @param options FSOPT_NOFOLLOW: do not follow symbolic links. FSOPT_NOINMEMUPDATE: do not use data which have been
795 updated since an inode was loaded into memory.
796 @param newstate The "newstate" should be set to a value which changes if the contents of a directory change
797 through an addition or deletion but stays the same otherwise.
798 @param eofflag Should be set to 1 if the end of the directory has been reached.
799 @param actualcount Should be set to number of files whose attributes were written into buffer.
800 @param ctx Context to authenticate for readdirattr request.
801 @return 0 for success, else an error code.
803 #ifdef XNU_KERNEL_PRIVATE
804 extern errno_t
VNOP_READDIRATTR(vnode_t
, struct attrlist
*, struct uio
*, uint32_t, uint32_t, uint32_t *, int *, uint32_t *, vfs_context_t
);
805 #endif /* XNU_KERNEL_PRIVATE */
807 struct vnop_readlink_args
{
808 struct vnodeop_desc
*a_desc
;
811 vfs_context_t a_context
;
815 @function VNOP_READLINK
816 @abstract Call down to a filesystem to get the pathname represented by a symbolic link.
817 @discussion VNOP_READLINK() gets the path stored in a symbolic link; it is called by namei() and the readlink() system call.
818 @param vp Symbolic link to read from.
819 @param uio Destination information for link path.
820 @param ctx Context to authenticate for readlink request.
821 @return 0 for success, else an error code.
823 #ifdef XNU_KERNEL_PRIVATE
824 extern errno_t
VNOP_READLINK(vnode_t
, struct uio
*, vfs_context_t
);
825 #endif /* XNU_KERNEL_PRIVATE */
827 struct vnop_inactive_args
{
828 struct vnodeop_desc
*a_desc
;
830 vfs_context_t a_context
;
834 @function VNOP_INACTIVE
835 @abstract Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped.
836 @discussion VNOP_INACTVE() gives a filesystem a chance to aggressively release resources assocated with a vnode, perhaps
837 even to call vnode_recycle(), but no action is prescribed; it is acceptable for VNOP_INACTIVE to be a no-op and
838 to defer all reclamation until VNOP_RECLAIM().
839 VNOP_INACTVE() will not be called on a vnode if no persistent reference is ever taken; an
840 important example is a stat(), which takes an iocount, reads its data, and drops that iocount.
841 @param vp The vnode which is now inactive.
842 @param ctx Context to authenticate for inactive message.
843 @return 0 for success, else an error code, but return value is currently ignored.
845 #ifdef XNU_KERNEL_PRIVATE
846 extern errno_t
VNOP_INACTIVE(vnode_t
, vfs_context_t
);
847 #endif /* XNU_KERNEL_PRIVATE */
849 struct vnop_reclaim_args
{
850 struct vnodeop_desc
*a_desc
;
852 vfs_context_t a_context
;
856 @function VNOP_RECLAIM
857 @abstract Release filesystem-internal resources for a vnode.
858 @discussion VNOP_RECLAIM() is called as part of the process of recycling a vnode. During
859 a reclaim routine, a filesystem should remove a vnode from its hash and deallocate any resources
860 allocated to that vnode. VFS guarantees that when VNOP_RECLAIM() is called, there are no more
861 iocount references on a vnode (though there may still be usecount references--these are invalidated
862 by the reclaim) and that no more will be granted. This means in practice that there will be no
863 filesystem calls on the vnode being reclaimed until the reclaim has finished and the vnode has
865 @param vp The vnode to reclaim.
866 @param ctx Context to authenticate for reclaim.
867 @return 0 for success, or an error code. A nonzero return value results in a panic.
869 #ifdef XNU_KERNEL_PRIVATE
870 extern errno_t
VNOP_RECLAIM(vnode_t
, vfs_context_t
);
871 #endif /* XNU_KERNEL_PRIVATE */
873 struct vnop_pathconf_args
{
874 struct vnodeop_desc
*a_desc
;
878 vfs_context_t a_context
;
882 @function VNOP_PATHCONF
883 @abstract Query a filesystem for path properties.
884 @param vp The vnode whose filesystem to query.
885 @param name Which property to request: see unistd.h. For example: _PC_CASE_SENSITIVE (is
886 a filesystem case-sensitive?). Only one property can be requested at a time.
887 @param retval Destination for value of property.
888 @param ctx Context to authenticate for pathconf request.
889 @return 0 for success, or an error code.
891 #ifdef XNU_KERNEL_PRIVATE
892 extern errno_t
VNOP_PATHCONF(vnode_t
, int, int32_t *, vfs_context_t
);
893 #endif /* XNU_KERNEL_PRIVATE */
895 struct vnop_advlock_args
{
896 struct vnodeop_desc
*a_desc
;
902 vfs_context_t a_context
;
906 @function VNOP_ADVLOCK
907 @abstract Aquire or release and advisory lock on a vnode.
908 @discussion Advisory locking is somewhat complicated. VNOP_ADVLOCK is overloaded for
909 both flock() and POSIX advisory locking usage, though not all filesystems support both (or any). VFS
910 provides an advisory locking mechanism for filesystems which can take advantage of it; vfs_setlocklocal()
911 marks a filesystem as using VFS advisory locking support.
912 @param vp The vnode to lock or unlock.
913 @param id Identifier for lock holder: ignored by most filesystems.
914 @param op Which locking operation: F_SETLK: set locking information about a region.
915 F_GETLK: get locking information about the specified region. F_UNLCK: Unlock a region.
916 @param fl Description of file region to lock. l_whence is as with "lseek."
917 Includes a type: F_RDLCK (shared lock), F_UNLCK (unlock) , and F_WRLCK (exclusive lock).
918 @param flags F_FLOCK: use flock() semantics. F_POSIX: use POSIX semantics. F_WAIT: sleep if necessary.
919 F_PROV: Non-coelesced provisional lock (unused in xnu).
920 @param ctx Context to authenticate for advisory locking request.
921 @return 0 for success, or an error code.
923 #ifdef XNU_KERNEL_PRIVATE
924 extern errno_t
VNOP_ADVLOCK(vnode_t
, caddr_t
, int, struct flock
*, int, vfs_context_t
);
925 #endif /* XNU_KERNEL_PRIVATE */
927 struct vnop_allocate_args
{
928 struct vnodeop_desc
*a_desc
;
932 off_t
*a_bytesallocated
;
934 vfs_context_t a_context
;
938 @function VNOP_ALLOCATE
939 @abstract Pre-allocate space for a file.
940 @discussion VNOP_ALLOCATE() changes the amount of backing store set aside to
941 a file. It can be used to either shrink or grow a file. If the file shrinks,
942 its ubc size will be modified accordingly, but if it grows, then the ubc size is unchanged;
943 space is set aside without being actively used by the file. VNOP_ALLOCATE() is currently only
944 called as part of the F_PREALLOCATE fcntl, and is supported only by AFP and HFS.
945 @param vp The vnode for which to preallocate space.
946 @param length Desired preallocated file length.
948 PREALLOCATE: preallocate allocation blocks.
949 ALLOCATECONTIG: allocate contigious space.
950 ALLOCATEALL: allocate all requested space or no space at all.
951 FREEREMAINDER: deallocate allocated but unfilled blocks.
952 ALLOCATEFROMPEOF: allocate from the physical eof.
953 ALLOCATEFROMVOL: allocate from the volume offset.
954 @param bytesallocated Additional bytes set aside for file. Set to 0 if none are allocated
955 OR if the file is contracted.
956 @param offset Hint for where to find free blocks.
957 @param ctx Context to authenticate for allocation request.
958 @return 0 for success, or an error code.
960 #ifdef XNU_KERNEL_PRIVATE
961 extern errno_t
VNOP_ALLOCATE(vnode_t
, off_t
, u_int32_t
, off_t
*, off_t
, vfs_context_t
);
962 #endif /* XNU_KERNEL_PRIVATE */
964 struct vnop_pagein_args
{
965 struct vnodeop_desc
*a_desc
;
968 upl_offset_t a_pl_offset
;
972 vfs_context_t a_context
;
976 @function VNOP_PAGEIN
977 @abstract Pull file data into memory.
978 @discussion VNOP_PAGEIN() is called by when a process faults on data mapped from a file or
979 when madvise() demands pre-fetching. It is conceptually somewhat similar to VNOP_READ(). Filesystems
980 are typically expected to call cluster_pagein() to handle the labor of mapping and committing the UPL.
981 @param vp The vnode for which to page in data.
982 @param pl UPL describing pages needing to be paged in.
983 @param pl_offset Offset in UPL at which to start placing data.
984 @param f_offset Offset in file of data needing to be paged in.
985 @param size Amount of data to page in (in bytes).
986 @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC.
987 Filesystems should generally leave it to the cluster layer to handle these flags. See the
988 memory_object_types.h header in the kernel framework if interested.
989 @param ctx Context to authenticate for pagein request.
990 @return 0 for success, or an error code.
992 #ifdef XNU_KERNEL_PRIVATE
993 extern errno_t
VNOP_PAGEIN(vnode_t
, upl_t
, upl_offset_t
, off_t
, size_t, int, vfs_context_t
);
994 #endif /* XNU_KERNEL_PRIVATE */
996 struct vnop_pageout_args
{
997 struct vnodeop_desc
*a_desc
;
1000 upl_offset_t a_pl_offset
;
1004 vfs_context_t a_context
;
1008 @function VNOP_PAGEOUT
1009 @abstract Write data from a mapped file back to disk.
1010 @discussion VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either
1011 because of an msync() call or due to memory pressure. Filesystems are for the most part expected to
1012 just call cluster_pageout().
1013 @param vp The vnode for which to page out data.
1014 @param pl UPL describing pages needing to be paged out.
1015 @param pl_offset Offset in UPL from which to start paging out data.
1016 @param f_offset Offset in file of data needing to be paged out.
1017 @param size Amount of data to page out (in bytes).
1018 @param flags UPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC.
1019 Filesystems should generally leave it to the cluster layer to handle these flags. See the
1020 memory_object_types.h header in the kernel framework if interested.
1021 @param ctx Context to authenticate for pageout request.
1022 @return 0 for success, or an error code.
1024 #ifdef XNU_KERNEL_PRIVATE
1025 extern errno_t
VNOP_PAGEOUT(vnode_t
, upl_t
, upl_offset_t
, off_t
, size_t, int, vfs_context_t
);
1026 #endif /* XNU_KERNEL_PRIVATE */
1028 struct vnop_searchfs_args
{
1029 struct vnodeop_desc
*a_desc
;
1031 void *a_searchparams1
;
1032 void *a_searchparams2
;
1033 struct attrlist
*a_searchattrs
;
1034 uint32_t a_maxmatches
;
1035 struct timeval
*a_timelimit
;
1036 struct attrlist
*a_returnattrs
;
1037 uint32_t *a_nummatches
;
1038 uint32_t a_scriptcode
;
1041 struct searchstate
*a_searchstate
;
1042 vfs_context_t a_context
;
1045 #ifdef XNU_KERNEL_PRIVATE
1046 extern 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
);
1047 #endif /* XNU_KERNEL_PRIVATE */
1049 struct vnop_copyfile_args
{
1050 struct vnodeop_desc
*a_desc
;
1054 struct componentname
*a_tcnp
;
1057 vfs_context_t a_context
;
1060 #ifdef XNU_KERNEL_PRIVATE
1061 extern errno_t
VNOP_COPYFILE(vnode_t
, vnode_t
, vnode_t
, struct componentname
*, int, int, vfs_context_t
);
1062 #endif /* XNU_KERNEL_PRIVATE */
1064 struct vnop_getxattr_args
{
1065 struct vnodeop_desc
*a_desc
;
1067 const char * a_name
;
1071 vfs_context_t a_context
;
1073 extern struct vnodeop_desc vnop_getxattr_desc
;
1076 @function VNOP_GETXATTR
1077 @abstract Get extended file attributes.
1078 @param vp The vnode to get extended attributes for.
1079 @param name Which property to extract.
1080 @param uio Destination information for attribute value.
1081 @param size Should be set to the amount of data written.
1082 @param options XATTR_NOSECURITY: bypass security-checking.
1083 @param ctx Context to authenticate for getxattr request.
1084 @return 0 for success, or an error code.
1086 extern errno_t
VNOP_GETXATTR(vnode_t
, const char *, uio_t
, size_t *, int, vfs_context_t
);
1088 struct vnop_setxattr_args
{
1089 struct vnodeop_desc
*a_desc
;
1091 const char * a_name
;
1094 vfs_context_t a_context
;
1096 extern struct vnodeop_desc vnop_setxattr_desc
;
1099 @function VNOP_SETXATTR
1100 @abstract Set extended file attributes.
1101 @param vp The vnode to set extended attributes for.
1102 @param name Which property to extract.
1103 @param uio Source information for attribute value.
1104 @param options XATTR_NOSECURITY: bypass security-checking. XATTR_CREATE: set value, fail if exists.
1105 XATTR_REPLACE: set value, fail if does not exist.
1106 @param ctx Context to authenticate for setxattr request.
1107 @return 0 for success, or an error code.
1109 extern errno_t
VNOP_SETXATTR(vnode_t
, const char *, uio_t
, int, vfs_context_t
);
1111 struct vnop_removexattr_args
{
1112 struct vnodeop_desc
*a_desc
;
1114 const char * a_name
;
1116 vfs_context_t a_context
;
1118 extern struct vnodeop_desc vnop_removexattr_desc
;
1121 @function VNOP_REMOVEXATTR
1122 @abstract Remove extended file attributes.
1123 @param vp The vnode from which to remove extended attributes.
1124 @param name Which attribute to delete.
1125 @param options XATTR_NOSECURITY: bypass security-checking.
1126 @param ctx Context to authenticate for attribute delete request.
1127 @return 0 for success, or an error code.
1129 #ifdef XNU_KERNEL_PRIVATE
1130 extern errno_t
VNOP_REMOVEXATTR(vnode_t
, const char *, int, vfs_context_t
);
1131 #endif /* XNU_KERNEL_PRIVATE */
1133 struct vnop_listxattr_args
{
1134 struct vnodeop_desc
*a_desc
;
1139 vfs_context_t a_context
;
1141 extern struct vnodeop_desc vnop_listxattr_desc
;
1144 @function VNOP_LISTXATTR
1145 @abstract List extended attribute keys.
1146 @discussion Should write a sequence of unseparated, null-terminated extended-attribute
1147 names into the space described by the provided uio. These keys can then be passed to
1148 getxattr() (and VNOP_GETXATTR()).
1149 @param vp The vnode for which to get extended attribute keys.
1150 @param uio Description of target memory for attribute keys.
1151 @param size Should be set to amount of data written to buffer.
1152 @param options XATTR_NOSECURITY: bypass security checking.
1153 @param ctx Context to authenticate for attribute name request.
1155 #ifdef XNU_KERNEL_PRIVATE
1156 extern errno_t
VNOP_LISTXATTR(vnode_t
, uio_t
, size_t *, int, vfs_context_t
);
1157 #endif /* XNU_KERNEL_PRIVATE */
1159 struct vnop_blktooff_args
{
1160 struct vnodeop_desc
*a_desc
;
1167 @function VNOP_BLKTOOFF
1168 @abstract Call down to a filesystem to convert a logical block number to a file offset.
1169 @discussion VNOP_BLKTOOFF() converts a logical block to a file offset in bytes. That offset
1170 can be passed to VNOP_BLOCKMAP(), then, to get a physical block number--buf_strategy() does this.
1171 @param vp The vnode for which to convert a logical block to an offset.
1172 @param lblkno Logical block number to turn into offset.
1173 @param offset Destination for file offset.
1174 @return 0 for success, else an error code.
1176 #ifdef XNU_KERNEL_PRIVATE
1177 extern errno_t
VNOP_BLKTOOFF(vnode_t
, daddr64_t
, off_t
*);
1178 #endif /* XNU_KERNEL_PRIVATE */
1180 struct vnop_offtoblk_args
{
1181 struct vnodeop_desc
*a_desc
;
1184 daddr64_t
*a_lblkno
;
1188 @function VNOP_OFFTOBLK
1189 @abstract Call down to a filesystem to convert a file offset to a logical block number.
1190 @param vp The vnode for which to convert an offset to a logical block number.
1191 @param offset File offset to convert.
1192 @param lblkno Destination for corresponding logical block number.
1193 @return 0 for success, else an error code.
1195 #ifdef XNU_KERNEL_PRIVATE
1196 extern errno_t
VNOP_OFFTOBLK(vnode_t
, off_t
, daddr64_t
*);
1197 #endif /* XNU_KERNEL_PRIVATE */
1199 struct vnop_blockmap_args
{
1200 struct vnodeop_desc
*a_desc
;
1208 vfs_context_t a_context
;
1212 @function VNOP_BLOCKMAP
1213 @abstract Call down to a filesystem to get information about the on-disk layout of a file region.
1214 @discussion VNOP_BLOCKMAP() returns the information required to pass a request for a contiguous region
1215 down to a device's strategy routine.
1216 @param vp The vnode for which to get on-disk information.
1217 @param foffset Offset (in bytes) at which region starts.
1218 @param size Size of region.
1219 @param bpn Destination for physical block number at which region begins on disk.
1220 @param run Destination for number of bytes which can be found contiguously on-disk before
1221 first discontinuity.
1222 @param poff Currently unused.
1223 @param flags VNODE_READ: request is for a read. VNODE_WRITE: request is for a write.
1224 @param ctx Context to authenticate for blockmap request; currently often set to NULL.
1225 @return 0 for success, else an error code.
1227 #ifdef XNU_KERNEL_PRIVATE
1228 extern errno_t
VNOP_BLOCKMAP(vnode_t
, off_t
, size_t, daddr64_t
*, size_t *, void *,
1229 int, vfs_context_t
);
1230 #endif /* XNU_KERNEL_PRIVATE */
1232 struct vnop_strategy_args
{
1233 struct vnodeop_desc
*a_desc
;
1238 @function VNOP_STRATEGY
1239 @abstract Initiate I/O on a file (both read and write).
1240 @discussion A filesystem strategy routine takes a buffer, performs whatever manipulations are necessary for passing
1241 the I/O request down to the device layer, and calls the appropriate device's strategy routine. Most filesystems should
1242 just call buf_strategy() with "bp" as the argument.
1243 @param bp Complete specificiation of requested I/O: region of data involved, whether request is for read or write, and so on.
1244 @return 0 for success, else an error code.
1246 extern errno_t
VNOP_STRATEGY(struct buf
*bp
);
1248 struct vnop_bwrite_args
{
1249 struct vnodeop_desc
*a_desc
;
1254 @function VNOP_BWRITE
1255 @abstract Write a buffer to backing store.
1256 @discussion VNOP_BWRITE() is called by buf_bawrite() (asynchronous write) and potentially by buf_bdwrite() (delayed write)
1257 but not by buf_bwrite(). A filesystem may choose to perform some kind of manipulation of the buffer in this routine; it
1258 generally will end up calling VFS's default implementation, vn_bwrite() (which calls buf_bwrite() without further ado).
1259 @param bp The buffer to write.
1260 @return 0 for success, else an error code.
1262 extern errno_t
VNOP_BWRITE(buf_t
);
1264 struct vnop_kqfilt_add_args
{
1265 struct vnodeop_desc
*a_desc
;
1268 vfs_context_t a_context
;
1270 extern struct vnodeop_desc vnop_kqfilt_add_desc
;
1272 #ifdef XNU_KERNEL_PRIVATE
1273 extern errno_t
VNOP_KQFILT_ADD(vnode_t
, struct knote
*, vfs_context_t
);
1274 #endif /* XNU_KERNEL_PRIVATE */
1276 struct vnop_kqfilt_remove_args
{
1277 struct vnodeop_desc
*a_desc
;
1280 vfs_context_t a_context
;
1282 extern struct vnodeop_desc vnop_kqfilt_remove_desc
;
1284 #ifdef XNU_KERNEL_PRIVATE
1285 errno_t
VNOP_KQFILT_REMOVE(vnode_t
, uintptr_t , vfs_context_t
);
1286 #endif /* XNU_KERNEL_PRIVATE */
1289 #ifdef KERNEL_PRIVATE
1290 #define VNODE_MONITOR_BEGIN 0x01
1291 #define VNODE_MONITOR_END 0x02
1292 #define VNODE_MONITOR_UPDATE 0x04
1293 struct vnop_monitor_args
{
1294 struct vnodeop_desc
*a_desc
;
1299 vfs_context_t a_context
;
1301 extern struct vnodeop_desc vnop_monitor_desc
;
1302 #endif /* KERNEL_PRIVATE */
1304 #ifdef XNU_KERNEL_PRIVATE
1306 @function VNOP_MONITOR
1307 @abstract Indicate to a filesystem that the number of watchers of a file has changed.
1308 @param vp The vnode whose watch state has changed.
1309 @param events Unused. Filesystems can ignore this parameter.
1310 @param flags Type of change to the watch state. VNODE_MONITOR_BEGIN is passed when the kernel
1311 begins tracking a new watcher of a file. VNODE_MONITOR_END is passed when a watcher stops watching a file.
1312 VNODE_MONITOR_UPDATE is currently unused. A filesystem is guaranteed that each VNODE_MONITOR_BEGIN
1313 will be matched by a VNODE_MONITOR_END with the same "handle" argument.
1314 @param handle Unique identifier for a given watcher. A VNODE_MONITOR_BEGIN for a given handle will be matched with a
1315 VNODE_MONITOR_END for the same handle; a filesystem need not consider this parameter unless
1316 it for some reason wants be able to match specific VNOP_MONITOR calls rather than just keeping
1318 @param ctx The context which is starting to monitor a file or ending a watch on a file. A matching
1319 pair of VNODE_MONITOR_BEGIN and VNODE_MONITOR_END need not have the same context.
1320 @discussion VNOP_MONITOR() is intended to let networked filesystems know when they should bother
1321 listening for changes to files which occur remotely, so that they can post notifications using
1322 vnode_notify(). Local filesystems should not implement a monitor vnop.
1323 It is called when there is a new watcher for a file or when a watcher for a file goes away.
1324 Each BEGIN will be matched with an END with the same handle. Note that vnode_ismonitored() can
1325 be used to see if there are currently watchers for a file.
1327 errno_t
VNOP_MONITOR(vnode_t
, uint32_t, uint32_t, void*, vfs_context_t
);
1328 #endif /* XNU_KERNEL_PRIVATE */
1331 struct vnop_setlabel_args
{
1332 struct vnodeop_desc
*a_desc
;
1335 vfs_context_t a_context
;
1337 extern struct vnodeop_desc vnop_setlabel_desc
;
1340 @function VNOP_SETLABEL
1341 @abstract Associate a MACF label with a file.
1342 @param vp The vnode to label.
1343 @param label The desired label.
1344 @param ctx Context to authenticate for label change.
1345 @return 0 for success, else an error code.
1347 #ifdef XNU_KERNEL_PRIVATE
1348 errno_t
VNOP_SETLABEL(vnode_t
, struct label
*, vfs_context_t
);
1349 #endif /* XNU_KERNEL_PRIVATE */
1351 #ifdef __APPLE_API_UNSTABLE
1355 enum nsoperation
{ NS_OPEN
, NS_CREATE
, NS_DELETE
};
1357 struct vnop_getnamedstream_args
{
1358 struct vnodeop_desc
*a_desc
;
1362 enum nsoperation a_operation
;
1364 vfs_context_t a_context
;
1368 @function VNOP_GETNAMEDSTREAM
1369 @abstract Get a named stream associated with a file.
1370 @discussion If this call sucecss, svpp should be returned with an iocount which the caller
1371 will drop. VFS provides a facility for simulating named streams when interacting with filesystems
1372 which do not support them.
1373 @param vp The vnode for which to get a named stream.
1374 @param svpp Destination for pointer to named stream's vnode.
1375 @param name The name of the named stream, e.g. "com.apple.ResourceFork".
1376 @param operation Operation to perform. In HFS and AFP, this parameter is only considered as follows:
1377 if the resource fork has not been opened and the operation is not NS_OPEN, fail with ENOATTR. Currently
1378 only passed as NS_OPEN by VFS.
1379 @param flags Currently unused.
1380 @param ctx Context to authenticate for getting named stream.
1381 @return 0 for success, else an error code.
1383 #ifdef XNU_KERNEL_PRIVATE
1384 extern errno_t
VNOP_GETNAMEDSTREAM(vnode_t
, vnode_t
*, const char *, enum nsoperation
, int flags
, vfs_context_t
);
1385 #endif /* XNU_KERNEL_PRIVATE */
1387 struct vnop_makenamedstream_args
{
1388 struct vnodeop_desc
*a_desc
;
1393 vfs_context_t a_context
;
1397 @function VNOP_MAKENAMEDSTREAM
1398 @abstract Create a named stream associated with a file.
1399 @discussion If this call succeeds, svpp should be returned with an iocount which the caller will drop.
1400 VFS provides a facility for simulating named streams when interacting with filesystems
1401 which do not support them.
1402 @param vp The vnode for which to get a named stream.
1403 @param svpp Destination for pointer to named stream's vnode.
1404 @param name The name of the named stream, e.g. "com.apple.ResourceFork".
1405 @param flags Currently unused.
1406 @param ctx Context to authenticate creating named stream.
1407 @return 0 for success, else an error code.
1409 #ifdef XNU_KERNEL_PRIVATE
1410 extern errno_t
VNOP_MAKENAMEDSTREAM(vnode_t
, vnode_t
*, const char *, int flags
, vfs_context_t
);
1411 #endif /* XNU_KERNEL_PRIVATE */
1413 struct vnop_removenamedstream_args
{
1414 struct vnodeop_desc
*a_desc
;
1419 vfs_context_t a_context
;
1423 @function VNOP_REMOVENAMEDSTREAM
1424 @abstract Delete a named stream associated with a file.
1425 @discussion VFS provides a facility for simulating named streams when interacting with filesystems
1426 which do not support them.
1427 @param vp The vnode to which the named stream belongs.
1428 @param svp The named stream's vnode.
1429 @param name The name of the named stream, e.g. "com.apple.ResourceFork".
1430 @param flags Currently unused.
1431 @param ctx Context to authenticate deleting named stream.
1432 @return 0 for success, else an error code.
1434 #ifdef XNU_KERNEL_PRIVATE
1435 extern errno_t
VNOP_REMOVENAMEDSTREAM(vnode_t
, vnode_t
, const char *, int flags
, vfs_context_t
);
1436 #endif /* XNU_KERNEL_PRIVATE */
1445 #endif /* !_SYS_VNODE_IF_H_ */