sdi_blkio --
blocks and issues non-block-aligned or non-block-sized requests
Synopsis
#include <sys/sdi.h>
void sdi_blkio(buf_t *obp, unsigned int sshift, void (*strategy)())
Description
sdi_blkio blocks requests which
are not on the sector boundary, or
which specify a
non-sector size, into sizes which can
be issued to the device.
Most disks and tapes will only except 512 byte
(or multiples of 512) size requests.
Some optical devices require 2048-byte blocks.
However, there are many
valid user operations that issue requests
which are less than the
device block size or are not a multiple of it.
sdi_blkio uses
temporary buffers to issue the needed requests, using
the target driver's
strategy routine to fulfill the user request.
Upon successful completion of the needed transfers,
sdi_blkio
signals completion of the user request.
Arguments
obp
pointer to the original buffer request
sshift
shift value needed to left-shift from blocks size to sectors size
strategy
pointer to the driver's strategy routine through which the
blocked requests will be issued
Return values
None
Usage
sdi_blkio
is typically used in a target driver's strategy routine.
The strategy routine checks the size and alignment of the request
for any nonaligned requests.
sdi_blkio is then called to
break the request up into valid
sector/block-aligned read or write
requests.
If the request is a write, the entire sector/block is read,
the portion requested is updated, and then the entire sector/block
is written.
When all the separate requests (needed to formulate the
original request) are completed, a call
is made to
biodone(D3)
to signal completion of the request.
If any portion of the
original request fails, a error result
is posted for the original
request, and the remaining requests are not issued.