1 #include <lunaix/fs/twifs.h>
2 #include <lunaix/mm/cake.h>
4 extern struct llist_header piles;
7 __twimap_gonext_pinkiepie(struct twimap* map)
9 struct cake_pile* pile = twimap_index(map, struct cake_pile*);
10 if (pile->piles.next == &piles) {
13 map->index = list_entry(pile->piles.next, struct cake_pile, piles);
18 __twimap_reset_pinkiepie(struct twimap* map)
20 map->index = container_of(&piles, struct cake_pile, piles);
21 twimap_printf(map, "name cakes pages size slices actives\n");
25 __twimap_read_pinkiepie(struct twimap* map)
27 struct cake_pile* pos = twimap_index(map, struct cake_pile*);
29 "%s %d %d %d %d %d\n",
39 __twimap_read_piece_size(struct twimap* map)
41 struct cake_pile* pile = twimap_data(map, struct cake_pile*);
42 twimap_printf(map, "%u", pile->piece_size);
46 __twimap_read_cake_count(struct twimap* map)
48 struct cake_pile* pile = twimap_data(map, struct cake_pile*);
49 twimap_printf(map, "%u", pile->cakes_count);
53 __twimap_read_grabbed(struct twimap* map)
55 struct cake_pile* pile = twimap_data(map, struct cake_pile*);
56 twimap_printf(map, "%u", pile->alloced_pieces);
60 __twimap_read_pieces_per_cake(struct twimap* map)
62 struct cake_pile* pile = twimap_data(map, struct cake_pile*);
63 twimap_printf(map, "%u", pile->pieces_per_cake);
67 __twimap_read_page_per_cake(struct twimap* map)
69 struct cake_pile* pile = twimap_data(map, struct cake_pile*);
70 twimap_printf(map, "%u", pile->pg_per_cake);
74 cake_export_pile(struct twifs_node* root, struct cake_pile* pile)
76 struct twifs_node* pile_rt;
78 pile_rt = twifs_dir_node(root, pile->pile_name);
80 twimap_export_value(pile_rt, piece_size, FSACL_ugR, pile);
81 twimap_export_value(pile_rt, cake_count, FSACL_ugR, pile);
82 twimap_export_value(pile_rt, grabbed, FSACL_ugR, pile);
83 twimap_export_value(pile_rt, pieces_per_cake, FSACL_ugR, pile);
84 twimap_export_value(pile_rt, page_per_cake, FSACL_ugR, pile);
90 struct cake_pile *pos, *n;
91 struct twifs_node* cake_root;
93 cake_root = twifs_dir_node(NULL, "cake");
95 twimap_export_list(cake_root, pinkiepie, FSACL_ugR, NULL);
97 llist_for_each(pos, n, &piles, piles) {
98 cake_export_pile(cake_root, pos);
101 EXPORT_TWIFS_PLUGIN(cake_alloc, cake_export);