forked from skaphan/stmmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsegalloc.h
57 lines (34 loc) · 1.48 KB
/
segalloc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
segalloc.h
This is the interface to the low-level memory allocator for memory segments.
It knows nothing of the STM package or any of its objects. It is used by stmalloc.c.
You probably won't need to access this API.
Copyright 2009 Shel Kaphan
This file is part of stmmap.
stmmap is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
stmmap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with stmmap. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
struct segalloc_node;
void *seg_alloc_init(void *base_va, size_t size, int mode);
void *seg_alloc(size_t size, void *free_list_addr);
void seg_free(void *object_va, size_t size, void *base_va, void *free_list_addr);
size_t seg_block_size_for(size_t size);
// some diagnostic routines:
int seg_verify_tree_integrity(struct segalloc_node *free_list);
void seg_print_free_list(struct segalloc_node*);
struct segalloc_node* seg_free_list_from_free_list_addr(void *free_list_addr);
#ifdef __cplusplus
};
#endif