diff options
author | Martin Mares <mj@ucw.cz> | 1998-05-03 16:43:39 +0000 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 1998-05-03 16:43:39 +0000 |
commit | 18c8241a91bd9208879666f1a1a13f454e66d75b (patch) | |
tree | 8bdc5f3e384b6b9198d5ab834d869c8d1fb261a7 /lib/resource.h | |
parent | a8b6038225d18155883e330c96b2bc2e44153e1e (diff) |
BIRD library: The story continues.
Complete resource manages and IP address handling.
Diffstat (limited to 'lib/resource.h')
-rw-r--r-- | lib/resource.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/resource.h b/lib/resource.h index eabc963d..03c083a5 100644 --- a/lib/resource.h +++ b/lib/resource.h @@ -14,42 +14,43 @@ /* Resource */ typedef struct resource { - node n; /* Inside resource pool */ - struct resclass *class; /* Resource class */ + node n; /* Inside resource pool */ + struct resclass *class; /* Resource class */ } resource; /* Resource class */ struct resclass { - char *name; /* Resource class name */ - unsigned size; /* Standard size of single resource */ - void (*free)(resource *); /* Freeing function */ - void (*dump)(resource *); /* Dump to debug output */ + char *name; /* Resource class name */ + unsigned size; /* Standard size of single resource */ + void (*free)(resource *); /* Freeing function */ + void (*dump)(resource *); /* Dump to debug output */ }; /* Generic resource manipulation */ typedef struct pool pool; +void resource_init(void); pool *rp_new(pool *); /* Create new pool */ -void rp_init(pool *); /* Initialize static pool */ -void rp_empty(pool *); /* Free everything in the pool */ +void rp_free(pool *); /* Free everything in the pool */ void rfree(void *); /* Free single resource */ void rdump(void *); /* Dump to debug output */ -void ralloc(pool *, struct resclass *); +void *ralloc(pool *, struct resclass *); + +extern pool root_pool; /* Normal memory blocks */ void *mb_alloc(pool *, unsigned size); -void *mb_free(void *); +void mb_free(void *); /* Memory pools with linear allocation */ typedef struct mempool mempool; mempool *mp_new(pool *, unsigned blk); -void mp_trim(pool *); /* Free unused memory */ void *mp_alloc(mempool *, unsigned size); /* Aligned */ void *mp_allocu(mempool *, unsigned size); /* Unaligned */ void *mp_allocz(mempool *, unsigned size); /* With clear */ |