summaryrefslogtreecommitdiffstats
path: root/lib/ext2fs/gen_bitmap64.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 04:59:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 04:59:33 +0000
commit73193347133e750faf27f88fd3ab31ce43aff062 (patch)
treee28a6d9512d1787b1fcbe9167188c9d134bf51d9 /lib/ext2fs/gen_bitmap64.c
parentAdding upstream version 1.47.0. (diff)
downloade2fsprogs-upstream.tar.xz
e2fsprogs-upstream.zip
Adding upstream version 1.47.1.upstream/1.47.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--lib/ext2fs/gen_bitmap64.c19
1 files changed, 16 insertions, 3 deletions
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;
@@ -976,6 +976,19 @@ errcode_t ext2fs_count_used_clusters(ext2_filsys fs, blk64_t start,
}
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;
}