X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fbuddy.h;h=163c5a82ffaf0f218b62c7eb5e5a5b48470b1cb4;hb=d0aa5bd27c22a33f04f47363910f9773fdeab7eb;hp=54c24a72e4f0dc95c7979745a627f88fbbd5af01;hpb=a61cac5cf9cf6beb6dccec02b94bb5a37429e7fb;p=palacios.git diff --git a/linux_module/buddy.h b/linux_module/buddy.h index 54c24a7..163c5a8 100644 --- a/linux_module/buddy.h +++ b/linux_module/buddy.h @@ -48,6 +48,8 @@ struct buddy_mempool { */ unsigned long num_free_blocks; + + void *user_metadata; // whatever the user wants struct rb_node tree_node; }; @@ -71,30 +73,36 @@ buddy_init(unsigned long pool_order, unsigned int node_id); extern void -buddy_deinit(struct buddy_memzone * zone); +buddy_deinit(struct buddy_memzone * zone, + int (*free_callback)(void *user_metadata)); /* Add pool at given physical address */ extern int buddy_add_pool(struct buddy_memzone * zone, unsigned long base_addr, - unsigned long pool_order); + unsigned long pool_order, + void *user_metadata); /* Remove pool based at given physical address */ extern int buddy_remove_pool(struct buddy_memzone * zone, unsigned long base_addr, - unsigned char force); + unsigned char force, + void **user_metadata); + /* Allocate pages, returns physical address */ extern uintptr_t buddy_alloc(struct buddy_memzone * zone, - unsigned long order); + unsigned long order, + int (*filter_func)(void *paddr, void *filter_state), + void *filter_state); /* Free a physical address */ -extern void +extern int buddy_free(struct buddy_memzone * zone, uintptr_t addr, unsigned long order);