]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/mempool.h
exit-status: drop EXIT_MAKE_STARTER
[thirdparty/systemd.git] / src / basic / mempool.h
CommitLineData
b3dcf58e
MS
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2011-2014 Lennart Poettering
7 Copyright 2014 Michal Schmidt
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include <stddef.h>
24
25struct pool;
26
27struct mempool {
28 struct pool *first_pool;
29 void *freelist;
30 size_t tile_size;
31 unsigned at_least;
32};
33
34void* mempool_alloc_tile(struct mempool *mp);
52fc5ce3 35void* mempool_alloc0_tile(struct mempool *mp);
b3dcf58e
MS
36void mempool_free_tile(struct mempool *mp, void *p);
37
38#define DEFINE_MEMPOOL(pool_name, tile_type, alloc_at_least) \
dd422d1e 39static struct mempool pool_name = { \
b3dcf58e
MS
40 .tile_size = sizeof(tile_type), \
41 .at_least = alloc_at_least, \
42}
43
44
45#ifdef VALGRIND
46void mempool_drop(struct mempool *mp);
47#endif