]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
b3dcf58e MS |
2 | #pragma once |
3 | ||
4 | /*** | |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2011-2014 Lennart Poettering | |
8 | Copyright 2014 Michal Schmidt | |
b3dcf58e MS |
9 | ***/ |
10 | ||
11 | #include <stddef.h> | |
12 | ||
13 | struct pool; | |
14 | ||
15 | struct mempool { | |
16 | struct pool *first_pool; | |
17 | void *freelist; | |
18 | size_t tile_size; | |
19 | unsigned at_least; | |
20 | }; | |
21 | ||
22 | void* mempool_alloc_tile(struct mempool *mp); | |
52fc5ce3 | 23 | void* mempool_alloc0_tile(struct mempool *mp); |
b3dcf58e MS |
24 | void mempool_free_tile(struct mempool *mp, void *p); |
25 | ||
26 | #define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \ | |
dd422d1e | 27 | static struct mempool pool_name = { \ |
b3dcf58e MS |
28 | .tile_size = sizeof(tile_type), \ |
29 | .at_least = alloc_at_least, \ | |
30 | } | |
31 | ||
32 | ||
d18cb393 | 33 | #if VALGRIND |
b3dcf58e MS |
34 | void mempool_drop(struct mempool *mp); |
35 | #endif |