blockpool.h

00001 
00022 /*---------------------------------------------------------------
00023  * HISTORY
00024  * 7-Dec-2004       Graeme McKerrell    
00025  *    Updated to use the "lub" prefix
00026  * 6-Feb-2004       Graeme McKerrell    
00027  *    removed init_fn type definition and parameter, the client had
00028  *    more flexiblity in defining their own initialisation operation with
00029  *    arguments rather than use a "one-size-fits-all" approach.
00030  *    Modified blockpool structure to support FIFO block allocation.
00031  * 23-Jan-2004      Graeme McKerrell    
00032  *    Initial version
00033  *---------------------------------------------------------------
00034  * Copyright (C) 2004 3Com Corporation. All Rights Reserved.
00035  *--------------------------------------------------------------- */
00036 #ifndef _lub_blockpool_h
00037 #define _lub_blockpool_h
00038 #include <stddef.h>
00039 
00040 /****************************************************************
00041  * TYPE DEFINITIONS
00042  **************************************************************** */
00046 typedef struct lub_blockpool_s lub_blockpool_t;
00047 struct lub_blockpool_s
00048 {
00049     /* CLIENTS MUSTN'T TOUCH THESE DETAILS */
00050         lub_blockpool_t *head;
00051         lub_blockpool_t *tail;
00052 };
00053 
00054 /****************************************************************
00055  * BLOCKPOOL OPERATIONS
00056  **************************************************************** */
00068 extern void
00069         lub_blockpool_init(
00073             lub_blockpool_t       *blockpool,
00077                     void                  *memory,
00081                 size_t                 blocksize,
00086                 unsigned               blockcount
00087         );
00088 
00103 extern void *
00104         lub_blockpool_alloc(
00108             lub_blockpool_t *blockpool
00109         );
00110 
00122 extern void
00123         lub_blockpool_free(
00127             lub_blockpool_t *blockpool,
00131                 void            *block
00132         );
00133 
00134 #endif /* _lub_blockpool_h */
00135 

Generated on Fri Oct 13 15:52:02 2006 for CLISH by  doxygen 1.4.6