vnfileops(9) - NetBSD Manual Pages

Command: Section: Arch: Collection:  
VNFILEOPS(9)           NetBSD Kernel Developer's Manual           VNFILEOPS(9)


NAME
vnfileops, vn_closefile, vn_fcntl, vn_ioctl, vn_read, vn_poll, vn_statfile, vn_write, - vnode file descriptor operations
SYNOPSIS
#include <sys/param.h> #include <sys/file.h> #include <sys/vnode.h> int vn_closefile(struct file *fp, struct proc *p); int vn_fcntl(struct file *fp, u_int com, void *data, struct proc *p); int vn_ioctl(struct file *fp, u_long com, void *data, struct proc *p); int vn_read(struct file *fp, off_t *offset, struct uio *uio, struct ucred *cred, int flags); int vn_poll(struct file *fp, int events, struct proc *p); int vn_statfile(struct file *fp, struct stat *sb, struct proc *p); int vn_write(struct file *fp, off_t *offset, struct uio *uio, struct ucred *cred, int flags);
DESCRIPTION
The functions described in this page are the vnode-specific file descrip- tor operations. They should only be accessed through the opaque function pointers in the file entries (see file(9)). They are described here only for completeness.
FUNCTIONS
vn_closefile(fp, p) Common code for a file table vnode close operation. The file is described by fp and p is the calling process. vn_closefile() simply calls vn_close(9) with the appropriate arguments. vn_fcntl(fp, com, data, p) Common code for a file table vnode fcntl(2) operation. The file is specified by fp. The argument p is the calling process. vn_fcntl() simply locks the vnode and invokes the vnode opera- tion VOP_FCNTL(9) with the command com and buffer data. The vnode is unlocked on return. If the operation is successful zero is returned, otherwise an appropriate error is returned. vn_ioctl(fp, com, data, p) Common code for a file table vnode ioctl operation. The file is specified by fp. The argument p is the calling process. vn_ioctl() simply locks the vnode and invokes the vnode opera- tion VOP_IOCTL(9) with the command com and buffer data. The vnode is unlocked on return. If the operation is successful zero is returned, otherwise an appropriate error is returned. vn_read(fp, offset, uio, cred, flags) Common code for a file table vnode read. The argument fp is the file structure, The argument offset is the offset into the file. The argument uio is the uio structure describing the mem- ory to read into. The caller's credentials are specified in cred. The flags argument can define FOF_UPDATE_OFFSET to update the read position in the file. If the operation is successful zero is returned, otherwise an appropriate error is returned. vn_poll(fp, events, p) Common code for a file table vnode poll operation. vn_poll() simply calls VOP_POLL(9) with the events events and the calling process p. If the operation is success zero is returned, other- wise an appropriate error code is returned. vn_statfile(fp, sb, p) Common code for a stat operation. The file descriptor is speci- fied by the argument fp and sb is the buffer to return the stat information. The argument p is the calling process. vn_statfile() basically calls the vnode operation VOP_GETATTR(9) and transfer the contents of a vattr structure into a struct stat. If the operation is successful zero is returned, other- wise an appropriate error code is returned. vn_write(fp, offset, uio, cred, flags) Common code for a file table vnode write. The argument fp is the file structure, The argument offset is the offset into the file. The argument uio is the uio structure describing the mem- ory to read from. The caller's credentials are specified in cred. The flags argument can define FOF_UPDATE_OFFSET to update the read position in the file. If the operation is successful zero is returned, otherwise an appropriate error is returned.
CODE REFERENCES
This section describes places within the NetBSD source tree where actual code implementing or using the vnode framework can be found. All path- names are relative to /usr/src. The high-level convenience functions are implemented within the file sys/kern/vfs_vnops.c.
SEE ALSO
file(9), intro(9), vnode(9), vnodeops(9), vnsubr(9) NetBSD 2.0.2 October 14, 2002 NetBSD 2.0.2
Powered by man-cgi (2024-03-20). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.