Home | History | Annotate | Download | only in ext4_utils

Lines Matching full:alloc

71 	struct block_allocation *alloc = malloc(sizeof(struct block_allocation));
72 alloc->list.first = NULL;
73 alloc->list.last = NULL;
74 alloc->oob_list.first = NULL;
75 alloc->oob_list.last = NULL;
76 alloc->list.iter = NULL;
77 alloc->list.partial_iter = 0;
78 alloc->oob_list.iter = NULL;
79 alloc->oob_list.partial_iter = 0;
80 return alloc;
147 static void dump_region_lists(struct block_allocation *alloc) {
150 dump_starting_from(alloc->list.first);
153 dump_starting_from(alloc->oob_list.first);
157 void append_region(struct block_allocation *alloc,
167 region_list_append(&alloc->list, reg);
257 void reduce_allocation(struct block_allocation *alloc, u32 len)
260 struct region *last_reg = alloc->list.last;
267 struct region *reg = alloc->list.last->prev;
273 alloc->list.first = NULL;
274 alloc->list.last = NULL;
275 alloc->list.iter = NULL;
276 alloc->list.partial_iter = 0;
485 struct block_allocation *alloc = create_allocation();
486 alloc->list.first = reg;
487 alloc->list.last = reg;
488 alloc->list.iter = alloc->list.first;
489 alloc->list.partial_iter = 0;
490 return alloc;
494 int block_allocation_num_regions(struct block_allocation *alloc)
497 struct region *reg = alloc->list.first;
505 int block_allocation_len(struct block_allocation *alloc)
508 struct region *reg = alloc->list.first;
517 u32 get_block(struct block_allocation *alloc, u32 block)
519 struct region *reg = alloc->list.iter;
520 block += alloc->list.partial_iter;
530 u32 get_oob_block(struct block_allocation *alloc, u32 block)
532 struct region *reg = alloc->oob_list.iter;
533 block += alloc->oob_list.partial_iter;
545 void get_region(struct block_allocation *alloc, u32 *block, u32 *len)
547 *block = alloc->list.iter->block;
548 *len = alloc->list.iter->len - alloc->list.partial_iter;
552 void get_next_region(struct block_allocation *alloc)
554 alloc->list.iter = alloc->list.iter->next;
555 alloc->list.partial_iter = 0;
564 int last_region(struct block_allocation *alloc)
566 return (alloc->list.iter == NULL);
569 void rewind_alloc(struct block_allocation *alloc)
571 alloc->list.iter = alloc->list.first;
572 alloc->list.partial_iter = 0;
575 static struct region *do_split_allocation(struct block_allocation *alloc, u32 len)
577 struct region *reg = alloc->list.iter;
601 tmp = alloc->list.iter;
602 alloc->list.iter = new;
612 static struct region *split_allocation(struct block_allocation *alloc, u32 len)
615 do_split_allocation(alloc, alloc->list.partial_iter);
618 struct region *middle = do_split_allocation(alloc, len);
619 alloc->list.partial_iter = 0;
624 int reserve_oob_blocks(struct block_allocation *alloc, int blocks)
626 struct region *oob = split_allocation(alloc, blocks);
632 while (oob && oob != alloc->list.iter) {
634 region_list_remove(&alloc->list, oob);
635 region_list_append(&alloc->oob_list, oob);
664 int advance_blocks(struct block_allocation *alloc, int blocks)
666 return advance_list_ptr(&alloc->list, blocks);
669 int advance_oob_blocks(struct block_allocation *alloc, int blocks)
671 return advance_list_ptr(&alloc->oob_list, blocks);
674 int append_oob_allocation(struct block_allocation *alloc, u32 len)
684 region_list_append(&alloc->oob_list, reg);
794 void free_alloc(struct block_allocation *alloc)
798 reg = alloc->list.first;
805 reg = alloc->oob_list.first;
812 free(alloc);