get an empty buffer of the specified size
buf_t *ngeteblk(size_t bsize);
ngeteblk retrieves a buffer [see
of size bsize
from the buffer cache and returns a pointer to the
If a buffer is not
available, ngeteblk dynamically allocates one.
If memory is not
immediately available, ngeteblk will sleep until enough memory has
been freed to allocate the buffer.
Size of the buffer being requested.
A pointer to the buffer header structure is
When the driver
(DDI versions before version 8)
routine receives a buffer header
from the kernel, all the necessary members are already initialized.
However, when a driver allocates buffers for its own use, it
must set up some of the members before calling its
The following list describes the state of these members
when the buffer header is received from ngeteblk:
is set for a synchronous 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 bsize.
is set to the buffer's virtual address.
is not initialized by ngeteblk,
and must be
initialized by the driver
is set to BA_KVIRT
is set to bsize
is set to NULL
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
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 allocate just a buffer header
Note that buffers allocated via ngeteblk
must be freed using either
Context and synchronization
User or blockable
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