-
Notifications
You must be signed in to change notification settings - Fork 36
/
buddy.h
55 lines (47 loc) · 968 Bytes
/
buddy.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
/*_
* Copyright (c) 2014-2015 Hirochika Asai <[email protected]>
* All rights reserved.
*/
#include "poptrie.h"
#include <stdlib.h>
#ifndef _POPTRIE_BUDDY_H
#define _POPTRIE_BUDDY_H
/*
* Buddy system
*/
struct buddy {
/* Size of buddy system (# of blocks) */
int sz;
/* Size of each block */
int bsz;
/* Bitmap */
u8 *b;
/* Memory blocks */
void *blocks;
/* Level */
int level;
/* Heads */
u32 *buddy;
};
#ifdef __cplusplus
extern "C" {
#endif
/* buddy.c */
int buddy_init(struct buddy *, int, int, int);
void buddy_release(struct buddy *);
void * buddy_alloc(struct buddy *, int);
int buddy_alloc2(struct buddy *, int);
void buddy_free(struct buddy *, void *);
void buddy_free2(struct buddy *, int);
#ifdef __cplusplus
}
#endif
#endif /* _POPTRIE_BUDDY_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/