Requests file I/O.
int vnop_rdwr (vp, op, flags, uiop, ext, vinfo, vattrp, crp)
struct vnode * vp;
enum uio_rw op;
int flags;
struct uio * uiop;
int ext;
caddr_t vinfo;
struct vattr * vattrp;
struct ucred * crp;
int vnop_rdwr_attr (vp, op, flags, uiop, ext, vinfo, vpre, vpost, crp)
struct vnode * vp;
enum uio_rw op;
long flags;
struct uio * uiop;
ext_t ext;
caddr_t vinfo;
struct vattr * vpre;
struct vattr * vpost;
struct ucred * crp;
Item | Description |
---|---|
vp | Points to the virtual node (v-node) of the file. |
op | Specifies a number that indicates a read or write operation. This parameter has a value of either UIO_READ or UIO_WRITE. These values are found in the /usr/include/sys/uio.h file. |
flags | Identifies flags from the open file structure. |
uiop | Points to a uio structure. This structure describes the count, data buffer, and other I/O information. |
ext | Provides an extension for special purposes. Its use and meaning are specific to virtual file systems, and it is usually ignored except for devices. |
vinfo | This parameter is currently not used. |
vattrp | Points to a vattr structure. If this pointer is NULL, no action is required of the file system implementation. If it is not NULL, the attributes of the file specified by the vp parameter are returned at the address passed in the vattrp parameter. |
vpre | Points to an attributes structure for pre-operation attributes. |
vpost | Points to an attributes structure for post-operation attributes. |
crp | Points to the cred structure. This structure contains data that the file system can use to validate access permission. |
The vnop_rdwr entry point is used to request that data to be read or written from an object represented by a v-node. The vnop_rdwr entry point does the indicated data transfer and sets the number of bytes not transferred in the uio_resid field. This field is 0 (zero) on successful completion.
The vnop_rdwr_attr kernel service performs the same function as the vnop_rdwr kernel service but also allows the caller to retrieve attributes of the object either before the I/O, after or both.
The vnop_rdwr and vnop_rdwr_attr entry points can be called from the process environment only.
Nonzero return values are returned from the /usr/include/sys/errno.h file to indicate failure. The vnop_rdwr entry point returns an error code if an operation did not transfer all the data requested. The only exception is if an end of file is reached on a read request. In this case, the operation still returns 0.