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(file_t *fp); int vn_fcntl(file_t *fp, u_int com, void *data); int vn_ioctl(file_t *fp, u_long com, void *data); int vn_read(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t cred, int flags); int vn_poll(file_t *fp, int events); int vn_statfile(file_t *fp, struct stat *sb); int vn_write(file_t *fp, off_t *offset, struct uio *uio, kauth_cred_t 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, l) Common code for a file table vnode close operation. The file is described by fp and l is the calling lwp. vn_closefile() simply calls vn_close(9) with the appropriate arguments. vn_fcntl(fp, com, data, l) Common code for a file table vnode fcntl(2) operation. The file is specified by fp. The argument l is the calling lwp. 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, l) Common code for a file table vnode ioctl operation. The file is specified by fp. The argument l is the calling lwp vn_ioctl() simply locks the vnode and invokes the vnode operation 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, l) Common code for a file table vnode poll operation. vn_poll() simply calls VOP_POLL(9) with the events events and the calling lwp l. The function returns a bitmask of available events. vn_statfile(fp, sb, l) 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 l is the calling lwp. 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, otherwise an appropri- ate 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 5.0 April 9, 2008 NetBSD 5.0
Powered by man-cgi (2021-06-01). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias.