uiophysio(D3X)uiophysio(D3X)NAMEuiophysio - set up user data space for I/O
SYNOPSIS
#include <sys/types.h>
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/ddi.h>
int uiophysio(int (*strat)(struct buf *), struct buf *bp, dev_t dev,
int rwflag, struct uio *uiop);
Arguments
strat
Address of the driver routine.
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.
uiop Pointer to the uio(D4) structure that defines the user space of the
I/O request.
DESCRIPTIONuiophysio prepares the user's address space for DMA I/O and encapsulates
the transfer information in a buffer header.
Return Values
uiophysio 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.
uiophysio returns the ENOSPC error if an attempt is made to read beyond
the end of the device. If a read is performed at the end of the device, 0
is returned. ENOSPC is also returned if an attempt is made to write at or
beyond the end of a the device. EFAULT is returned if user memory is not
valid. EAGAIN is returned if uiophysio could not lock all of the pages.
USAGEuiophysio performs the following functions:
o 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
o Calls the routine named in the strat parameter, passing a pointer to
a buf structure
Page 1
uiophysio(D3X)uiophysio(D3X)
o Sleeps until the transfer is complete and is awakened by a call to
biodone(D3) from the driver's I/O completion handler
o Performs the necessary cleanup and updates, then returns to the
driver routine
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 or device 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 or device.
Level
Base only.
See Also
buf(D4), ioctl(D2), read(D2), strategy(D2), physiock(D3), uio(D4),
write(D2)
Page 2