SVR5
physiock(D3)
physiock --
validate and issue a raw I/O request
Synopsis (Not in current DDI version)
#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);
Description
physiock( )
is called by the character (raw) 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.
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.
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:
ENXIO-
an attempt was made to read beyond the end of the device
or an attempt was made to write at or beyond the end of a the device.
EFAULT-
User memory is not valid.
EAGAIN-
physiock( )
could not lock all of the pages.
If a read is performed at the end of the device, 0 is returned.
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.
-
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 by the (strat) argument.
-
Blocks 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 calling 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.
Some device drivers need nblocks to be arbitrarily large
(for example, for tapes whose sizes are unknown).
In this case, nblocks should be
no larger than (2[22])-1.
For arbitrarily large cases on SVR4.2 MP systems,
nblocks should be 0 (zero).
Context and synchronization
User
context.
Examples
See
dma_pageio(D3)
for an example of physiock.
Hardware applicability
All
Version applicability
ddi:
1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp
Differences between version
physiock(D3)
is not supported in DDI 8; use
do_biostart(D3)
instead.
SCO OpenServer ODDI compatibility
SCO OpenServer ODDI drivers use the
physio(D3oddi)
and
physck(D3oddi)
functions rather than
physiock( ).
References
buf(D4),
dma_pageio(D3),
ioctl(D2),
read(D2),
strategy(D2),
uio(D4),
write(D2)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005