buf_breakup(D3) buf_breakup(D3)
NAME
buf_breakup - unified I/O breakup routine
SYNOPSIS
#include <sys/types.h>
#include <sys/buf.h>
#include <sys/ddi.h>
void buf_breakup(void (*strat)(buf_t *), buf_t *bp, const bcb_t *bcbp)
Arguments
strat Address of subordinate strategy routine.
bp Pointer to buffer header of buffer to be broken up.
bcbp Pointer to a bcb(D4) structure describing breakup
constraints.
DESCRIPTION
buf_breakup is a generic buffer breakup routine that modifies
the original buffer header and/or breaks the job into multiple
pieces, calling the strategy routine one or more times
(possibly with newly created buffer headers) such that each
call to the strategy routine satisfies a set of constraints.
These constraints are specified by the buffer control block
pointed to by bcbp and described in bcb(D4).
buf_breakup is capable of handling all types of buffers that
might be passed to a driver. It supersedes other, more
specific, breakup routines such as dma_pageio(D3) and
rdma_filter(D3).
Return Values
None.
USAGE
buf_breakup is typically called in a block driver from its
strategy(D2) entry point, which in turn is called indirectly
through physiock(D3) from the driver's read(D2) and write(D2)
entry points.
Drivers which use buf_breakup should set D_NOBRKUP and
D_BLKOFF in their devflag(D1) flags. Even though D_BLKOFF is
set, the subordinate strategy routine, strat, will not see a
non-zero b_blkoff if bcb_granularity is a multiple of NBPSCTR.
Copyright 1994 Novell, Inc. Page 1
buf_breakup(D3) buf_breakup(D3)
The strat routine should consider each call as a separate job,
and should have no knowledge that an original buffer was
broken up into multiple pieces.
The following buf(D4) fields will be copied from the original
buffer header to any new buffer headers for each call to
strat, in case the driver uses them to pass information into
its lower-level routines:
b_priv Driver private data
b_priv2 Driver private data
b_resid Number of bytes not transferred
Level
Base only.
Synchronization Constraints
Can sleep.
Driver-defined basic locks, read/write locks, and sleep locks
may not be held across calls to this function.
REFERENCES
bcb(D4), buf(D4), devflag(D1), dma_pageio(D3), physiock(D3),
rdma_filter(D3), read(D2), strategy(D2), write(D2)
NOTICES
Portability
All processors
Applicability
ddi: 5, 5mp, 6, 6mp, 7, 7mp
Copyright 1994 Novell, Inc. Page 2