00001 00024 /*--------------------------------------------------------------- 00025 * HISTORY 00026 * 24-Feb-2006 Graeme McKerrell 00027 * Initial version 00028 *--------------------------------------------------------------- 00029 * Copyright (C) 2006 Newport Networks. All Rights Reserved. 00030 *--------------------------------------------------------------- */ 00031 #ifndef _lub_dblockpool_h 00032 #define _lub_dblockpool_h 00033 #include <stddef.h> 00034 00035 #include "c_decl.h" 00036 00037 _BEGIN_C_DECL 00038 00039 /**************************************************************** 00040 * TYPE DEFINITIONS 00041 **************************************************************** */ 00045 typedef struct _lub_dblockpool lub_dblockpool_t; 00049 struct _lub_dblockpool 00050 { 00051 struct _lub_dblockpool_chunk *first_chunk; 00052 size_t block_size; 00053 unsigned chunk_size; 00054 unsigned max_chunks; 00055 }; 00056 00057 /**************************************************************** 00058 * DBLOCKPOOL OPERATIONS 00059 **************************************************************** */ 00070 extern void 00071 lub_dblockpool_init( 00075 lub_dblockpool_t *instance, 00079 size_t blocksize, 00083 unsigned chunksize, 00088 unsigned max_chunks 00089 ); 00097 extern void 00098 lub_dblockpool_fini( 00102 lub_dblockpool_t *instance 00103 ); 00118 extern void * 00119 lub_dblockpool_alloc( 00123 lub_dblockpool_t *instance 00124 ); 00136 extern void 00137 lub_dblockpool_free( 00141 lub_dblockpool_t *instance, 00145 void *block 00146 ); 00147 00148 _END_C_DECL 00149 00150 #endif /* _lub_dblockpool_h */ 00151