int
VOP_LOOKUP(
struct vnode *dvp
, struct vnode **vpp
, struct componentname *cnp
)
int
VOP_CREATE(
struct vnode *dvp
, struct vnode **vpp
, struct componentname *cnp
, struct vattr *vap
)
int
VOP_MKNOD(
struct vnode *dvp
, struct vnode **vpp
, struct componentname *cnp
, struct vattr *vap
)
int
VOP_OPEN(
struct vnode *vp
, int mode
, kauth_cred_t cred
)
int
VOP_CLOSE(
struct vnode *vp
, int fflag
, kauth_cred_t cred
)
int
VOP_ACCESS(
struct vnode *vp
, int mode
, kauth_cred_t cred
)
int
VOP_GETATTR(
struct vnode *vp
, struct vattr *vap
, kauth_cred_t cred
)
int
VOP_SETATTR(
struct vnode *vp
, struct vattr *vap
, kauth_cred_t cred
)
int
VOP_READ(
struct vnode *vp
, struct uio *uio
, int ioflag
, kauth_cred_t cred
)
int
VOP_WRITE(
struct vnode *vp
, struct uio *uio
, int ioflag
, kauth_cred_t cred
)
int
VOP_IOCTL(
struct vnode *vp
, u_long command
, void *data
, int fflag
, kauth_cred_t cred
)
int
VOP_FCNTL(
struct vnode *vp
, u_int command
, void *data
, int fflag
, kauth_cred_t cred
)
int
VOP_POLL(
struct vnode *vp
, int events
)
int
VOP_KQFILTER(
struct vnode *vp
, struct knote *kn
)
int
VOP_REVOKE(
struct vnode *vp
, int flags
)
int
VOP_MMAP(
struct vnode *vp
, vm_prot_t prot
, kauth_cred_t cred
)
int
VOP_FSYNC(
struct vnode *vp
, kauth_cred_t cred
, int flags
, off_t offlo
, off_t offhi
)
int
VOP_SEEK(
struct vnode *vp
, off_t oldoff
, off_t newoff
, kauth_cred_t cred
)
int
VOP_REMOVE(
struct vnode *vp
, struct vnode *vp
, struct componentname *cnp
)
int
VOP_LINK(
struct vnode *dvp
, struct vnode *vp
, struct componentname *cnp
)
int
VOP_RENAME(
struct vnode *fdvp
, struct vnode *fvp
, struct componentname *fcnp
, struct vnode *tdvp
, struct vnode *tvp
, struct componentname *tcnp
)
int
VOP_MKDIR(
struct vnode *dvp
, struct vnode **vpp
, struct componentname *cnp
, struct vattr *vap
)
int
VOP_RMDIR(
struct vnode *dvp
, struct vnode *vp
, struct componentname *cnp
)
int
VOP_SYMLINK(
struct vnode *dvp
, struct vnode **vpp
, struct componentname *cnp
, struct vattr *vap
, char *target
)
int
VOP_READDIR(
struct vnode *vp
, struct uio *uio
, kauth_cred_t cred
, int *eofflag
, off_t **cookies
, int *ncookies
)
int
VOP_READLINK(
struct vnode *vp
, struct uio *uio
, kauth_cred_t cred
)
int
VOP_ABORTOP(
struct vnode *dvp
, struct componentname *cnp
)
int
VOP_INACTIVE(
struct vnode *vp
)
int
VOP_RECLAIM(
struct vnode *vp
)
int
VOP_LOCK(
struct vnode *vp
, int flags
)
int
VOP_UNLOCK(
struct vnode *vp
, int flags
)
int
VOP_ISLOCKED(
struct vnode *vp
)
int
VOP_BMAP(
struct vnode *vp
, daddr_t bn
, struct vnode **vpp
, daddr_t *bnp
, int *runp
)
int
VOP_PRINT(
struct vnode *vp
)
int
VOP_PATHCONF(
struct vnode *vp
, int name
, register_t *retval
)
int
VOP_ADVLOCK(
struct vnode *vp
, void *id
, int op
, struct flock *fl
, int flags
)
int
VOP_LEASE(
struct vnode *vp
, kauth_cred_t cred
, int flag
)
int
VOP_WHITEOUT(
struct vnode *dvp
, struct componentname *cnp
, int flags
)
int
VOP_GETPAGES(
struct vnode *vp
, voff_t offset
, struct vm_page **m
, int *count
, int centeridx
, vm_prot_t access_type
, int advice
, int flags
)
int
VOP_PUTPAGES(
struct vnode *vp
, voff_t offlo
, voff_t offhi
, int flags
)
int
VOP_STRATEGY(
struct vnode *vp
, struct buf *bp
)
int
VOP_BWRITE(
struct buf *bp
)
int
VOP_GETEXTATTR(
struct vnode *vp
, int attrnamespace
, const char *name
, struct uio *uio
, size_t *size
, kauth_cred_t cred
)
int
VOP_SETEXTATTR(
struct vnode *vp
, int attrnamespace
, const char *name
, struct uio *uio
, kauth_cred_t cred
)
int
VOP_LISTEXTATTR(
struct vnode *vp
, int attrnamespace
, struct uio *uio
, size_t *size
, kauth_cred_t cred
)
Not all header files are required for each function.
Functions in the vnode operations vector are invoked using specialized macros. The following table lists the elements of the vnode operations vector, the corresponding invocation macro, and a description of the element.
_V_e_c_t_o_r _e_l_e_m_e_n_t _M_a_c_r_o _D_e_s_c_r_i_p_t_i_o_n
int (*vop_lookup)() VOP_LOOKUP Lookup file name in name cache int (*vop_create)() VOP_CREATE Create a new file int (*vop_mknod)() VOP_MKNOD Make a new device int (*vop_open)() VOP_OPEN Open a file int (*vop_close)() VOP_CLOSE Close a file int (*vop_access)() VOP_ACCESS Determine file accessibility int (*vop_getattr)() VOP_GETATTR Get file attributes int (*vop_setattr)() VOP_SETATTR Set file attributes int (*vop_read)() VOP_READ Read from a file int (*vop_write)() VOP_WRITE Write to a file int (*vop_ioctl)() VOP_IOCTL Perform device-specific I/O int (*vop_fcntl)() VOP_FCNTL Perform file control int (*vop_poll)() VOP_POLL Test if poll event has occurred int (*vop_kqfilter)() VOP_KQFILTER Register a knote int (*vop_revoke)() VOP_REVOKE Eliminate vode activity int (*vop_mmap)() VOP_MMAP Map file into user address space int (*vop_fsync)() VOP_FSYNC Flush pending data to disk int (*vop_seek)() VOP_SEEK Test if file is seekable int (*vop_remove)() VOP_REMOVE Remove a file int (*vop_link)() VOP_LINK Link a file int (*vop_rename)() VOP_RENAME Rename a file int (*vop_mkdir)() VOP_MKDIR Make a new directory int (*vop_rmdir)() VOP_RMDIR Remove a directory int (*vop_symlink)() VOP_SYMLINK Create a symbolic link int (*vop_readdir)() VOP_READDIR Read directory entry int (*vop_readlink)() VOP_READLINK Read contents of a symlink int (*vop_abortop)() VOP_ABORTOP Abort pending operation int (*vop_inactive)() VOP_INACTIVE Release the inactive vnode int (*vop_reclaim)() VOP_RECLAIM Reclaim vnode for another file int (*vop_lock)() VOP_LOCK Sleep until vnode lock is free int (*vop_unlock)() VOP_UNLOCK Wake up process sleeping on lock int (*vop_islocked)() VOP_ISLOCKED Test if vnode is locked int (*vop_bmap)() VOP_BMAP Logical block number conversion int (*vop_print)() VOP_PRINT Print debugging information int (*vop_pathconf)() VOP_PATHCONF Return POSIX pathconf data int (*vop_advlock)() VOP_ADVLOCK Advisory record locking int (*vop_lease)() VOP_LEASE Validate vnode credentials int (*vop_whiteout)() VOP_WHITEOUT Whiteout vnode int (*vop_getpages)() VOP_GETPAGES Read VM pages from file int (*vop_putpages)() VOP_PUTPAGES Write VM pages to file int (*vop_strategy)() VOP_STRATEGY Read/write a file system buffer int (*vop_bwrite)() VOP_BWRITE Write a file system buffer int (*vop_getextattr)() VOP_GETEXTATTR Get extended attribute int (*vop_setextattr)() VOP_SETEXTATTR Set extended attribute int (*vop_listextattr)() VOP_LISTEXTATTR List extended attributes
The implementation details of the vnode operations vector are not quite what is described here.
If the file system type does not support a specific operation, it must nevertheless assign an appropriate function in the vnode operations vector to do the minimum required of it. In most cases, such functions either do nothing or return an error value to the effect that it is not supported.
Many of the functions in the vnode operations vector take a
componentname structure.
It is used to encapsulate many parameters into a single function
argument.
It has the following structure:
struct componentname {
/*
* Arguments to lookup.
*/
uint32_t cn_nameiop; /* namei operation */
uint32_t cn_flags; /* flags to namei */
kauth_cred_t cn_cred; /* credentials */
/*
* Shared between lookup and commit routines.
*/
char *cn_pnbuf; /* pathname buffer */
const char *cn_nameptr; /* pointer to looked up name */
size_t cn_namelen; /* length of looked up component */
u_long cn_hash; /* hash value of looked up name */
size_t cn_consume; /* chars to consume in lookup() */
};
The top half of the structure is used exclusively for the pathname
lookups using
VOP_LOOKUP()
and is initialized by the caller.
The semantics of the lookup are affected by the lookup operation
specified in
cn_nameiop
and the flags specified in
cn_flags.
Valid operations are:
Valid values for cn->cn_flags are:
No vnode operations may be called from interrupt context. Most operations also require the vnode to be locked on entry. To prevent deadlocks, when acquiring locks on multiple vnodes, the lock of parent directory must be acquired before the lock on the child directory.
Vnode operations for a file system type generally should not be called directly from the kernel, but accessed indirectly through the high-level convenience functions discussed in vnsubr(9).
dvp
, vpp
, cnp
)
dvp
is the locked vnode of the directory to search and
cnp
is the pathname component to be searched for.
If the pathname component is found, the address of the resulting
locked vnode is returned in
vpp
.
The operation specified in
cnp->cn_nameiop
gives
VOP_LOOKUP(
)
hints about the reason for requesting the lookup and uses it to cache
file system type specific information in the vnode for subsequent
operations.
There are three types of lookups: ".", ".." (ISDOTDOT), and other.
If the pathname component being searched for is ".", then
dvp
has an extra reference added to it and it is returned in
*vpp
.
If the pathname component being search for is ".." (ISDOTDOT),
dvp
is unlocked, the ".." node is locked and then
dvp
is relocked.
This process preserves the protocol of always locking nodes from root
downward and prevents deadlock.
For other pathname components,
VOP_LOOKUP()
checks the accessibility of the directory and searches the name cache
for the pathname component.
See
namecache(9).
If the pathname is not found in the name cache, the directory is
searched for the pathname.
The resulting locked vnode is returned in
vpp
.
dvp
is always returned locked.
On failure
*vpp
is
NULL
,
and
*dvp
is left locked.
If the operation is successful
*vpp
is locked and zero is returned.
Typically, if
*vpp
and
dvp
are the same vnode the caller will need to release twice (decrement
the reference count) and unlock once.
dvp
, vpp
, cnp
, vap
)
dvp
is the locked vnode of the directory to create the new file in and
cnp
is the pathname component of the new file.
The argument
vap
specifies the attributes that the new file should be created with.
If the file is successfully created, the address of the resulting
locked vnode is returned in
vpp
and zero is returned.
Regardless of the return value, the directory vnode
dvp
will be unlocked on return.
This function is called after
VOP_LOOKUP()
when a file is being created.
Normally,
VOP_LOOKUP(
)
will have set the SAVENAME flag in
cnp->cn_flags
to keep the memory pointed to by
cnp->cn_pnbuf
valid.
If an error is detected when creating the file, this memory is
released.
If the file is created successfully it will be released unless the
SAVESTART flags in specified in
cnp->cn_flags.
dvp
, vpp
, cnp
, vap
)
dvp
is the locked vnode of the directory to create the new device-special
file in and
cnp
is the pathname component of the new device-special file.
The argument
vap
specifies the attributes that the new device-special file should be
created with.
If the file is successfully created, the address of the resulting
locked vnode is returned in
vpp
and zero is returned.
This function is called after
VOP_LOOKUP()
when a device-special file is being created.
Normally,
VOP_LOOKUP(
)
will have set the SAVENAME flag in
cnp->cn_flags
to keep the memory pointed to by
cnp->cn_pnbuf
valid.
If an error is detected when creating the device-special file,
this memory is released.
If the device-special file is created successfully it will be released
unless the SAVESTART flags in specified in
cnp->cn_flags.
vp
, mode
, cred
)
vp
is the vnode of the file to open and
mode
specifies the access mode required by the calling process.
The calling credentials are specified by
cred
.
The access mode is a set of flags, including FREAD, FWRITE,
O_NONBLOCK, O_APPEND, etc.
VOP_OPEN(
)
must be called before a file can be accessed by a thread.
The vnode reference count is incremented.
VOP_OPEN()
expects the vnode
vp
to be locked on entry and will leave it locked on return.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
vp
, fflag
, cred
)
vp
is the vnode of the file to close and
fflag
specifies the access mode by the calling process.
The possible flags are
FREAD
,
FWRITE
and
FNONBLOCK
.
The calling credentials are specified by
cred
.
VOP_CLOSE(
)
frees resources allocated by
VOP_OPEN(
).
The vnode
vp
will be locked on entry and should remain locked on return.
vp
, mode
, cred
)
vp
is the vnode of the file to check,
mode
is the type of access required and
cred
contains the user credentials to check.
The argument
mode
is a mask which can contain VREAD, VWRITE or VEXEC.
If the file is accessible in the specified way, zero is returned,
otherwise an appropriate error code is returned.
The vnode
vp
will be locked on entry and should remain locked on return.
vp
, vap
, cred
)
vp
is the vnode of the file to get the attributes for.
The argument
cred
specifies the calling credentials.
VOP_GETATTR(
)
uses the file system type specific data object
vp->v_data
to reference the underlying file attributes.
Attributes associated with the file are collected by setting the
required attribute bits in
vap->va_mask.
The attributes are returned in
vap
.
Attributes which are not available are set to the value VNOVAL.
For more information on vnode attributes see vattr(9).
vp
, vap
, cred
)
vp
is the locked vnode of the file to set the attributes for.
The argument
cred
specifies the calling credentials.
VOP_SETATTR(
)
uses the file system type specific data object
vp->v_data
to reference the underlying file attributes.
The new attributes are defined in
vap
.
Attributes associated with the file are set by setting the required
attribute bits in
vap->va_mask.
Attributes which are not being modified by
VOP_SETATTR(
)
should be set to the value VNOVAL.
If the operation is successful zero is returned, otherwise an
appropriate error is returned.
For more information on vnode attributes see vattr(9).
vp
, uio
, ioflag
, cred
)
vp
is the vnode of the file to read from,
uio
is the location to read the data into,
ioflag
is a set of flags and
cred
are the credentials of the calling process.
The
ioflag
argument is used to give directives and hints to the file system.
When attempting a read, the high 16 bits are used to provide a
read-ahead hint (in unit of file system blocks) that the file system
should attempt.
The low 16 bits are a bit mask which can contain the following flags:
Zero is returned on success, otherwise an error is returned. The vnode should be locked on entry and remains locked on exit.
vp
, uio
, ioflag
, cred
)
vp
is the vnode of the file to write to,
uio
is the location of the data to write,
ioflag
is a set of flags and
cred
are the credentials of the calling process.
The
ioflag
argument is used to give directives and hints to the file system.
The low 16 bits are a bit mask which can contain the same flags as
VOP_READ().
Zero is returned on success, otherwise an error is returned. The vnode should be locked on entry and remains locked on exit.
vp
, command
, data
, fflag
, cred
)
vp
is the locked vnode of the file, normally representing a device.
The argument
command
specifies the device-specific operation to perform and
cnp
provides extra data for the specified operation.
The argument
fflags
is a set of flags.
The argument
cred
is the caller's credentials.
If the operation is successful, zero is
returned, otherwise an appropriate error code is returned.
Most file systems do not supply a function for
VOP_IOCTL().
This function implements the
ioctl(2)
system call.
vp
, command
, data
, fflag
, cred
)
vp
is the locked vnode of the file.
The argument
command
specifies the operation to perform and
cnp
provides extra data for the specified operation.
The argument
fflags
is a set of flags.
The argument
cred
is the caller's credentials.
If the operation is successful, zero is returned, otherwise an
appropriate error code is returned.
vp
, events
)
vp
is the vnode of the file to poll.
It returns any events of interest as specified by
events
that may have occurred for the file.
The argument
events
is a set of flags as specified by
poll(2).
vp
, kn
)
kn
with the vnode
vn
.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
vp
, flags
)
vp
.
The argument
flags
is a set of flags.
If REVOKEALL is set in
flags
all vnodes aliased to the vnode
vp
are also eliminated.
If the operation is successful zero is returned, otherwise an
appropriate error is returned.
vp
, prot
, cred
)
vp
is in the process of being memory mapped.
The argument
prot
specifies the vm access protection the vnode is going to be mapped with.
The argument
cred
is the caller's credentials.
If the file system allows the memory mapping, zero is returned, otherwise
an appropriate error code is returned.
Most file systems do not supply a function for
VOP_MMAP()
and use
genfs_mmap(
)
to default for success.
Only file systems which do not integrate with the page cache at all
typically want to disallow memory mapping.
vp
, cred
, flags
, offlo
, offhi
)
vp
is the locked vnode of the file for flush.
The argument
cred
is the caller's credentials.
The argument
flags
is a set of flags.
If FSYNC_WAIT is specified in
flags
,
the function should wait for I/O to complete before returning.
The argument
offlo
and
offhi
specify the range of file to flush.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
This function implements the sync(2) and fsync(2) system calls.
vp
, oldoff
, newoff
, cred
)
newoff
.
The argument
vp
is the locked vnode of the file to test.
For most file systems this function simply tests if
newoff
is valid.
If the specified
newoff
is less than zero, the function returns error code EINVAL.
dvp
, vp
, cnp
)
dvp
is the locked vnode of the directory to remove the file from and
vp
is the locked vnode of the file to remove.
The argument
cnp
is the pathname component about the file to remove.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
Both
dvp
and
vp
are locked on entry and are to be unlocked before returning.
dvp
, vp
, cnp
)
dvp
is the locked node of the directory to create the new link and
vp
is the vnode of the file to be linked.
The argument
cnp
is the pathname component of the new link.
If the operation is successful zero is returned, otherwise an error
code is returned.
The directory vnode
dvp
should be locked on entry and will be released and unlocked on return.
The vnode
vp
should not be locked on entry and will remain unlocked on return.
fdvp
, fvp
, fcnp
, tdvp
, tvp
, tcnp
)
fdvp
is the vnode of the old parent directory containing in the file to be
renamed and
fvp
is the vnode of the file to be renamed.
The argument
fcnp
is the pathname component about the file to be renamed.
The argument
tdvp
is the vnode of the new directory of the target file and
tvp
is the vnode of the target file (if it exists).
The argument
tcnp
is the pathname component about the file's new name.
If the operation is successful zero is returned, otherwise and error
code is returned.
The source directory and file vnodes should be unlocked and their
reference counts should be incremented before entry.
The target directory and file vnodes should both be locked on entry.
VOP_RENAME()
updates the reference counts prior to returning.
dvp
, vpp
, cnp
, vap
)
dvp
is the locked vnode of the directory to create the new directory in and
cnp
is the pathname component of the new directory.
The argument
vap
specifies the attributes that the new directory should be created
with.
If the file is successfully created, the address of the resulting
locked vnode is returned in
vpp
and zero is returned.
This function is called after
VOP_LOOKUP()
when a directory is being created.
Normally,
VOP_LOOKUP(
)
will have set the SAVENAME flag in
cnp->cn_flags
to keep the memory pointed to by
cnp->cn_pnbuf
valid.
If an error is detected when creating the directory, this memory is
released.
If the directory is created successfully it will be released unless
the SAVESTART flags in specified in
cnp->cn_flags.
dvp
, vp
, cnp
)
dvp
is the locked vnode of the directory to remove the directory from and
vp
is the locked vnode of the directory to remove.
The argument
cnp
is the pathname component of the directory.
Zero is returned on success, otherwise an error code is returned.
Both
dvp
and
vp
should be locked on entry and will be released and unlocked on return.
dvp
, vpp
, cnp
, vap
, target
)
dvp
is the locked vnode of the directory to create the symbolic link in
and
cnp
is the pathname component of the symbolic link.
The argument
vap
specifies the attributes that the symbolic link should be created
with and
target
specifies the pathname of the target of the symbolic link.
If the symbolic link is successfully created, the address of the
resulting locked vnode is returned in
vpp
and zero is returned.
This function is called after
VOP_LOOKUP()
when a symbolic link is being created.
Normally,
VOP_LOOKUP(
)
will have set the SAVENAME flag in
cnp->cn_flags
to keep the memory pointed to by
cnp->cn_pnbuf
valid.
If an error is detected when creating the symbolic link, this memory
is released.
If the symbolic link is created successfully it will be released
unless the SAVESTART flags in specified in
cnp->cn_flags.
vp
, uio
, cred
, eofflag
, cookies
, ncookies
)
vp
is the vnode of the directory to read the contents of and
uio
is the destination location to read the contents into.
The argument
cred
is the caller's credentials.
The argument
eofflag
is the pointer to a flag which is set by
VOP_READDIR(
)
to indicate an end-of-file condition.
If
eofflag
is
NULL
,
the end-of-file condition is not returned.
The arguments
cookies
and
ncookies
specify the addresses for the list and number of directory seek
cookies generated for NFS.
Both
cookies
and
ncookies
should be
NULL
if they aren't required to be returned by
VOP_READDIR(
).
The directory contents are read into struct dirent structures and
uio->uio_offset
is set to the offset of the next unread directory entry.
This offset may be used in a following invocation to continue a
sequential read of the directory contents.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
The directory should be locked on entry and will remain locked on return.
In case
ncookies
and
cookies
are supplied, one cookie should be returned per directory entry.
The value of the cookie for each directory entry should be the offset
within the directory where the on-disk version of the following
directory entry starts.
That is, for each directory entry
i
,
the corresponding cookie should refer to the offset of directory entry
i
+
1
.
Note that the
cookies
array must be allocated by the callee using the M_TEMP malloc type as
callers of
VOP_READDIR()
must be able to free the allocation.
vp
, uio
, cred
)
vp
is the locked vnode of the symlink and
uio
is the destination location to read the contents into.
The argument
cred
is the credentials of the caller.
If the operation is successful zero is returned, otherwise an error
code is returned.
The vnode should be locked on entry and will remain locked on return.
dvp
, cnp
)
dvp
and free resources allocated in
cnp
.
This operation is rarely implemented in file systems and
genfs_abortop()
is typically used instead.
vp
)
)
is called when the kernel is no longer using the vnode.
This may be because the reference count reaches zero or it may be that
the file system is being forcibly unmounted while there are open
files.
It can be used to reclaim space for open but deleted files.
The argument
vp
is the locked vnode to be released.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
The vnode
vp
must be locked on entry, and will be unlocked on return.
vp
)
)
is called when a vnode is being reused for a different file system.
Any file system specific resources associated with the vnode should be
freed.
The argument
vp
is the vnode to be reclaimed.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
The vnode
vp
should not be locked on entry, and will remain unlocked on return.
vp
, flags
)
vp
is the vnode of the file to be locked.
The argument
flags
is a set of
lockmgr(9)
flags.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
VOP_LOCK(
)
is used to serialize access to the file system such as to prevent two
writes to the same file from happening at the same time.
Kernel code should use
vn_lock(9)
to lock a vnode rather than calling
VOP_LOCK(
)
directly.
vp
, flags
)
vp
is the vnode of the file to be unlocked.
The argument
flags
is a set of
lockmgr(9)
flags.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
VOP_UNLOCK(
)
is used to serialize access to the file system such as to prevent two
writes to the same file from happening at the same time.
vp
)
vp
is locked.
Possible return values are
LK_EXCLUSIVE
,
LK_SHARED
or 0 for lock held exclusively by the calling thread, shared lock held
by anyone or unlocked, respectively.
vp
, bn
, vpp
, bnp
, runp
)
bn
of a file specified by vnode
vp
to its physical block number on the disk.
The physical block is returned in
bnp
.
In case the logical block is not allocated, -1 is used.
If
vpp
is not
NULL
,
the vnode of the device vnode for the file system is
returned in the address specified by
vpp
.
If
runp
is not
NULL
,
the number of contiguous blocks starting from the next block after
the queried block will be returned in
runp
.
vp
)
vp
is the vnode to print.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
vp
, name
, retval
)
vp
is the locked vnode to get information about.
The argument
name
specified the type of information to return.
The information is returned in the address specified by
retval
.
Valid values for
name
are:
If
name
is recognized,
*retval
is set to the specified value and zero is returned, otherwise an
appropriate error is returned.
vp
, id
, op
, fl
, flags
)
vp
is the vnode on which locks are manipulated.
The argument
id
is the id token which is changing the lock and
op
is the
fcntl(2)
operation to perform.
Valid values are:
The argument
fl
is a description of the lock.
In the case of
SEEK_CUR
,
The caller should add the current file offset to
fl->l_start beforehand.
VOP_ADVLOCK()
treats
SEEK_CUR
as
SEEK_SET
.
The argument
flags
is the set of flags.
Valid values are:
If the operation is successful zero is returned, otherwise an appropriate error is returned.
vp
, cred
, flags
)
vp
is the locked vnode of the file to validate credentials
cred
.
The argument
flags
specifies the operation flags.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
The vnode must be locked on entry and remains locked on return.
dvp
, cnp
, flags
)
dvp
.
The argument
cnp
specifies the pathname component to whiteout.
vp
, offset
, m
, count
, centeridx
, access_type
, advice
, flags
)
vp
is the locked vnode to read the VM pages from.
The argument
offset
is offset in the file to start accessing and
m
is an array of VM pages.
The argument
count
points a variable that specifies the number of pages to read.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
If PGO_LOCKED is specified in
flags,
VOP_GETPAGES(
)
might return less pages than requested.
In that case, the variable pointed to by
count
will be updated.
This function is primarily used by the page-fault handing mechanism.
vp
, offlo
, offhi
, flags
)
vp
is the vnode to write the VM pages to.
The vnode's vm object lock
(v_uobj.vmobjlock)
must be held by the caller and will be released upon return.
The arguments
offlo
and
offhi
specify the range of VM pages to write.
In case
offhi
is given as 0, all pages at and after the start offset
offlo
belonging the vnode
vp
will be written.
The argument
flags
controls the behavior of the routine and takes the vm pager's
flags
(PGO_
-prefixed
).
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
The function is primarily used by the pageout handling mechanism and
is commonly implemented indirectly
by
genfs_putpages()
with the help of
VOP_STRATEGY(
)
and
VOP_BMAP(
).
vp
, bp
)
vp
is the vnode to read/write to.
The argument
bp
is the buffer to be read or written.
VOP_STRATEGY(
)
will either read or write data to the file depending on the value of
bp->b_flags.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
bp
)
bp
specifies the buffer to be written.
If the operation is successful zero is returned, otherwise an
appropriate error code is returned.
vp
, attrnamespace
, name
, uio
, size
, cred
)
vp
is the locked vnode of the file or directory from which to retrieve the
attribute.
The argument
attrnamespace
specifies the extended attribute namespace.
The argument
name
is a nul-terminated character string naming the attribute to retrieve.
The argument
uio
,
if not
NULL
,
specifies where the extended attribute value is to be written.
The argument
size
,
if not
NULL
,
will contain the number of bytes required to read all of
the attribute data upon return.
In most cases,
uio
will be
NULL
when
size
is not, and vice versa.
The argument
cred
specifies the user credentials to use when authorizing the request.
vp
, attrnamespace
, name
, uio
, cred
)
vp
is the locked vnode of the file or directory to which to store the
attribute.
The argument
namespace
specifies the extended attribute namespace.
The argument
name
is a nul-terminated character string naming the attribute to store.
The argument
uio
specifies the source of the extended attribute data.
The argument
cred
specifies the user credentials to use when authorizing the request.
vp
, attrnamespace
, uio
, size
, cred
)
vp
is the locked vnode of the file or directory whose attributes are to be listed.
The argument
attrnamespace
specifies the extended attribute namespace.
The argument
uio
,
if not
NULL
,
specifies where the extended attribute list is to be written.
The argument
size
,
if not
NULL
,
will contain the number of bytes required to read all of
the attribute names upon return.
In most cases,
uio
will be
NULL
when
size
is not, and vice versa.
The argument
cred
specifies the user credentials to use when authorizing the request.
ENOATTR
]
ENOTDIR
]
ENOENT
]
ENOSPC
]
EDQUOT
]
EACCES
]
EJUSTRETURN
]
EPERM
]
ENOTEMPTY
]
EINVAL
]
EIO
]
EROFS
]