BUF_create
2-20
C Interface
Syntax
buf = BUF_create(numbuff, size, align, attrs);
Parameters
Uns
numbuff; /* number of buffers in the pool */
MEM_sizep size;
/* size of a single buffer in the pool */
Uns
align;
/* alignment for each buffer in the pool */
BUF_Attrs
*attrs;
/* pointer to buffer pool attributes */
Return Value
BUF_Handle buf;
/* buffer pool object handle */
Reentrant
no
Description
BUF_create creates a buffer pool object dynamically. The parameters
correspond to the properties available for statically-created buffer pools,
which are described in the BUF Object Properties topic.
The numbuff parameter specifies how many fixed-length buffers the pool
should contain. This must be a non-zero number.
The size parameter specifies how long each fixed-length buffer in the
pool should be in MADUs. This must be a non-zero number. The size you
specify is adjusted as needed to meet the alignment requirements, so the
actual buffer size may be larger. The MEM_sizep type is defined as
follows:
typedef unsigned long MEM_sizep;
The align parameter specifies the alignment boundary for buffers in the
pool. Each buffer is aligned on a boundary with an address that is a
multiple of this number. The value must be a power of 2. The size of
buffers created in the pool is automatically increased to accommodate
the alignment you specify.
BUF_create ensures that the size and alignment are set to at least the
minimum values permitted for the platform. The minimum size permitted
is
4 (’C55x) MADUs. The minimum alignment permitted is 2 (’C55x).
The attrs parameter points to a structure of type BUF_Attrs, which is
defined as follows:
typedef struct BUF_Attrs {
Int segid; /* segment for element allocation*/
} BUF_Attrs;
BUF_create
Dynamically create a buffer pool