]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/mempool.h
meson: make user $PATH configurable
[thirdparty/systemd.git] / src / basic / mempool.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
b3dcf58e
MS
2#pragma once
3
a5d8835c 4#include <stdbool.h>
b3dcf58e
MS
5#include <stddef.h>
6
7struct pool;
8
9struct mempool {
10 struct pool *first_pool;
11 void *freelist;
12 size_t tile_size;
13 unsigned at_least;
14};
15
16void* mempool_alloc_tile(struct mempool *mp);
52fc5ce3 17void* mempool_alloc0_tile(struct mempool *mp);
b3dcf58e
MS
18void mempool_free_tile(struct mempool *mp, void *p);
19
20#define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \
dd422d1e 21static struct mempool pool_name = { \
b3dcf58e
MS
22 .tile_size = sizeof(tile_type), \
23 .at_least = alloc_at_least, \
24}
25
a5d8835c 26extern const bool mempool_use_allowed;
7c48ea02
ZJS
27bool mempool_enabled(void);
28
d18cb393 29#if VALGRIND
b3dcf58e
MS
30void mempool_drop(struct mempool *mp);
31#endif