Exemple #1
0
void read_bitmap(char* device, file_system_info fs_info, unsigned long* bitmap, int pui)
{
    off_t a = 0, b = 0;
    off_t block = 0;;
    int start = 0;
    int bit_size = 1;

    pc_init_bitmap(bitmap, 0x00, fs_info.totalblock);

    fs_open(device);
    /// init progress
    progress_bar   prog;	/// progress_bar structure defined in progress.h
    progress_init(&prog, start, fs_info.totalblock, fs_info.totalblock, BITMAP, bit_size);
    pc_init_bitmap(bitmap, 0x00, fs_info.totalblock);

    while (exfat_find_used_sectors(&ef, &a, &b) == 0) {
        printf("block %" PRId64 " %" PRId64 " \n", a, b);
        for (block = a; block <= b; block++) {
            pc_set_bit((uint64_t)block, bitmap);
            log_mesg(3, 0, 0, fs_opt.debug, "%s: used block %" PRId64 " \n", __FILE__, block);
            /// update progress
            update_pui(&prog, block, block, 0);
        }
    }

    fs_close();
    /// update progress
    update_pui(&prog, 1, 1, 1);
}
Exemple #2
0
static void dump_sectors(struct exfat* ef)
{
	off_t a = 0, b = 0;

	printf("Used sectors ");
	while (exfat_find_used_sectors(ef, &a, &b) == 0)
		printf(" %"PRIu64"-%"PRIu64, a, b);
	puts("");
}