Subversion Repositories HelenOS

Rev

Rev 2787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2787 Rev 3425
Line 64... Line 64...
64
    void (*mark_busy)(struct buddy_system *, link_t *);
64
    void (*mark_busy)(struct buddy_system *, link_t *);
65
    /** Mark block as available. */
65
    /** Mark block as available. */
66
    void (*mark_available)(struct buddy_system *, link_t *);
66
    void (*mark_available)(struct buddy_system *, link_t *);
67
    /** Find parent of block that has given order  */
67
    /** Find parent of block that has given order  */
68
    link_t *(* find_block)(struct buddy_system *, link_t *, uint8_t);
68
    link_t *(* find_block)(struct buddy_system *, link_t *, uint8_t);
69
    void (* print_id)(struct buddy_system *, link_t *);
-
 
70
} buddy_system_operations_t;
69
} buddy_system_operations_t;
71
 
70
 
72
typedef struct buddy_system {
71
typedef struct buddy_system {
73
    /** Maximal order of block which can be stored by buddy system. */
72
    /** Maximal order of block which can be stored by buddy system. */
74
    uint8_t max_order;
73
    uint8_t max_order;
Line 76... Line 75...
76
    buddy_system_operations_t *op;
75
    buddy_system_operations_t *op;
77
    /** Pointer to be used by the implementation. */
76
    /** Pointer to be used by the implementation. */
78
    void *data;
77
    void *data;
79
} buddy_system_t;
78
} buddy_system_t;
80
 
79
 
81
extern void buddy_system_create(buddy_system_t *b, uint8_t max_order,
80
extern void buddy_system_create(buddy_system_t *, uint8_t,
82
    buddy_system_operations_t *op, void *data);
81
    buddy_system_operations_t *, void *);
83
extern link_t *buddy_system_alloc(buddy_system_t *b, uint8_t i);
82
extern link_t *buddy_system_alloc(buddy_system_t *, uint8_t);
84
extern bool buddy_system_can_alloc(buddy_system_t *b, uint8_t order);
83
extern bool buddy_system_can_alloc(buddy_system_t *, uint8_t);
85
extern void buddy_system_free(buddy_system_t *b, link_t *block);
84
extern void buddy_system_free(buddy_system_t *, link_t *);
86
extern void buddy_system_structure_print(buddy_system_t *b, size_t elem_size);
-
 
87
extern size_t buddy_conf_size(int max_order);
85
extern size_t buddy_conf_size(int);
88
extern link_t *buddy_system_alloc_block(buddy_system_t *b, link_t *block);
86
extern link_t *buddy_system_alloc_block(buddy_system_t *, link_t *);
89
 
87
 
90
#endif
88
#endif
91
 
89
 
92
/** @}
90
/** @}
93
 */
91
 */