41 _pool_init_fixed (
void **pool_ptr,
u32 elt_size,
u32 max_elts)
59 + (
u64) elt_size *max_elts;
70 total_size = vector_size + free_index_size;
74 total_size = (total_size + page_size - 1) & ~(page_size - 1);
78 mmap_base = mmap (0, total_size, PROT_READ | PROT_WRITE,
79 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
81 if (mmap_base == MAP_FAILED)
104 fi = (
u32 *) (vh + 1);
115 for (i = max_elts; i < set_bits; i++)
119 for (i = 0; i < max_elts; i++)
120 fi[i] = (max_elts - 1) -
i;
Fixed length block allocator.
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap. ...
memset(h->entries, 0, sizeof(h->entries[0])*entries)
static uword vec_header_bytes(uword header_bytes)
#define clib_bitmap_alloc(v, n_bits)
Allocate a bitmap with the supplied number of bits.
#define pool_aligned_header_bytes
Align pool header so that pointers are naturally aligned.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define clib_unix_warning(format, args...)
#define CLIB_CACHE_LINE_BYTES
uword clib_mem_get_page_size(void)