BUF Module
Application Program Interface
2-15
2.2
BUF Module
The BUF module maintains buffer pools of fixed-size buffers.
Functions
❏
BUF_alloc. Allocate a fixed-size buffer from the buffer pool
❏
BUF_create. Dynamically create a buffer pool
❏
BUF_delete. Delete a dynamically-created buffer pool
❏
BUF_free. Free a fixed-size buffer back to the buffer pool
❏
BUF_maxbuff. Get the maximum number of buffers used in a pool
❏
BUF_stat. Get statistics for the specified buffer pool
Constants, Types, and
Structures
typedef unsigned long MEM_sizep;
#define BUF_ALLOCSTAMP 0xcafe
#define BUF_FREESTAMP 0xbeef
typedef struct BUF_Obj {
Ptr startaddr; /* Start addr of buffer pool */
MEM_sizep size; /* Size before alignment */
MEM_sizep postalignsize; /* Size after align */
Ptr nextfree; /* Ptr to next free buffer */
Uns totalbuffers; /* # of buffers in pool*/
Uns freebuffers; /* # of free buffers in pool */
Int segid; /* Mem seg for buffer pool */
} BUF_Obj, *BUF_Handle;
typedef struct BUF_Attrs {
Int segid; /* segment for element allocation */
} BUF_Attrs;
BUF_Attrs BUF_ATTRS = {/* default attributes */
0,
};
typedef struct BUF_Stat {
MEM_sizep postalignsize; /* Size after align */
MEM_sizep size; /* Original size of buffer */
Uns totalbuffers; /* Total buffers in pool */
Uns freebuffers; /* # of free buffers in pool */
} BUF_Stat;
Configuration
Properties
The following list shows the properties that can be configured in a Tconf
script, along with their types and default values. For details, see the BUF
Manager Properties and BUF Object Properties headings. For
descriptions of data types, see Section 1.4,