Typedefs | |
| typedef struct l4slab_cache | l4slab_cache_t |
| Slab cache descriptor type. | |
| typedef L4_CV void *(* | l4slab_grow_fn_t )(l4slab_cache_t *cache, void **data) |
| Cache grow callback function. | |
| typedef L4_CV void(* | l4slab_release_fn_t )(l4slab_cache_t *cache, void *buffer, void *data) |
| Cache release callback function. | |
Functions | |
| L4_CV int | l4slab_cache_init (l4slab_cache_t *cache, l4_size_t size, unsigned int max_free, l4slab_grow_fn_t grow_fn, l4slab_release_fn_t release_fn) |
| Initialize slab cache. | |
| L4_CV void | l4slab_destroy (l4slab_cache_t *cache) |
| Destroy slab cache. | |
| L4_CV void | l4slab_add_slab (l4slab_cache_t *cache, void *buffer, void *data) |
| Add a slab to the slab cache. | |
| L4_CV void | l4slab_set_data (l4slab_cache_t *cache, void *data) |
| Set cache application data pointer. | |
| L4_CV void * | l4slab_get_data (l4slab_cache_t *cache) |
| Get cache application data. | |
| typedef struct l4slab_cache l4slab_cache_t |
| typedef L4_CV void*(* l4slab_grow_fn_t)(l4slab_cache_t *cache, void **data) |
Cache grow callback function.
| cache | Descriptor of the slab cache which requests the memory |
| data | Slab user data pointer, the contents is returned with the slab to the release callback function. |
| typedef L4_CV void(* l4slab_release_fn_t)(l4slab_cache_t *cache, void *buffer, void *data) |
Cache release callback function.
| cache | Slab cache descriptor | |
| buffer | Slab address | |
| data | Slab user data pointer |
| L4_CV int l4slab_cache_init | ( | l4slab_cache_t * | cache, | |
| l4_size_t | size, | |||
| unsigned int | max_free, | |||
| l4slab_grow_fn_t | grow_fn, | |||
| l4slab_release_fn_t | release_fn | |||
| ) |
Initialize slab cache.
| cache | Slab cache descriptor | |
| size | Size of the cache objects | |
| max_free | Maximum number of free slabs allowed in the cache. If more slabs in the slab cache are freed, they are released (if a release callback function is specified). | |
| grow_fn | Cache grow callback function, called by the slab cache to allocate new buffers for the cache. If no function is specified the cache cannot allocate buffers on demand. | |
| release_fn | Slab release callback function, called by the cache to release unused buffers. If no function is specified unused buffers are not released. |
| L4_CV void l4slab_destroy | ( | l4slab_cache_t * | cache | ) |
Destroy slab cache.
| cache | Cache descriptor |
| L4_CV void l4slab_add_slab | ( | l4slab_cache_t * | cache, | |
| void * | buffer, | |||
| void * | data | |||
| ) |
Add a slab to the slab cache.
| cache | Cache descriptor | |
| buffer | Pointer to new slab | |
| data | Application data |
| L4_CV void l4slab_set_data | ( | l4slab_cache_t * | cache, | |
| void * | data | |||
| ) |
Set cache application data pointer.
| cache | Cache descriptor | |
| data | Application data pointer |
| L4_CV void* l4slab_get_data | ( | l4slab_cache_t * | cache | ) |
Get cache application data.
| cache | Cache descriptor |