Subversion Repositories HelenOS

Rev

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

Rev 1787 Rev 1888
Line 24... Line 24...
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
 /** @addtogroup genericmm
29
/** @addtogroup genericmm
30
 * @{
30
 * @{
31
 */
31
 */
32
/** @file
32
/** @file
33
 */
33
 */
34
 
34
 
35
#ifndef __BUDDY_H__
35
#ifndef KERN_BUDDY_H_
36
#define __BUDDY_H__
36
#define KERN_BUDDY_H_
37
 
37
 
38
#include <arch/types.h>
38
#include <arch/types.h>
39
#include <typedefs.h>
39
#include <typedefs.h>
40
 
40
 
41
#define BUDDY_SYSTEM_INNER_BLOCK    0xff
41
#define BUDDY_SYSTEM_INNER_BLOCK    0xff
Line 53... Line 53...
53
    link_t *(* find_block)(buddy_system_t *, link_t *, uint8_t);
53
    link_t *(* find_block)(buddy_system_t *, link_t *, uint8_t);
54
    void (* print_id)(buddy_system_t *, link_t *);
54
    void (* print_id)(buddy_system_t *, link_t *);
55
};
55
};
56
 
56
 
57
struct buddy_system {
57
struct buddy_system {
58
    uint8_t max_order;              /**< Maximal order of block which can be stored by buddy system. */
58
    uint8_t max_order;      /**< Maximal order of block which can be stored by buddy system. */
59
    link_t *order;
59
    link_t *order;
60
    buddy_system_operations_t *op;
60
    buddy_system_operations_t *op;
61
    void *data;             /**< Pointer to be used by the implementation. */
61
    void *data;         /**< Pointer to be used by the implementation. */
62
};
62
};
63
 
63
 
64
extern void buddy_system_create(buddy_system_t *b,
64
extern void buddy_system_create(buddy_system_t *b,
65
                uint8_t max_order,
65
                uint8_t max_order,
66
                buddy_system_operations_t *op, void *data);
66
                buddy_system_operations_t *op, void *data);
Line 71... Line 71...
71
extern size_t buddy_conf_size(int max_order);
71
extern size_t buddy_conf_size(int max_order);
72
extern link_t *buddy_system_alloc_block(buddy_system_t *b, link_t *block);
72
extern link_t *buddy_system_alloc_block(buddy_system_t *b, link_t *block);
73
 
73
 
74
#endif
74
#endif
75
 
75
 
76
 /** @}
76
/** @}
77
 */
77
 */
78
 
-