get a raw buffer header
buf_t *getrbuf(intg flag);
allocates the space for a buffer header [see
If flag is set to KM_SLEEP, the caller will sleep
if necessary until memory is available.
If flag is set to KM_NOSLEEP, the caller will not sleep,
but getrbuf will return NULL if
memory is not immediately available.
Indicates whether the caller should sleep for free space.
Upon successful completion, getrbuf returns a pointer to the
allocated buffer header.
If KM_NOSLEEP is specified and sufficient memory is not immediately
available, getrbuf returns a NULL pointer.
getrbuf is used when a driver is performing
and needs to set up a buffer header that is not associated with
a system-provided data buffer.
The driver provides its own memory for the data buffer.
On return from getrbuf, the ``b_iodone'' field of the buffer header
will be NULL (meaning take the default action on completion).
Since the default action does not support driver buffers in the asynchronous
case, the driver must change this to the address of a driver-specific I/O
completion handler if the buffer will be used for B_ASYNC transfers.
The caller must also initialize the following fields:
is set for a syncrhonous write transfer
from main memory to the device.
The druver must turn on the
B_READ flag to transfer from the device to main memory.
The driver may also turn on the B_ASYNC flag
and set the
for a synchronous transfer.
the user's buffer.
Is set to BA_KVIRT
Must be set to the number of bytes to transfer.
Must be set to the virtual address of the caller-supplied buffer.
Must be set to the block number to be accessed.
Must be set to the same value as b_bcount.
Can be used to remember the size of the data buffer associated with the buffer header.
Typically, drivers do not allocate buffers.
A buffer is allocated by the kernel
and the associated buffer header is used as an
argument to the driver's
or, for DDI versions prior to version 8,
However, to implement
some special features, such as
perform I/O, the driver may need its own
The driver can get the buffer space from the system by
Or the driver can choose
to use its own memory for the buffer and only allocate a buffer header
Context and synchronization
If flag is set to KM_NOSLEEP,
non-blockable, initialization, or interrupt
If flag is set to KM_SLEEP,
1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005