1*6a54128fSAndroid Build Coastguard Worker #ifndef BLOCK_RANGE_H 2*6a54128fSAndroid Build Coastguard Worker # define BLOCK_RANGE_H 3*6a54128fSAndroid Build Coastguard Worker 4*6a54128fSAndroid Build Coastguard Worker # include <sys/types.h> 5*6a54128fSAndroid Build Coastguard Worker # include <ext2fs/ext2fs.h> 6*6a54128fSAndroid Build Coastguard Worker 7*6a54128fSAndroid Build Coastguard Worker struct block_range { 8*6a54128fSAndroid Build Coastguard Worker blk64_t start; 9*6a54128fSAndroid Build Coastguard Worker blk64_t end; 10*6a54128fSAndroid Build Coastguard Worker struct block_range *next; 11*6a54128fSAndroid Build Coastguard Worker }; 12*6a54128fSAndroid Build Coastguard Worker 13*6a54128fSAndroid Build Coastguard Worker struct block_range_list { 14*6a54128fSAndroid Build Coastguard Worker struct block_range *head; 15*6a54128fSAndroid Build Coastguard Worker struct block_range *tail; 16*6a54128fSAndroid Build Coastguard Worker }; 17*6a54128fSAndroid Build Coastguard Worker 18*6a54128fSAndroid Build Coastguard Worker void add_blocks_to_range(struct block_range_list *list, blk64_t blk_start, 19*6a54128fSAndroid Build Coastguard Worker blk64_t blk_end); 20*6a54128fSAndroid Build Coastguard Worker void delete_block_ranges(struct block_range_list *list); 21*6a54128fSAndroid Build Coastguard Worker int write_block_ranges(FILE *f, struct block_range *range, char *sep); 22*6a54128fSAndroid Build Coastguard Worker 23*6a54128fSAndroid Build Coastguard Worker /* 24*6a54128fSAndroid Build Coastguard Worker * Given a non-empty range list, return the next block and remove it from the 25*6a54128fSAndroid Build Coastguard Worker * list. 26*6a54128fSAndroid Build Coastguard Worker */ 27*6a54128fSAndroid Build Coastguard Worker blk64_t consume_next_block(struct block_range_list *list); 28*6a54128fSAndroid Build Coastguard Worker 29*6a54128fSAndroid Build Coastguard Worker #endif /* !BLOCK_RANGE_H */ 30