ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid-7.2/include/balloc.h
Revision: 912
Committed: Wed Nov 7 22:47:44 2007 UTC (17 years, 9 months ago) by michael
Content type: text/x-chdr
File size: 2702 byte(s)
Log Message:
- Implemented libtool-ltdl. Only shared modules are supported currently
- Several build fixes and cleanups. ircd now builds and runs without any problems
- Added back all files to SVN that are needed to built the daemon
  I really don't want to force other people that want to test the snapshots
  or svn versions to install yyacc, lex, automake, autoconf and libtool...
  No problem having required files in svn
- Removed some automake maintainer stuff which is kinda useless for us

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 *
4 * Copyright (C) 2002 by the past and present ircd coders, and others.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file balloc.h
23 * \brief A block allocator
24 * \version $Id$
25 * \todo Get rid of all typedefs in this file
26 */
27
28 #ifndef INCLUDED_balloc_h
29 #define INCLUDED_balloc_h
30
31 #include "config.h"
32 #include "client.h"
33 #include "tools.h"
34 #include "memory.h"
35 #include "ircd_defs.h"
36
37
38 /*! \brief Block contains status information for
39 * an allocated block in our heap.
40 */
41 struct Block {
42 int freeElems; /*!< Number of available elems */
43 size_t alloc_size; /*!< Size of data space for each block */
44 struct Block* next; /*!< Next in our chain of blocks */
45 void* elems; /*!< Points to allocated memory */
46 dlink_list free_list; /*!< Chain of free memory blocks */
47 };
48
49 typedef struct Block Block;
50
51 struct MemBlock {
52 dlink_node self; /*!< Node for linking into free_list or used_list */
53 Block *block; /*!< Which block we belong to */
54 };
55 typedef struct MemBlock MemBlock;
56
57 /*! \brief BlockHeap contains the information for the root node of the
58 * memory heap.
59 */
60 struct BlockHeap {
61 size_t elemSize; /*!< Size of each element to be stored */
62 int elemsPerBlock; /*!< Number of elements per block */
63 int blocksAllocated; /*!< Number of blocks allocated */
64 int freeElems; /*!< Number of free elements */
65 Block* base; /*!< Pointer to first block */
66 const char *name; /*!< Name of the heap */
67 struct BlockHeap *next; /*!< Pointer to next heap */
68 };
69
70 typedef struct BlockHeap BlockHeap;
71
72
73 extern int BlockHeapFree(BlockHeap *, void *);
74 extern void * BlockHeapAlloc(BlockHeap *);
75
76 extern BlockHeap* BlockHeapCreate(const char *const, size_t, int);
77 extern int BlockHeapDestroy(BlockHeap *);
78 extern void initBlockHeap(void);
79 extern void block_heap_report_stats(struct Client *);
80 #endif /* INCLUDED_balloc_h */

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision