From 73193347133e750faf27f88fd3ab31ce43aff062 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Tue, 21 May 2024 06:59:33 +0200 Subject: Adding upstream version 1.47.1. Signed-off-by: Daniel Baumann --- lib/ext2fs/gen_bitmap64.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'lib/ext2fs/gen_bitmap64.c') diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c index 4289e81..4874555 100644 --- a/lib/ext2fs/gen_bitmap64.c +++ b/lib/ext2fs/gen_bitmap64.c @@ -257,7 +257,7 @@ void ext2fs_free_generic_bmap(ext2fs_generic_bitmap gen_bmap) return; #ifdef ENABLE_BMAP_STATS - if (getenv("E2FSPROGS_BITMAP_STATS")) { + if (ext2fs_safe_getenv("E2FSPROGS_BITMAP_STATS")) { ext2fs_print_bmap_statistics(bmap); bmap->bitmap_ops->print_stats(bmap); } @@ -945,8 +945,8 @@ errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap, return ENOENT; } -errcode_t ext2fs_count_used_clusters(ext2_filsys fs, blk64_t start, - blk64_t end, blk64_t *out) +errcode_t ext2fs_count_used_blocks(ext2_filsys fs, blk64_t start, + blk64_t end, blk64_t *out) { blk64_t next; blk64_t tot_set = 0; @@ -975,6 +975,19 @@ errcode_t ext2fs_count_used_clusters(ext2_filsys fs, blk64_t start, break; } + if (!retval) + *out = tot_set; + return retval; +} + +errcode_t ext2fs_count_used_clusters(ext2_filsys fs, blk64_t start, + blk64_t end, blk64_t *out) +{ + blk64_t tot_set = 0; + errcode_t retval = 0; + + retval = ext2fs_count_used_blocks(fs, start, end, &tot_set); + if (!retval) *out = EXT2FS_NUM_B2C(fs, tot_set); return retval; -- cgit v1.2.3