X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/a4ec38a4c7ef61b04b92d34637c846a8e2e95f7f..ea77b9c3fc7fb9bf9d7f9604fc187c8049212a2a:/lunaix-os/includes/lunaix/mm/cake.h diff --git a/lunaix-os/includes/lunaix/mm/cake.h b/lunaix-os/includes/lunaix/mm/cake.h index 6a3aa39..81321f8 100644 --- a/lunaix-os/includes/lunaix/mm/cake.h +++ b/lunaix-os/includes/lunaix/mm/cake.h @@ -7,6 +7,10 @@ #define PILE_CACHELINE 1 +struct cake_pile; + +typedef void (*pile_cb)(struct cake_pile*, void*); + struct cake_pile { struct llist_header piles; @@ -20,6 +24,8 @@ struct cake_pile unsigned int pieces_per_cake; unsigned int pg_per_cake; char pile_name[PILE_NAME_MAXLEN]; + + pile_cb ctor; }; typedef unsigned int piece_index_t; @@ -49,6 +55,9 @@ cake_new_pile(char* name, unsigned int pg_per_cake, int options); +void +cake_set_constructor(struct cake_pile* pile, pile_cb ctor); + /** * @brief 拿一块儿蛋糕 * @@ -73,4 +82,9 @@ cake_init(); void cake_export(); +/********** some handy constructor ***********/ + +void +cake_ctor_zeroing(struct cake_pile* pile, void* piece); + #endif /* __LUNAIX_VALLOC_H */