physiock(D3)
physiock - validate and issue a raw I/O request
As shipped in IRIX 6.5.22. Last changed in IRIX 6.5.15.
NAME physiock - validate and issue a raw I/O request SYNOPSIS #include <sys/types.h> #include <sys/buf.h> #include <sys/uio.h> #include <sys/ddi.h> int physiock(void (*strat)(), buf_t *bp, dev_t dev, int rwflag, daddr_t nblocks, uio_t *uiop); Arguments strat Address of the driver strategy(D2) routine, or similar function. bp Pointer to the buf(D4) structure describing the I/O request. dev External device number. rwflag Flag indicating whether the access is a read or a write. nblocks Number of blocks that the logical device dev can support. uiop Pointer to the uio(D4) structure that defines the user space of the I/O request. DESCRIPTION physiock is called by the character interface ioctl(D2), read(D2), and write(D2) routines of block drivers to help perform unbuffered I/O while maintaining the buffer header as the interface structure. Return Values physiock returns 0 if the result is successful, or the appropriate error number on failure. If a partial transfer occurs, the uio structure is updated to indicate the amount not transferred and an error is returned. If a read is performed at the end of the device, 0 is returned. ENOSPC An attempt is made to read beyond the end of the device. ENOSPC An attempt is made to write at or beyond the end of the device. EFAULT The user memory is not valid. EAGAIN physiock could not lock all of the pages. EINVAL The offset is not a multiple of NBPSCTR. EBUSY There is not enough kernel memory available to map the user pages to kernel virtual memory. USAGE physiock performs the following functions: verifies the requested transfer is valid by checking if the offset is at or past the end of the device (this check is bypassed if the size parameter argument nblocks is zero) and that the offset is a multiple of NBPSCTR sets up a buffer header describing the transfer faults pages in and locks the pages impacted by the I/O transfer so they can't be swapped out calls the driver strategy routine passed to it (strat) sleeps until the transfer is complete and is awakened by a call to biodone(D3) from the driver's I/O completion handler performs the necessary cleanup and updates, then returns to the driver routine A transfer using physiock is considered valid if the specified data location exists on the device, and the user has specified a storage area large enough that exists in user memory space. If bp is set to NULL, a buffer is allocated temporarily and freed after the transfer completes. If rwflag is set to B_READ, the direction of the data transfer will be from the kernel to the user's buffer. If rwflag is set to B_WRITE, the direction of the data transfer will be from the user's buffer to the kernel. One block is equal to NBPSCTR bytes. NBPSCTR is defined in sys/param.h. Level Base only. Synchronization Constraints Can sleep. Driver-defined basic locks and read/write locks may not be held across calls to this function. Driver-defined sleep locks may be held across calls to this function. REFERENCES buf(D4), ioctl(D2), read(D2), strategy(D2), uio(D4), write(D2), uiophysio(D3X)