00001 #ifndef __si_sys_blkalloc_h__138f5d42_147c_463e_899c_6d8a28944353 00002 #define __si_sys_blkalloc_h__138f5d42_147c_463e_899c_6d8a28944353 00003 00012 #include <stdlib.h> 00013 00014 typedef struct sc_bufferDesc sc_bufferDesc; 00015 typedef struct sc_blockDesc sc_blockDesc; 00016 struct sc_bufferDesc { 00017 sc_bufferDesc* next; 00018 }; 00019 struct sc_blockDesc { 00020 sc_blockDesc* next; 00021 }; 00022 00029 typedef struct sc_blockAllocator 00030 { 00031 s_int32 nblocks; 00032 s_int32 maxCapacity; 00033 s_int32 blockSize; 00035 sc_blockDesc* blocks; 00036 sc_bufferDesc* buffers; 00038 } sc_blockAllocator; 00039 00040 sc_status sc_blockAllocator_construct(sc_blockAllocator* pba, 00041 s_int32 blockSize, 00042 s_int32 initialCapacity, 00043 s_int32 maxCapacity); 00053 sc_status sc_blockAllocator_destruct(sc_blockAllocator* pba); 00059 sc_status sc_blockAllocator_allocate(sc_blockAllocator* pba, 00060 void** ppblock); 00069 sc_status sc_blockAllocator_free(sc_blockAllocator* pba, 00070 void* pblock); 00080 #endif /* __si_sys_blkalloc_h__138f5d42_147c_463e_899c_6d8a28944353 */ 00081 00082