Rev 822 | Rev 1229 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 822 | Rev 1139 | ||
---|---|---|---|
Line 32... | Line 32... | ||
32 | #include <arch/types.h> |
32 | #include <arch/types.h> |
33 | #include <typedefs.h> |
33 | #include <typedefs.h> |
34 | 34 | ||
35 | #define BUDDY_SYSTEM_INNER_BLOCK 0xff |
35 | #define BUDDY_SYSTEM_INNER_BLOCK 0xff |
36 | 36 | ||
37 | /** Buddy system operations to be implemented by each implementations. */ |
37 | /** Buddy system operations to be implemented by each implementation. */ |
38 | struct buddy_system_operations { |
38 | struct buddy_system_operations { |
39 | link_t *(* find_buddy)(buddy_system_t *, link_t *); /**< Return pointer to left-side or right-side buddy for block passed as argument. */ |
39 | link_t *(* find_buddy)(buddy_system_t *, link_t *); /**< Return pointer to left-side or right-side buddy for block passed as argument. */ |
40 | link_t *(* bisect)(buddy_system_t *, link_t *); /**< Bisect the block passed as argument and return pointer to the new right-side buddy. */ |
40 | link_t *(* bisect)(buddy_system_t *, link_t *); /**< Bisect the block passed as argument and return pointer to the new right-side buddy. */ |
41 | link_t *(* coalesce)(buddy_system_t *, link_t *, link_t *); /**< Coalesce two buddies into a bigger block. */ |
41 | link_t *(* coalesce)(buddy_system_t *, link_t *, link_t *); /**< Coalesce two buddies into a bigger block. */ |
42 | void (*set_order)(buddy_system_t *, link_t *, __u8); /**< Set order of block passed as argument. */ |
42 | void (*set_order)(buddy_system_t *, link_t *, __u8); /**< Set order of block passed as argument. */ |
43 | __u8 (*get_order)(buddy_system_t *, link_t *); /**< Return order of block passed as argument. */ |
43 | __u8 (*get_order)(buddy_system_t *, link_t *); /**< Return order of block passed as argument. */ |
44 | void (*mark_busy)(buddy_system_t *, link_t *); /**< Mark block as busy */ |
44 | void (*mark_busy)(buddy_system_t *, link_t *); /**< Mark block as busy */ |
45 | void (*mark_available)(buddy_system_t *, link_t *); /**< Mark block as busy */ |
45 | void (*mark_available)(buddy_system_t *, link_t *); /**< Mark block as busy */ |
46 | /** Find parent of block that has given order */ |
46 | /** Find parent of block that has given order */ |
47 | link_t *(* find_block)(buddy_system_t *, link_t *, __u8); |
47 | link_t *(* find_block)(buddy_system_t *, link_t *, __u8); |
48 | void (* print_id)(buddy_system_t *, link_t *); |
48 | void (* print_id)(buddy_system_t *, link_t *); |
49 | }; |
49 | }; |
50 | 50 |