|
Mac Dev Center
Mac OS X Reference Library Drivers, Kernel, & Hardware: Kernel Device Drivers Kernel Framework Reference
|
vnode_if.h |
| Includes: |
Use the links in the table of contents to the left to access the documentation.
Write a buffer to backing store.
Call down to a filesystem to synchronize a file with on-disk state.
Get extended file attributes.
Call down to a filesystem or device driver to execute various control operations on or request data about a file.
Call down to a filesystem to read file data.
Set extended file attributes.
Initiate I/O on a file (both read and write).
Call down to the filesystem to write file data.
VNOP_BWRITE |
Write a buffer to backing store.
extern errno_t VNOP_BWRITE( buf_t);
bpThe buffer to write.
0 for success, else an error code.
VNOP_BWRITE() is called by buf_bawrite() (asynchronous write) and potentially by buf_bdwrite() (delayed write) but not by buf_bwrite(). A filesystem may choose to perform some kind of manipulation of the buffer in this routine; it generally will end up calling VFS's default implementation, vn_bwrite() (which calls buf_bwrite() without further ado).
VNOP_FSYNC |
Call down to a filesystem to synchronize a file with on-disk state.
extern errno_t VNOP_FSYNC( vnode_t, int, vfs_context_t);
vpThe vnode whose data to flush to backing store.
ctxContext to authenticate for fsync request.
0 for success, else an error code.
VNOP_FSYNC is called whenever we need to make sure that a file's data has been pushed to backing store, for example when recycling; it is also the heart of the fsync() system call.
VNOP_GETXATTR |
Get extended file attributes.
extern errno_t VNOP_GETXATTR( vnode_t, const char *, uio_t, size_t *, int, vfs_context_t);
vpThe vnode to get extended attributes for.
nameWhich property to extract.
uioDestination information for attribute value.
sizeShould be set to the amount of data written.
optionsXATTR_NOSECURITY: bypass security-checking.
ctxContext to authenticate for getxattr request.
0 for success, or an error code.
VNOP_IOCTL |
Call down to a filesystem or device driver to execute various control operations on or request data about a file.
extern errno_t VNOP_IOCTL( vnode_t, u_long, caddr_t, int, vfs_context_t);
vpThe vnode to execute the command on.
commandIdentifier for action to take.
dataPointer to data; this can be an integer constant (of 32 bits only) or an address to be read from or written to, depending on "command." If it is an address, it is valid and resides in the kernel; callers of VNOP_IOCTL() are responsible for copying to and from userland.
ctxContext against which to authenticate ioctl request.
0 for success or a filesystem-specific error.
Ioctl controls are typically associated with devices, but they can in fact be passed down for any file; they are used to implement any of a wide range of controls and information requests. fcntl() calls VNOP_IOCTL for several commands, and will attempt a VNOP_IOCTL if it is passed an unknown command, though no copyin or copyout of arguments can occur in this case--the "arg" must be an integer value. Filesystems can define their own fcntls using this mechanism. How ioctl commands are structured is slightly complicated; see the manual page for ioctl(2).
VNOP_READ |
Call down to a filesystem to read file data.
extern errno_t VNOP_READ( vnode_t, struct uio *, int, vfs_context_t);
vpThe vnode to read from.
uioDescription of request, including file offset, amount of data requested, destination address for data, and whether that destination is in kernel or user space.
ctxContext against which to authenticate read request.
0 for success or a filesystem-specific error. VNOP_READ() can return success even if less data was read than originally requested; returning an error value should indicate that something actually went wrong.
VNOP_READ() is where the hard work of of the read() system call happens. The filesystem may use the buffer cache, the cluster layer, or an alternative method to get its data; uio routines will be used to see that data is copied to the correct virtual address in the correct address space and will update its uio argument to indicate how much data has been moved. Filesystems will not receive a read request on a file without having first received a VNOP_OPEN().
VNOP_SETXATTR |
Set extended file attributes.
extern errno_t VNOP_SETXATTR( vnode_t, const char *, uio_t, int, vfs_context_t);
vpThe vnode to set extended attributes for.
nameWhich property to extract.
uioSource information for attribute value.
optionsXATTR_NOSECURITY: bypass security-checking. XATTR_CREATE: set value, fail if exists. XATTR_REPLACE: set value, fail if does not exist.
ctxContext to authenticate for setxattr request.
0 for success, or an error code.
VNOP_STRATEGY |
Initiate I/O on a file (both read and write).
extern errno_t VNOP_STRATEGY( struct buf *bp);
bpComplete specificiation of requested I/O: region of data involved, whether request is for read or write, and so on.
0 for success, else an error code.
A filesystem strategy routine takes a buffer, performs whatever manipulations are necessary for passing the I/O request down to the device layer, and calls the appropriate device's strategy routine. Most filesystems should just call buf_strategy() with "bp" as the argument.
VNOP_WRITE |
Call down to the filesystem to write file data.
extern errno_t VNOP_WRITE( vnode_t, struct uio *, int, vfs_context_t);
vpThe vnode to write to.
uioDescription of request, including file offset, amount of data to write, source address for data, and whether that destination is in kernel or user space.
ctxContext against which to authenticate write request.
0 for success or a filesystem-specific error. VNOP_WRITE() can return success even if less data was written than originally requested; returning an error value should indicate that something actually went wrong.
VNOP_WRITE() is to write() as VNOP_READ() is to read(). The filesystem may use the buffer cache, the cluster layer, or an alternative method to write its data; uio routines will be used to see that data is copied to the correct virtual address in the correct address space and will update its uio argument to indicate how much data has been moved. Filesystems will not receive a write request on a file without having first received a VNOP_OPEN().
Call down to a filesystem to close a file.
Query a filesystem for path properties.
Aquire or release and advisory lock on a vnode.
List extended attribute keys.
Call down to a filesystem to convert a file offset to a logical block number.
Call down to a filesystem to open a file.
Write data from a mapped file back to disk.
Call down to a filesystem to look for a directory entry by name.
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.
Inform a filesystem that a file is no longer mapped.
Call down to a filesystem to see if a kauth-style operation is permitted.
Associate a MACF label with a file.
Write data from a mapped file back to disk.
Call down to a filesystem to get the pathname represented by a symbolic link.
Call down to a filesystem to delete a file.
Remove extended file attributes.
Get a named stream associated with a file.
Call down to a filesystem to rename a file.
Call down to a filesystem to create a whiteout.
Call down to a filesystem to invalidate all open file descriptors for a vnode.
Notify a filesystem that a file is being mmap-ed.
Call down to a filesystem to convert a logical block number to a file offset.
Call down to a filesystem to create a special file.
Pre-allocate space for a file.
Pull file data into memory.
Release filesystem-internal resources for a vnode.
Call down to a filesystem to set vnode attributes.
Call down to a filesystem to create a symbolic link.
Call down to a filesystem to enumerate directory entries.
Call down to get file attributes for many files in a directory at once.
Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped.
Create a named stream associated with a file.
Call down to a filesystem to create a hardlink to a file.
Call down to a filesystem to atomically exchange the data of two files.
Call down to a filesystem to create a directory.
Write data from a mapped file back to disk.
Call down to a filesystem to get vnode attributes.
Associate a MACF label with a file.
Call down to a filesystem to get information about the on-disk layout of a file region.
Call down to a filesystem to delete a directory.
Call down to a filesystem to create a regular file (VREG).
vnop_access_args |
Call down to a filesystem to close a file.
struct vnop_access_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_action; vfs_context_t a_context; };
vpFile to close.
fflagFREAD and/or FWRITE; in the case of a file opened with open(2), fflag corresponds to how the file was opened.
ctxContext against which to authenticate close.
The close vnop gives a filesystem a chance to release state set up by a VNOP_OPEN(). VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN().
vnop_advlock_args |
Query a filesystem for path properties.
struct vnop_advlock_args { struct vnodeop_desc *a_desc; vnode_t a_vp; caddr_t a_id; int a_op; struct flock *a_fl; int a_flags; vfs_context_t a_context; };
vpThe vnode whose filesystem to query.
nameWhich property to request: see unistd.h. For example: _PC_CASE_SENSITIVE (is a filesystem case-sensitive?). Only one property can be requested at a time.
retvalDestination for value of property.
ctxContext to authenticate for pathconf request.
vnop_allocate_args |
Aquire or release and advisory lock on a vnode.
struct vnop_allocate_args { struct vnodeop_desc *a_desc; vnode_t a_vp; off_t a_length; u_int32_t a_flags; off_t *a_bytesallocated; off_t a_offset; vfs_context_t a_context; };
vpThe vnode to lock or unlock.
idIdentifier for lock holder: ignored by most filesystems.
opWhich locking operation: F_SETLK: set locking information about a region. F_GETLK: get locking information about the specified region. F_UNLCK: Unlock a region.
flDescription of file region to lock. l_whence is as with "lseek." Includes a type: F_RDLCK (shared lock), F_UNLCK (unlock) , and F_WRLCK (exclusive lock).
flagsF_FLOCK: use flock() semantics. F_POSIX: use POSIX semantics. F_WAIT: sleep if necessary. F_PROV: Non-coelesced provisional lock (unused in xnu).
ctxContext to authenticate for advisory locking request.
Advisory locking is somewhat complicated. VNOP_ADVLOCK is overloaded for both flock() and POSIX advisory locking usage, though not all filesystems support both (or any). VFS provides an advisory locking mechanism for filesystems which can take advantage of it; vfs_setlocklocal() marks a filesystem as using VFS advisory locking support.
vnop_blktooff_args |
List extended attribute keys.
struct vnop_blktooff_args { struct vnodeop_desc *a_desc; vnode_t a_vp; daddr64_t a_lblkno; off_t *a_offset; };
vpThe vnode for which to get extended attribute keys.
uioDescription of target memory for attribute keys.
sizeShould be set to amount of data written to buffer.
optionsXATTR_NOSECURITY: bypass security checking.
ctxContext to authenticate for attribute name request.
Should write a sequence of unseparated, null-terminated extended-attribute names into the space described by the provided uio. These keys can then be passed to getxattr() (and VNOP_GETXATTR()).
vnop_blockmap_args |
Call down to a filesystem to convert a file offset to a logical block number.
struct vnop_blockmap_args { struct vnodeop_desc *a_desc; vnode_t a_vp; off_t a_foffset; size_t a_size; daddr64_t *a_bpn; size_t *a_run; void *a_poff; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to convert an offset to a logical block number.
offsetFile offset to convert.
lblknoDestination for corresponding logical block number.
vnop_close_args |
Call down to a filesystem to open a file.
struct vnop_close_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_fflag; vfs_context_t a_context; };
vpFile to open.
modeFREAD and/or FWRITE.
ctxContext against which to authenticate open.
The open vnop gives a filesystem a chance to initialize a file for operations like reading, writing, and ioctls. VFS promises to send down exactly one VNOP_CLOSE() for each VNOP_OPEN().
vnop_copyfile_args |
Write data from a mapped file back to disk.
See Also:struct vnop_copyfile_args { struct vnodeop_desc *a_desc; vnode_t a_fvp; vnode_t a_tdvp; vnode_t a_tvp; struct componentname *a_tcnp; int a_mode; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to page out data.
plUPL describing pages needing to be paged out.
pl_offsetOffset in UPL from which to start paging out data.
f_offsetOffset in file of data needing to be paged out.
sizeAmount of data to page out (in bytes).
flagsUPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. Filesystems should generally leave it to the cluster layer to handle these flags. See the memory_object_types.h header in the kernel framework if interested.
ctxContext to authenticate for pageout request.
VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either because of an msync() call or due to memory pressure. Filesystems are for the most part expected to just call cluster_pageout().
vnop_create_args |
Call down to a filesystem to look for a directory entry by name.
struct vnop_create_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; vnode_t *a_vpp; struct componentname *a_cnp; struct vnode_attr *a_vap; vfs_context_t a_context; };
dvpDirectory in which to look up file.
vppDestination for found vnode.
cnpStructure describing filename to find, reason for lookup, and various other data.
ctxContext against which to authenticate lookup request.
VNOP_LOOKUP is the key pathway through which VFS asks a filesystem to find a file. The vnode should be returned with an iocount to be dropped by the caller. A VNOP_LOOKUP() calldown can come without a preceding VNOP_OPEN().
vnop_exchange_args |
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.
struct vnop_exchange_args { struct vnodeop_desc *a_desc; vnode_t a_fvp; vnode_t a_tvp; int a_options; vfs_context_t a_context; };
vpThe vnode to check for I/O readiness.
whichWhat kind of I/O is desired: FREAD, FWRITE.
fflagsFlags from fileglob as seen in fcntl.h, e.g. O_NONBLOCK, O_APPEND.
wqlOpaque object to pass to selrecord().
ctxContext to authenticate for select request.
In general, regular are always "ready for I/O" and their select vnops simply return "1." Devices, though, may or may not be read; they keep track of who is selecting on them and send notifications when they become ready. xnu provides structures and routines for tracking threads waiting for I/O and waking up those threads: see selrecord(), selthreadclear(), seltrue(), selwait(), selwakeup(), and the selinfo structure (sys/select.h).
vnop_fsync_args |
Inform a filesystem that a file is no longer mapped.
struct vnop_fsync_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_waitfor; vfs_context_t a_context; };
vpThe vnode which is no longer mapped.
ctxContext to authenticate for mnomap request.
In general, no action is required of a filesystem for VNOP_MNOMAP.
vnop_getattr_args |
Call down to a filesystem to see if a kauth-style operation is permitted.
struct vnop_getattr_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct vnode_attr *a_vap; vfs_context_t a_context; };
vpFile to authorize action for.
actionkauth-style action to be checked for permissions, e.g. KAUTH_VNODE_DELETE.
ctxContext against which to authenticate action.
VNOP_ACCESS is currently only called on filesystems which mark themselves as doing their authentication remotely (vfs_setauthopaque(), vfs_authopaque()). A VNOP_ACCESS() calldown may come without any preceding VNOP_OPEN().
vnop_getnamedstream_args |
Associate a MACF label with a file.
See Also:struct vnop_getnamedstream_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vnode_t *a_svpp; const char *a_name; enum nsoperation a_operation; int a_flags; vfs_context_t a_context; };
vpThe vnode to label.
labelThe desired label.
ctxContext to authenticate for label change.
vnop_getxattr_args |
Write data from a mapped file back to disk.
See Also:struct vnop_getxattr_args { struct vnodeop_desc *a_desc; vnode_t a_vp; const char * a_name; uio_t a_uio; size_t *a_size; int a_options; vfs_context_t a_context; };
vpThe vnode for which to page out data.
plUPL describing pages needing to be paged out.
pl_offsetOffset in UPL from which to start paging out data.
f_offsetOffset in file of data needing to be paged out.
sizeAmount of data to page out (in bytes).
flagsUPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. Filesystems should generally leave it to the cluster layer to handle these flags. See the memory_object_types.h header in the kernel framework if interested.
ctxContext to authenticate for pageout request.
VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either because of an msync() call or due to memory pressure. Filesystems are for the most part expected to just call cluster_pageout().
vnop_inactive_args |
Call down to a filesystem to get the pathname represented by a symbolic link.
struct vnop_inactive_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vfs_context_t a_context; };
vpSymbolic link to read from.
uioDestination information for link path.
ctxContext to authenticate for readlink request.
VNOP_READLINK() gets the path stored in a symbolic link; it is called by namei() and the readlink() system call.
vnop_link_args |
Call down to a filesystem to delete a file.
struct vnop_link_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vnode_t a_tdvp; struct componentname *a_cnp; vfs_context_t a_context; };
dvpDirectory in which to delete a file.
vpThe file to delete.
cnpFilename information.
ctxContext to authenticate for fsync request.
VNOP_REMOVE is called to remove a file from a filesystem's namespace, for example by unlink(). It can operate on regular files, named pipes, special files, and in some cases on directories.
vnop_listxattr_args |
Remove extended file attributes.
See Also:struct vnop_listxattr_args { struct vnodeop_desc *a_desc; vnode_t a_vp; uio_t a_uio; size_t *a_size; int a_options; vfs_context_t a_context; };
vpThe vnode from which to remove extended attributes.
nameWhich attribute to delete.
optionsXATTR_NOSECURITY: bypass security-checking.
ctxContext to authenticate for attribute delete request.
vnop_makenamedstream_args |
Get a named stream associated with a file.
struct vnop_makenamedstream_args { struct vnodeop_desc *a_desc; vnode_t *a_svpp; vnode_t a_vp; const char *a_name; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to get a named stream.
svppDestination for pointer to named stream's vnode.
nameThe name of the named stream, e.g. "com.apple.ResourceFork".
operationOperation to perform. In HFS and AFP, this parameter is only considered as follows: if the resource fork has not been opened and the operation is not NS_OPEN, fail with ENOATTR. Currently only passed as NS_OPEN by VFS.
flagsCurrently unused.
ctxContext to authenticate for getting named stream.
If this call sucecss, svpp should be returned with an iocount which the caller will drop. VFS provides a facility for simulating named streams when interacting with filesystems which do not support them.
vnop_mkdir_args |
Call down to a filesystem to rename a file.
struct vnop_mkdir_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; vnode_t *a_vpp; struct componentname *a_cnp; struct vnode_attr *a_vap; vfs_context_t a_context; };
fdvpDirectory in which source file resides.
fvpFile being renamed.
fcnpName information for source file.
tdvpDirectory file is being moved to.
tvpExisting file with same name as target, should one exist.
tcnpName information for target path.
ctxContext to authenticate for rename request.
VNOP_RENAME() will only be called with a source and target on the same volume.
vnop_mknod_args |
Call down to a filesystem to create a whiteout.
struct vnop_mknod_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; vnode_t *a_vpp; struct componentname *a_cnp; struct vnode_attr *a_vap; vfs_context_t a_context; };
dvpDirectory in which to create.
cnpName information for whiteout.
flagsCREATE: create a whiteout. LOOKUP: check whether a directory supports whiteouts, DELETE: remove a whiteout.
ctxContext against which to authenticate whiteout creation.
Whiteouts are used to support the union filesystem, whereby one filesystem is mounted "transparently" on top of another. A whiteout in the upper layer of a union mount is a "deletion" of a file in the lower layer; lookups will catch the whiteout and fail, setting ISWHITEOUT in the componentname structure, even if an underlying file of the same name exists. The whiteout vnop is used for creation, deletion, and checking whether a directory supports whiteouts (see flags). also support the LOOKUP flag, which is used to test whether a directory supports whiteouts.
vnop_mmap_args |
Call down to a filesystem to invalidate all open file descriptors for a vnode.
struct vnop_mmap_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_fflags; vfs_context_t a_context; };
vpThe vnode to revoke.
flagsUnused.
ctxContext to authenticate for revoke request.
This function is typically called as part of a TTY revoke, but can also be used on regular files. Most filesystems simply use nop_revoke(), which calls vn_revoke(), as their revoke vnop implementation.
vnop_mnomap_args |
Notify a filesystem that a file is being mmap-ed.
struct vnop_mnomap_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vfs_context_t a_context; };
vpThe vnode being mmapped.
flagsMemory protection: PROT_READ, PROT_WRITE, PROT_EXEC.
ctxContext to authenticate for mmap request.
VNOP_MMAP is an advisory calldown to say that the system is mmap-ing a file.
vnop_offtoblk_args |
Call down to a filesystem to convert a logical block number to a file offset.
struct vnop_offtoblk_args { struct vnodeop_desc *a_desc; vnode_t a_vp; off_t a_offset; daddr64_t *a_lblkno; };
vpThe vnode for which to convert a logical block to an offset.
lblknoLogical block number to turn into offset.
offsetDestination for file offset.
VNOP_BLKTOOFF() converts a logical block to a file offset in bytes. That offset can be passed to VNOP_BLOCKMAP(), then, to get a physical block number--buf_strategy() does this.
vnop_open_args |
Call down to a filesystem to create a special file.
struct vnop_open_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_mode; vfs_context_t a_context; };
dvpDirectory in which to create the special file.
vppDestination for newly created vnode.
cnpName information for new file.
vapAttributes for new file, including type.
ctxContext against which to authenticate node creation.
The mknod vnop is used to create character and block device files, named pipe (FIFO) files, and named sockets. The newly created file should be returned with an iocount which will be dropped by the caller. A VNOP_MKNOD() call can come down without a preceding VNOP_OPEN().
vnop_pagein_args |
Pre-allocate space for a file.
struct vnop_pagein_args { struct vnodeop_desc *a_desc; vnode_t a_vp; upl_t a_pl; upl_offset_t a_pl_offset; off_t a_f_offset; size_t a_size; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to preallocate space.
lengthDesired preallocated file length.
flagsPREALLOCATE: preallocate allocation blocks. ALLOCATECONTIG: allocate contigious space. ALLOCATEALL: allocate all requested space or no space at all. FREEREMAINDER: deallocate allocated but unfilled blocks. ALLOCATEFROMPEOF: allocate from the physical eof. ALLOCATEFROMVOL: allocate from the volume offset.
bytesallocatedAdditional bytes set aside for file. Set to 0 if none are allocated OR if the file is contracted.
offsetHint for where to find free blocks.
ctxContext to authenticate for allocation request.
VNOP_ALLOCATE() changes the amount of backing store set aside to a file. It can be used to either shrink or grow a file. If the file shrinks, its ubc size will be modified accordingly, but if it grows, then the ubc size is unchanged; space is set aside without being actively used by the file. VNOP_ALLOCATE() is currently only called as part of the F_PREALLOCATE fcntl, and is supported only by AFP and HFS.
vnop_pageout_args |
Pull file data into memory.
struct vnop_pageout_args { struct vnodeop_desc *a_desc; vnode_t a_vp; upl_t a_pl; upl_offset_t a_pl_offset; off_t a_f_offset; size_t a_size; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to page in data.
plUPL describing pages needing to be paged in.
pl_offsetOffset in UPL at which to start placing data.
f_offsetOffset in file of data needing to be paged in.
sizeAmount of data to page in (in bytes).
flagsUPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. Filesystems should generally leave it to the cluster layer to handle these flags. See the memory_object_types.h header in the kernel framework if interested.
ctxContext to authenticate for pagein request.
VNOP_PAGEIN() is called by when a process faults on data mapped from a file or when madvise() demands pre-fetching. It is conceptually somewhat similar to VNOP_READ(). Filesystems are typically expected to call cluster_pagein() to handle the labor of mapping and committing the UPL.
vnop_pathconf_args |
Release filesystem-internal resources for a vnode.
struct vnop_pathconf_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_name; int32_t *a_retval; vfs_context_t a_context; };
vpThe vnode to reclaim.
ctxContext to authenticate for reclaim.
VNOP_RECLAIM() is called as part of the process of recycling a vnode. During a reclaim routine, a filesystem should remove a vnode from its hash and deallocate any resources allocated to that vnode. VFS guarantees that when VNOP_RECLAIM() is called, there are no more iocount references on a vnode (though there may still be usecount references--these are invalidated by the reclaim) and that no more will be granted. This means in practice that there will be no filesystem calls on the vnode being reclaimed until the reclaim has finished and the vnode has been reused.
vnop_read_args |
Call down to a filesystem to set vnode attributes.
struct vnop_read_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct uio *a_uio; int a_ioflag; vfs_context_t a_context; };
vpThe vnode whose attributes to set.
vapContainer for which attributes are to be set and their desired values, as well as for the filesystem to return information about which attributes were successfully set.
ctxContext against which to authenticate request for attribute change.
Supported attributes ("Yes, I am setting this attribute.") are set with VATTR_SET_SUPPORTED. Requested attributes are checked with VATTR_IS_ACTIVE. Attribute values are accessed directly through structure fields. VNOP_SETATTR() is the core of the KPI function vnode_setattr(), which is used by chmod(), chown(), truncate(), and many others. A VNOP_SETATTR() call may come without any preceding VNOP_OPEN().
vnop_readdir_args |
Call down to a filesystem to create a symbolic link.
/* * * When VNOP_READDIR is called from the NFS Server, the nfs_data * argument is non-NULL. * * The value of nfs_eofflag should be set to TRUE if the end of * the directory was reached while reading. * * The directory seek offset (cookies) are returned to the NFS client and * may be used later to restart a directory read part way through * the directory. There is one cookie returned for each directory * entry returned and its size is determince from nfs_sizeofcookie. * The value of the cookie should be the logical offset within the * directory where the on-disc version of the appropriate directory * entry starts. Memory for the cookies is allocated from M_TEMP * and it is freed by the caller of VNOP_READDIR. * */ struct vnop_readdir_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct uio *a_uio; int a_flags; int *a_eofflag; int *a_numdirent; vfs_context_t a_context; };
IfVNOP_SYMLINK() is successful, the new file should be returned with an iocount which will be dropped by the caller. VFS does not ensure that the target path will have a length shorter than the max symlink length for the filesystem.
dvpParent directory for new symlink file.
vppcnpName information for new symlink.
vapAttributes for symlink.
targetPath for symlink to store; for "ln -s /var/vardir linktovardir", "target" would be "/var/vardir"
ctxContext to authenticate for symlink request.
vnop_readdirattr_args |
Call down to a filesystem to enumerate directory entries.
struct vnop_readdirattr_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct attrlist *a_alist; struct uio *a_uio; uint32_t a_maxcount; uint32_t a_options; uint32_t *a_newstate; int *a_eofflag; uint32_t *a_actualcount; vfs_context_t a_context; };
vpDirectory to enumerate.
uioDestination information for resulting direntries.
flagsVNODE_READDIR_EXTENDED, VNODE_READDIR_REQSEEKOFF, VNODE_READDIR_SEEKOFF32: Apple-internal flags.
eofflagShould be set to 1 if the end of the directory has been reached.
numdirentShould be set to number of entries written into buffer.
ctxContext to authenticate for readdir request.
VNOP_READDIR() packs a buffer with "struct dirent" directory entry representations as described by the "getdirentries" manual page.
vnop_readlink_args |
Call down to get file attributes for many files in a directory at once.
struct vnop_readlink_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct uio *a_uio; vfs_context_t a_context; };
vpDirectory in which to enumerate entries' attributes.
alistWhich attributes are wanted for each directory entry.
uioDestination information for resulting attributes.
maxcountMaximum count of files to get attributes for.
optionsFSOPT_NOFOLLOW: do not follow symbolic links. FSOPT_NOINMEMUPDATE: do not use data which have been updated since an inode was loaded into memory.
newstateThe "newstate" should be set to a value which changes if the contents of a directory change through an addition or deletion but stays the same otherwise.
eofflagShould be set to 1 if the end of the directory has been reached.
actualcountShould be set to number of files whose attributes were written into buffer.
ctxContext to authenticate for readdirattr request.
VNOP_READDIRATTR() packs a buffer with file attributes, as if the results of many "getattrlist" calls.
vnop_reclaim_args |
Notify a filesystem that the last usecount (persistent reference) on a vnode has been dropped.
struct vnop_reclaim_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vfs_context_t a_context; };
vpThe vnode which is now inactive.
ctxContext to authenticate for inactive message.
VNOP_INACTVE() gives a filesystem a chance to aggressively release resources assocated with a vnode, perhaps even to call vnode_recycle(), but no action is prescribed; it is acceptable for VNOP_INACTIVE to be a no-op and to defer all reclamation until VNOP_RECLAIM(). VNOP_INACTVE() will not be called on a vnode if no persistent reference is ever taken; an important example is a stat(), which takes an iocount, reads its data, and drops that iocount.
vnop_removenamedstream_args |
Create a named stream associated with a file.
struct vnop_removenamedstream_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vnode_t a_svp; const char *a_name; int a_flags; vfs_context_t a_context; };
vpThe vnode for which to get a named stream.
svppDestination for pointer to named stream's vnode.
nameThe name of the named stream, e.g. "com.apple.ResourceFork".
flagsCurrently unused.
ctxContext to authenticate creating named stream.
If this call succeeds, svpp should be returned with an iocount which the caller will drop. VFS provides a facility for simulating named streams when interacting with filesystems which do not support them.
vnop_rename_args |
Call down to a filesystem to create a hardlink to a file.
struct vnop_rename_args { struct vnodeop_desc *a_desc; vnode_t a_fdvp; vnode_t a_fvp; struct componentname *a_fcnp; vnode_t a_tdvp; vnode_t a_tvp; struct componentname *a_tcnp; vfs_context_t a_context; };
vpFile to link to.
dvpDirectory in which to create the link.
cnpFilename information for new link.
ctxContext to authenticate for link request.
See "man 2 link".
vnop_revoke_args |
Call down to a filesystem to atomically exchange the data of two files.
struct vnop_revoke_args { struct vnodeop_desc *a_desc; vnode_t a_vp; int a_flags; vfs_context_t a_context; };
fvpFirst vnode.
tvpSecond vnode.
optionsUnused.
ctxContext to authenticate for exchangedata request.
VNOP_EXCHANGE() is currently only called by the exchangedata() system call. It will only be applied to files on the same volume.
vnop_rmdir_args |
Call down to a filesystem to create a directory.
struct vnop_rmdir_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; vnode_t a_vp; struct componentname *a_cnp; vfs_context_t a_context; };
dvpDirectory in which to create new directory.
vppDestination for pointer to new directory's vnode.
cnpName information for new directory.
vapAttributes for new directory.
ctxContext to authenticate for mkdir request.
The newly created directory should be returned with an iocount which will be dropped by the caller.
vnop_searchfs_args |
Write data from a mapped file back to disk.
See Also:struct vnop_searchfs_args { struct vnodeop_desc *a_desc; vnode_t a_vp; void *a_searchparams1; void *a_searchparams2; struct attrlist *a_searchattrs; uint32_t a_maxmatches; struct timeval *a_timelimit; struct attrlist *a_returnattrs; uint32_t *a_nummatches; uint32_t a_scriptcode; uint32_t a_options; struct uio *a_uio; struct searchstate *a_searchstate; vfs_context_t a_context; };
vpThe vnode for which to page out data.
plUPL describing pages needing to be paged out.
pl_offsetOffset in UPL from which to start paging out data.
f_offsetOffset in file of data needing to be paged out.
sizeAmount of data to page out (in bytes).
flagsUPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. Filesystems should generally leave it to the cluster layer to handle these flags. See the memory_object_types.h header in the kernel framework if interested.
ctxContext to authenticate for pageout request.
VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either because of an msync() call or due to memory pressure. Filesystems are for the most part expected to just call cluster_pageout().
vnop_setattr_args |
Call down to a filesystem to get vnode attributes.
struct vnop_setattr_args { struct vnodeop_desc *a_desc; vnode_t a_vp; struct vnode_attr *a_vap; vfs_context_t a_context; };
vpThe vnode whose attributes to get.
vapContainer for which attributes are requested, which attributes are supported by the filesystem, and attribute values.
ctxContext against which to authenticate request for attributes.
Supported attributes ("Yes, I am returning this information") are set with VATTR_SET_SUPPORTED. Which attributes have been requested is checked with VATTR_IS_ACTIVE. Attributes are returned with VATTR_RETURN. It is through VNOP_GETATTR that routines like stat() get their information. A VNOP_GETATTR() calldown may come without any preceding VNOP_OPEN().
VNOP_SETLABEL |
Associate a MACF label with a file.
See Also:struct vnop_getnamedstream_args { struct vnodeop_desc *a_desc; vnode_t a_vp; vnode_t *a_svpp; const char *a_name; enum nsoperation a_operation; int a_flags; vfs_context_t a_context; };
vpThe vnode to label.
labelThe desired label.
ctxContext to authenticate for label change.
vnop_strategy_args |
Call down to a filesystem to get information about the on-disk layout of a file region.
struct vnop_strategy_args { struct vnodeop_desc *a_desc; struct buf *a_bp; };
vpThe vnode for which to get on-disk information.
foffsetOffset (in bytes) at which region starts.
sizeSize of region.
bpnDestination for physical block number at which region begins on disk.
runDestination for number of bytes which can be found contiguously on-disk before first discontinuity.
poffCurrently unused.
flagsVNODE_READ: request is for a read. VNODE_WRITE: request is for a write.
ctxContext to authenticate for blockmap request; currently often set to NULL.
VNOP_BLOCKMAP() returns the information required to pass a request for a contiguous region down to a device's strategy routine.
vnop_symlink_args |
Call down to a filesystem to delete a directory.
struct vnop_symlink_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; vnode_t *a_vpp; struct componentname *a_cnp; struct vnode_attr *a_vap; char *a_target; vfs_context_t a_context; };
dvpParent of directory to be removed.
vpDirectory to remove.
cnpName information for directory to be deleted.
ctxContext to authenticate for rmdir request.
vnop_whiteout_args |
Call down to a filesystem to create a regular file (VREG).
struct vnop_whiteout_args { struct vnodeop_desc *a_desc; vnode_t a_dvp; struct componentname *a_cnp; int a_flags; vfs_context_t a_context; };
dvpDirectory in which to create file.
vppDestination for vnode for newly created file.
cnpDescription of filename to create.
vapFile creation properties, as seen in vnode_getattr(). Manipulated with VATTR_ISACTIVE, VATTR_RETURN, VATTR_SET_SUPPORTED, and so forth.
ctxContext against which to authenticate file creation.
If file creation succeeds, "vpp" should be returned with an iocount to be dropped by the caller. A VNOP_CREATE() calldown can come without a preceding VNOP_OPEN().
Write data from a mapped file back to disk.
Remove extended file attributes.
vnop_getxattr_desc |
Write data from a mapped file back to disk.
See Also:extern struct vnodeop_desc vnop_getxattr_desc;
vpThe vnode for which to page out data.
plUPL describing pages needing to be paged out.
pl_offsetOffset in UPL from which to start paging out data.
f_offsetOffset in file of data needing to be paged out.
sizeAmount of data to page out (in bytes).
flagsUPL-style flags: UPL_IOSYNC, UPL_NOCOMMIT, UPL_NORDAHEAD, UPL_VNODE_PAGER, UPL_MSYNC. Filesystems should generally leave it to the cluster layer to handle these flags. See the memory_object_types.h header in the kernel framework if interested.
ctxContext to authenticate for pageout request.
VNOP_PAGEOUT() is called when data from a mapped file needs to be flushed to disk, either because of an msync() call or due to memory pressure. Filesystems are for the most part expected to just call cluster_pageout().
vnop_listxattr_desc |
Remove extended file attributes.
See Also:extern struct vnodeop_desc vnop_listxattr_desc;
vpThe vnode from which to remove extended attributes.
nameWhich attribute to delete.
optionsXATTR_NOSECURITY: bypass security-checking.
ctxContext to authenticate for attribute delete request.
Associate a MACF label with a file.
Associate a MACF label with a file.
nsoperation |
Associate a MACF label with a file.
See Also:enum nsoperation { NS_OPEN, NS_CREATE, NS_DELETE };
VNOP_SETLABEL |
Associate a MACF label with a file.
See Also:enum nsoperation { NS_OPEN, NS_CREATE, NS_DELETE };
Last Updated: 2009-10-14