Lines Matching refs:bitmap
71 static void warn_bitmap(ext2fs_generic_bitmap_64 bitmap, in warn_bitmap() argument
75 if (bitmap->description) in warn_bitmap()
76 com_err(0, bitmap->base_error_code+code, in warn_bitmap()
77 "#%llu for %s", arg, bitmap->description); in warn_bitmap()
79 com_err(0, bitmap->base_error_code + code, "#%llu", arg); in warn_bitmap()
96 ext2fs_generic_bitmap_64 bitmap; in ext2fs_alloc_generic_bmap() local
123 &bitmap); in ext2fs_alloc_generic_bmap()
128 if (gettimeofday(&bitmap->stats.created, in ext2fs_alloc_generic_bmap()
131 ext2fs_free_mem(&bitmap); in ext2fs_alloc_generic_bmap()
134 bitmap->stats.type = type; in ext2fs_alloc_generic_bmap()
138 bitmap->magic = magic; in ext2fs_alloc_generic_bmap()
139 bitmap->fs = fs; in ext2fs_alloc_generic_bmap()
140 bitmap->start = start; in ext2fs_alloc_generic_bmap()
141 bitmap->end = end; in ext2fs_alloc_generic_bmap()
142 bitmap->real_end = real_end; in ext2fs_alloc_generic_bmap()
143 bitmap->bitmap_ops = ops; in ext2fs_alloc_generic_bmap()
144 bitmap->cluster_bits = 0; in ext2fs_alloc_generic_bmap()
147 bitmap->base_error_code = EXT2_ET_BAD_INODE_MARK; in ext2fs_alloc_generic_bmap()
150 bitmap->base_error_code = EXT2_ET_BAD_BLOCK_MARK; in ext2fs_alloc_generic_bmap()
151 bitmap->cluster_bits = fs->cluster_ratio_bits; in ext2fs_alloc_generic_bmap()
154 bitmap->base_error_code = EXT2_ET_BAD_GENERIC_MARK; in ext2fs_alloc_generic_bmap()
157 retval = ext2fs_get_mem(strlen(descr)+1, &bitmap->description); in ext2fs_alloc_generic_bmap()
159 ext2fs_free_mem(&bitmap); in ext2fs_alloc_generic_bmap()
162 strcpy(bitmap->description, descr); in ext2fs_alloc_generic_bmap()
164 bitmap->description = 0; in ext2fs_alloc_generic_bmap()
166 retval = bitmap->bitmap_ops->new_bmap(fs, bitmap); in ext2fs_alloc_generic_bmap()
168 ext2fs_free_mem(&bitmap->description); in ext2fs_alloc_generic_bmap()
169 ext2fs_free_mem(&bitmap); in ext2fs_alloc_generic_bmap()
173 *ret = (ext2fs_generic_bitmap) bitmap; in ext2fs_alloc_generic_bmap()
178 static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap) in ext2fs_print_bmap_statistics() argument
180 struct ext2_bmap_statistics *stats = &bitmap->stats; in ext2fs_print_bmap_statistics()
214 fprintf(stderr, "\n[+] %s bitmap (type %d)\n", bitmap->description, in ext2fs_print_bmap_statistics()
219 bitmap->real_end - bitmap->start); in ext2fs_print_bmap_statistics()
372 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_fudge_generic_bmap_end() local
374 if (!bitmap) in ext2fs_fudge_generic_bmap_end()
377 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_fudge_generic_bmap_end()
382 bitmap->magic, in ext2fs_fudge_generic_bmap_end()
389 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_fudge_generic_bmap_end()
392 if (end > bitmap->real_end) in ext2fs_fudge_generic_bmap_end()
395 *oend = bitmap->end; in ext2fs_fudge_generic_bmap_end()
396 bitmap->end = end; in ext2fs_fudge_generic_bmap_end()
402 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_get_generic_bmap_start() local
404 if (!bitmap) in ext2fs_get_generic_bmap_start()
407 if (EXT2FS_IS_32_BITMAP(bitmap)) in ext2fs_get_generic_bmap_start()
410 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_get_generic_bmap_start()
413 return bitmap->start; in ext2fs_get_generic_bmap_start()
418 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_get_generic_bmap_end() local
420 if (!bitmap) in ext2fs_get_generic_bmap_end()
423 if (EXT2FS_IS_32_BITMAP(bitmap)) in ext2fs_get_generic_bmap_end()
426 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_get_generic_bmap_end()
429 return bitmap->end; in ext2fs_get_generic_bmap_end()
434 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_clear_generic_bmap() local
436 if (EXT2FS_IS_32_BITMAP(bitmap)) in ext2fs_clear_generic_bmap()
439 bitmap->bitmap_ops->clear_bmap(bitmap); in ext2fs_clear_generic_bmap()
445 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_mark_generic_bmap() local
447 if (!bitmap) in ext2fs_mark_generic_bmap()
450 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_mark_generic_bmap()
459 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_mark_generic_bmap()
462 arg >>= bitmap->cluster_bits; in ext2fs_mark_generic_bmap()
465 if (arg == bitmap->stats.last_marked + 1) in ext2fs_mark_generic_bmap()
466 bitmap->stats.mark_seq++; in ext2fs_mark_generic_bmap()
467 if (arg < bitmap->stats.last_marked) in ext2fs_mark_generic_bmap()
468 bitmap->stats.mark_back++; in ext2fs_mark_generic_bmap()
469 bitmap->stats.last_marked = arg; in ext2fs_mark_generic_bmap()
470 bitmap->stats.mark_count++; in ext2fs_mark_generic_bmap()
473 if ((arg < bitmap->start) || (arg > bitmap->end)) { in ext2fs_mark_generic_bmap()
474 warn_bitmap(bitmap, EXT2FS_MARK_ERROR, arg); in ext2fs_mark_generic_bmap()
478 return bitmap->bitmap_ops->mark_bmap(bitmap, arg); in ext2fs_mark_generic_bmap()
484 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_unmark_generic_bmap() local
486 if (!bitmap) in ext2fs_unmark_generic_bmap()
489 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_unmark_generic_bmap()
498 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_unmark_generic_bmap()
501 arg >>= bitmap->cluster_bits; in ext2fs_unmark_generic_bmap()
503 INC_STAT(bitmap, unmark_count); in ext2fs_unmark_generic_bmap()
505 if ((arg < bitmap->start) || (arg > bitmap->end)) { in ext2fs_unmark_generic_bmap()
506 warn_bitmap(bitmap, EXT2FS_UNMARK_ERROR, arg); in ext2fs_unmark_generic_bmap()
510 return bitmap->bitmap_ops->unmark_bmap(bitmap, arg); in ext2fs_unmark_generic_bmap()
516 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_test_generic_bmap() local
517 if (!bitmap) in ext2fs_test_generic_bmap()
520 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_test_generic_bmap()
529 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_test_generic_bmap()
532 arg >>= bitmap->cluster_bits; in ext2fs_test_generic_bmap()
535 bitmap->stats.test_count++; in ext2fs_test_generic_bmap()
536 if (arg == bitmap->stats.last_tested + 1) in ext2fs_test_generic_bmap()
537 bitmap->stats.test_seq++; in ext2fs_test_generic_bmap()
538 if (arg < bitmap->stats.last_tested) in ext2fs_test_generic_bmap()
539 bitmap->stats.test_back++; in ext2fs_test_generic_bmap()
540 bitmap->stats.last_tested = arg; in ext2fs_test_generic_bmap()
543 if ((arg < bitmap->start) || (arg > bitmap->end)) { in ext2fs_test_generic_bmap()
544 warn_bitmap(bitmap, EXT2FS_TEST_ERROR, arg); in ext2fs_test_generic_bmap()
548 return bitmap->bitmap_ops->test_bmap(bitmap, arg); in ext2fs_test_generic_bmap()
777 ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap; in ext2fs_warn_bitmap32() local
780 if (bitmap && bitmap->description) in ext2fs_warn_bitmap32()
783 bitmap->description); in ext2fs_warn_bitmap32()
791 ext2fs_block_bitmap *bitmap) in ext2fs_convert_subcluster_bitmap() argument
794 ext2fs_block_bitmap gen_bmap = *bitmap, gen_cmap; in ext2fs_convert_subcluster_bitmap()
830 *bitmap = (ext2fs_block_bitmap) cmap; in ext2fs_convert_subcluster_bitmap()
834 errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap, in ext2fs_find_first_zero_generic_bmap() argument
837 ext2fs_generic_bitmap_64 bmap64 = (ext2fs_generic_bitmap_64) bitmap; in ext2fs_find_first_zero_generic_bmap()
841 if (!bitmap) in ext2fs_find_first_zero_generic_bmap()
844 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_find_first_zero_generic_bmap()
849 ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, start); in ext2fs_find_first_zero_generic_bmap()
853 retval = ext2fs_find_first_zero_generic_bitmap(bitmap, start, in ext2fs_find_first_zero_generic_bmap()
860 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_find_first_zero_generic_bmap()
889 errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap, in ext2fs_find_first_set_generic_bmap() argument
892 ext2fs_generic_bitmap_64 bmap64 = (ext2fs_generic_bitmap_64) bitmap; in ext2fs_find_first_set_generic_bmap()
896 if (!bitmap) in ext2fs_find_first_set_generic_bmap()
899 if (EXT2FS_IS_32_BITMAP(bitmap)) { in ext2fs_find_first_set_generic_bmap()
904 ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, start); in ext2fs_find_first_set_generic_bmap()
908 retval = ext2fs_find_first_set_generic_bitmap(bitmap, start, in ext2fs_find_first_set_generic_bmap()
915 if (!EXT2FS_IS_64_BITMAP(bitmap)) in ext2fs_find_first_set_generic_bmap()