12.07.2015 Views

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

INTRO (9) NetBSD Kernel Developer's Manual INTRO (9) NAME ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VNODEOPS (9) <strong>NetBSD</strong> <strong>Kernel</strong> Developer’s <strong>Manual</strong> VNODEOPS (9)ing process.The ioflag argument is used to give directives and hints to the file system. When attempting aread, the high 16 bits are used to provide a read-ahead hint (in unit of file system blocks) that thefile system should attempt. The low 16bits are a bit mask which can contain the following flags:IO_UNITdo I/O as atomic unitIO_APPEND append write to endIO_SYNCsync I/O file integrity completionIO_NODELOCKED underlying node already lockedIO_NDELAY FNDELAY flag set in file tableIO_DSYNC sync I/O data integrity completionIO_ALTSEMANTICSuse alternate I/O semanticsIO_NORMAL operate on regular dataIO_EXToperate on extended attributesIO_DIRECT do not buffer data in the kernelZero is returned on success, otherwise an error is returned. The vnode should be locked on entryand remains locked on exit.VOP_WRITE(vp , uio , ioflag , cred)Write to a file. The argument vp is the vnode of the file to write to, uio is the location of thedata 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 16bits areabit 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 entryand remains locked on exit.VOP_IOCTL(vp , command , data , fflag , cred)Perform device-specific I/O. The argument vp is the locked vnode of the file, normally representinga device. The argument command specifies the device-specific operation to perform andcnp provides extra data for the specified operation. The argument fflags is a set of flags. Theargument cred is the caller’s credentials. If the operation is successful, zero is returned, otherwisean appropriate error code is returned.Most file systems do not supply a function for VOP_IOCTL(). This function implements theioctl(2) system call.VOP_FCNTL(vp , command , data , fflag , cred)Perform file control. The argument vp is the locked vnode of the file. The argument commandspecifies the operation to perform and cnp provides extra data for the specified operation. Theargument fflags is a set of flags. The argument cred is the caller’s credentials. If the operationis successful, zero is returned, otherwise an appropriate error code is returned.VOP_POLL(vp , events)Test if a poll event has occurred. The argument vp is the vnode of the file to poll. It returns anyevents of interest as specified by events that may have occurred for the file. The argumentevents is a set of flags as specified by poll(2).VOP_KQFILTER(vp , kn)Register a knote kn with the vnode vn. Ifthe operation is successful zero is returned, otherwisean appropriate error code is returned.<strong>NetBSD</strong> 3.0 January 19, 2008 8

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!