*/
struct pool_registration {
struct list list; /* link element */
- char name[12]; /* name of the pool */
+ const char *name; /* name of the pool */
unsigned int size; /* expected object size */
unsigned int flags; /* MEM_F_* */
unsigned int align; /* expected alignment; 0=unspecified */
unsigned long long pool_total_used(void);
void pool_flush(struct pool_head *pool);
void pool_gc(struct pool_head *pool_ctx);
-struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags);
-struct pool_head *create_pool_from_reg(char *name, struct pool_registration *reg);
+struct pool_head *create_pool(const char *name, unsigned int size, unsigned int flags);
+struct pool_head *create_pool_from_reg(const char *name, struct pool_registration *reg);
void create_pool_callback(struct pool_head **ptr, char *name, unsigned int size);
void *pool_destroy(struct pool_head *pool);
void pool_destroy_all(void);
* is available for a new creation. Two flags are supported :
* - MEM_F_SHARED to indicate that the pool may be shared with other users
* - MEM_F_EXACT to indicate that the size must not be rounded up
+ * The name must be a stable pointer during all the program's life time.
*/
-struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
+struct pool_head *create_pool(const char *name, unsigned int size, unsigned int flags)
{
struct pool_registration *reg;
struct pool_head *pool;
if (!reg)
return NULL;
- strlcpy2(reg->name, name, sizeof(reg->name));
+ reg->name = name;
reg->size = size;
reg->flags = flags;
reg->align = 0;
/* create a pool from a pool registration. All configuration is taken from
* there.
*/
-struct pool_head *create_pool_from_reg(char *name, struct pool_registration *reg)
+struct pool_head *create_pool_from_reg(const char *name, struct pool_registration *reg)
{
unsigned int extra_mark, extra_caller, extra;
unsigned int flags = reg->flags;