|
|
0fba97 |
From 1c25e64066e861f273b785b06ef3bc7636552eab Mon Sep 17 00:00:00 2001
|
|
|
a9c310 |
From: Lukas Czerner <lczerner@redhat.com>
|
|
|
a9c310 |
Date: Tue, 14 Jan 2020 09:49:19 +0100
|
|
|
0fba97 |
Subject: [PATCH 5/7] Revert "libext2fs: revamp bitmap types to fix LTO
|
|
|
a9c310 |
warnings"
|
|
|
a9c310 |
|
|
|
a9c310 |
This reverts commit 83d9ffccf3ee6ad4e165eeb6912acf1f6149be28 because it
|
|
|
a9c310 |
breaks ABI.
|
|
|
a9c310 |
|
|
|
a9c310 |
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
|
|
a9c310 |
---
|
|
|
a9c310 |
lib/ext2fs/bitmaps.c | 6 +-
|
|
|
a9c310 |
lib/ext2fs/blkmap64_ba.c | 38 ++++----
|
|
|
a9c310 |
lib/ext2fs/blkmap64_rb.c | 38 ++++----
|
|
|
a9c310 |
lib/ext2fs/bmap64.h | 38 ++++----
|
|
|
a9c310 |
lib/ext2fs/ext2fs.h | 11 +--
|
|
|
a9c310 |
lib/ext2fs/gen_bitmap.c | 113 ++++++++---------------
|
|
|
a9c310 |
lib/ext2fs/gen_bitmap64.c | 185 ++++++++++++++++----------------------
|
|
|
a9c310 |
7 files changed, 173 insertions(+), 256 deletions(-)
|
|
|
a9c310 |
|
|
|
a9c310 |
diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
|
|
|
0fba97 |
index 834a3962..e0b1f7cd 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/bitmaps.c
|
|
|
a9c310 |
+++ b/lib/ext2fs/bitmaps.c
|
|
|
0fba97 |
@@ -126,7 +126,6 @@ errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs,
|
|
|
a9c310 |
{
|
|
|
a9c310 |
__u64 start, end, real_end;
|
|
|
a9c310 |
ext2fs_generic_bitmap bmap;
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap64;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
|
|
|
0fba97 |
@@ -149,15 +148,14 @@ errcode_t ext2fs_allocate_subcluster_bitmap(ext2_filsys fs,
|
|
|
a9c310 |
end, real_end, descr, &bmap);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
- bmap64 = (ext2fs_generic_bitmap_64) bmap;
|
|
|
a9c310 |
- bmap64->cluster_bits = 0;
|
|
|
a9c310 |
+ bmap->cluster_bits = 0;
|
|
|
a9c310 |
*ret = bmap;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
int ext2fs_get_bitmap_granularity(ext2fs_block_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) bitmap;
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bmap = bitmap;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bmap))
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
diff --git a/lib/ext2fs/blkmap64_ba.c b/lib/ext2fs/blkmap64_ba.c
|
|
|
a9c310 |
index 85cb38d2..3707a61e 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/blkmap64_ba.c
|
|
|
a9c310 |
+++ b/lib/ext2fs/blkmap64_ba.c
|
|
|
a9c310 |
@@ -40,7 +40,7 @@ struct ext2fs_ba_private_struct {
|
|
|
a9c310 |
|
|
|
a9c310 |
typedef struct ext2fs_ba_private_struct *ext2fs_ba_private;
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t ba_alloc_private_data (ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static errcode_t ba_alloc_private_data (ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
@@ -69,7 +69,7 @@ static errcode_t ba_alloc_private_data (ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
static errcode_t ba_new_bmap(ext2_filsys fs EXT2FS_ATTR((unused)),
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
@@ -86,7 +86,7 @@ static errcode_t ba_new_bmap(ext2_filsys fs EXT2FS_ATTR((unused)),
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void ba_free_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void ba_free_bmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -101,8 +101,8 @@ static void ba_free_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
bp = 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t ba_copy_bmap(ext2fs_generic_bitmap_64 src,
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 dest)
|
|
|
a9c310 |
+static errcode_t ba_copy_bmap(ext2fs_generic_bitmap src,
|
|
|
a9c310 |
+ ext2fs_generic_bitmap dest)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private src_bp = (ext2fs_ba_private) src->private;
|
|
|
a9c310 |
ext2fs_ba_private dest_bp;
|
|
|
a9c310 |
@@ -121,7 +121,7 @@ static errcode_t ba_copy_bmap(ext2fs_generic_bitmap_64 src,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t ba_resize_bmap(ext2fs_generic_bitmap_64 bmap,
|
|
|
a9c310 |
+static errcode_t ba_resize_bmap(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
__u64 new_end, __u64 new_real_end)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bmap->private;
|
|
|
a9c310 |
@@ -162,7 +162,7 @@ static errcode_t ba_resize_bmap(ext2fs_generic_bitmap_64 bmap,
|
|
|
a9c310 |
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int ba_mark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int ba_mark_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
blk64_t bitno = (blk64_t) arg;
|
|
|
a9c310 |
@@ -170,7 +170,7 @@ static int ba_mark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
return ext2fs_set_bit64(bitno - bitmap->start, bp->bitarray);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int ba_unmark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int ba_unmark_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
blk64_t bitno = (blk64_t) arg;
|
|
|
a9c310 |
@@ -178,7 +178,7 @@ static int ba_unmark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
return ext2fs_clear_bit64(bitno - bitmap->start, bp->bitarray);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int ba_test_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int ba_test_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
blk64_t bitno = (blk64_t) arg;
|
|
|
a9c310 |
@@ -186,7 +186,7 @@ static int ba_test_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
return ext2fs_test_bit64(bitno - bitmap->start, bp->bitarray);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void ba_mark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+static void ba_mark_bmap_extent(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
@@ -197,7 +197,7 @@ static void ba_mark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
ext2fs_fast_set_bit64(bitno + i - bitmap->start, bp->bitarray);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void ba_unmark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+static void ba_unmark_bmap_extent(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
@@ -208,7 +208,7 @@ static void ba_unmark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
ext2fs_fast_clear_bit64(bitno + i - bitmap->start, bp->bitarray);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int ba_test_clear_bmap_extent(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static int ba_test_clear_bmap_extent(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, unsigned int len)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
@@ -282,7 +282,7 @@ static int ba_test_clear_bmap_extent(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t ba_set_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t ba_set_bmap_range(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *in)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
@@ -292,7 +292,7 @@ static errcode_t ba_set_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t ba_get_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t ba_get_bmap_range(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
@@ -302,7 +302,7 @@ static errcode_t ba_get_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void ba_clear_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void ba_clear_bmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private) bitmap->private;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -311,20 +311,20 @@ static void ba_clear_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
#ifdef ENABLE_BMAP_STATS
|
|
|
a9c310 |
-static void ba_print_stats(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void ba_print_stats(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
fprintf(stderr, "%16llu Bytes used by bitarray\n",
|
|
|
a9c310 |
((bitmap->real_end - bitmap->start) >> 3) + 1 +
|
|
|
a9c310 |
sizeof(struct ext2fs_ba_private_struct));
|
|
|
a9c310 |
}
|
|
|
a9c310 |
#else
|
|
|
a9c310 |
-static void ba_print_stats(ext2fs_generic_bitmap_64 bitmap EXT2FS_ATTR((unused)))
|
|
|
a9c310 |
+static void ba_print_stats(ext2fs_generic_bitmap bitmap EXT2FS_ATTR((unused)))
|
|
|
a9c310 |
{
|
|
|
a9c310 |
}
|
|
|
a9c310 |
#endif
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Find the first zero bit between start and end, inclusive. */
|
|
|
a9c310 |
-static errcode_t ba_find_first_zero(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t ba_find_first_zero(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private)bitmap->private;
|
|
|
a9c310 |
@@ -398,7 +398,7 @@ static errcode_t ba_find_first_zero(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Find the first one bit between start and end, inclusive. */
|
|
|
a9c310 |
-static errcode_t ba_find_first_set(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t ba_find_first_set(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
ext2fs_ba_private bp = (ext2fs_ba_private)bitmap->private;
|
|
|
a9c310 |
diff --git a/lib/ext2fs/blkmap64_rb.c b/lib/ext2fs/blkmap64_rb.c
|
|
|
a9c310 |
index 1fd55274..4cbfb1ed 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/blkmap64_rb.c
|
|
|
a9c310 |
+++ b/lib/ext2fs/blkmap64_rb.c
|
|
|
a9c310 |
@@ -177,7 +177,7 @@ static void rb_free_extent(struct ext2fs_rb_private *bp,
|
|
|
a9c310 |
ext2fs_free_mem(&ext;;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_alloc_private_data (ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static errcode_t rb_alloc_private_data (ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
@@ -201,7 +201,7 @@ static errcode_t rb_alloc_private_data (ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
static errcode_t rb_new_bmap(ext2_filsys fs EXT2FS_ATTR((unused)),
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -225,7 +225,7 @@ static void rb_free_tree(struct rb_root *root)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void rb_free_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void rb_free_bmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -236,8 +236,8 @@ static void rb_free_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
bp = 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_copy_bmap(ext2fs_generic_bitmap_64 src,
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 dest)
|
|
|
a9c310 |
+static errcode_t rb_copy_bmap(ext2fs_generic_bitmap src,
|
|
|
a9c310 |
+ ext2fs_generic_bitmap dest)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *src_bp, *dest_bp;
|
|
|
a9c310 |
struct bmap_rb_extent *src_ext, *dest_ext;
|
|
|
a9c310 |
@@ -302,7 +302,7 @@ static void rb_truncate(__u64 new_max, struct rb_root *root)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_resize_bmap(ext2fs_generic_bitmap_64 bmap,
|
|
|
a9c310 |
+static errcode_t rb_resize_bmap(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
__u64 new_end, __u64 new_real_end)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
@@ -575,7 +575,7 @@ static int rb_remove_extent(__u64 start, __u64 count,
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int rb_mark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int rb_mark_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
int retval;
|
|
|
a9c310 |
@@ -588,7 +588,7 @@ static int rb_mark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int rb_unmark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int rb_unmark_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
int retval;
|
|
|
a9c310 |
@@ -603,7 +603,7 @@ static int rb_unmark_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
inline
|
|
|
a9c310 |
-static int rb_test_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
+static int rb_test_bmap(ext2fs_generic_bitmap bitmap, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -613,7 +613,7 @@ static int rb_test_bmap(ext2fs_generic_bitmap_64 bitmap, __u64 arg)
|
|
|
a9c310 |
return rb_test_bit(bp, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void rb_mark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+static void rb_mark_bmap_extent(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
@@ -625,7 +625,7 @@ static void rb_mark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
check_tree(&bp->root, __func__);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void rb_unmark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+static void rb_unmark_bmap_extent(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
@@ -637,7 +637,7 @@ static void rb_unmark_bmap_extent(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
check_tree(&bp->root, __func__);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static int rb_test_clear_bmap_extent(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static int rb_test_clear_bmap_extent(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, unsigned int len)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct rb_node *parent = NULL, **n;
|
|
|
a9c310 |
@@ -693,7 +693,7 @@ static int rb_test_clear_bmap_extent(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *in)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
@@ -739,7 +739,7 @@ static errcode_t rb_set_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -804,7 +804,7 @@ static errcode_t rb_get_bmap_range(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void rb_clear_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void rb_clear_bmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -817,7 +817,7 @@ static void rb_clear_bmap(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
check_tree(&bp->root, __func__);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_find_first_zero(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t rb_find_first_zero(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct rb_node *parent = NULL, **n;
|
|
|
a9c310 |
@@ -853,7 +853,7 @@ static errcode_t rb_find_first_zero(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-static errcode_t rb_find_first_set(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static errcode_t rb_find_first_set(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct rb_node *parent = NULL, **n;
|
|
|
a9c310 |
@@ -902,7 +902,7 @@ static errcode_t rb_find_first_set(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
#ifdef ENABLE_BMAP_STATS
|
|
|
a9c310 |
-static void rb_print_stats(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void rb_print_stats(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2fs_rb_private *bp;
|
|
|
a9c310 |
struct rb_node *node = NULL;
|
|
|
a9c310 |
@@ -963,7 +963,7 @@ static void rb_print_stats(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
eff);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
#else
|
|
|
a9c310 |
-static void rb_print_stats(ext2fs_generic_bitmap_64 bitmap EXT2FS_ATTR((unused)))
|
|
|
a9c310 |
+static void rb_print_stats(ext2fs_generic_bitmap bitmap EXT2FS_ATTR((unused)))
|
|
|
a9c310 |
{
|
|
|
a9c310 |
}
|
|
|
a9c310 |
#endif
|
|
|
a9c310 |
diff --git a/lib/ext2fs/bmap64.h b/lib/ext2fs/bmap64.h
|
|
|
a9c310 |
index de334548..d8c7a3c3 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/bmap64.h
|
|
|
a9c310 |
+++ b/lib/ext2fs/bmap64.h
|
|
|
a9c310 |
@@ -37,7 +37,7 @@ struct ext2_bmap_statistics {
|
|
|
a9c310 |
};
|
|
|
a9c310 |
|
|
|
a9c310 |
|
|
|
a9c310 |
-struct ext2fs_struct_generic_bitmap_64 {
|
|
|
a9c310 |
+struct ext2fs_struct_generic_bitmap {
|
|
|
a9c310 |
errcode_t magic;
|
|
|
a9c310 |
ext2_filsys fs;
|
|
|
a9c310 |
struct ext2_bitmap_ops *bitmap_ops;
|
|
|
a9c310 |
@@ -53,8 +53,6 @@ struct ext2fs_struct_generic_bitmap_64 {
|
|
|
a9c310 |
#endif
|
|
|
a9c310 |
};
|
|
|
a9c310 |
|
|
|
a9c310 |
-typedef struct ext2fs_struct_generic_bitmap_64 *ext2fs_generic_bitmap_64;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
#define EXT2FS_IS_32_BITMAP(bmap) \
|
|
|
a9c310 |
(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP) || \
|
|
|
a9c310 |
((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP) || \
|
|
|
a9c310 |
@@ -68,37 +66,37 @@ typedef struct ext2fs_struct_generic_bitmap_64 *ext2fs_generic_bitmap_64;
|
|
|
a9c310 |
struct ext2_bitmap_ops {
|
|
|
a9c310 |
int type;
|
|
|
a9c310 |
/* Generic bmap operators */
|
|
|
a9c310 |
- errcode_t (*new_bmap)(ext2_filsys fs, ext2fs_generic_bitmap_64 bmap);
|
|
|
a9c310 |
- void (*free_bmap)(ext2fs_generic_bitmap_64 bitmap);
|
|
|
a9c310 |
- errcode_t (*copy_bmap)(ext2fs_generic_bitmap_64 src,
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 dest);
|
|
|
a9c310 |
- errcode_t (*resize_bmap)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ errcode_t (*new_bmap)(ext2_filsys fs, ext2fs_generic_bitmap bmap);
|
|
|
a9c310 |
+ void (*free_bmap)(ext2fs_generic_bitmap bitmap);
|
|
|
a9c310 |
+ errcode_t (*copy_bmap)(ext2fs_generic_bitmap src,
|
|
|
a9c310 |
+ ext2fs_generic_bitmap dest);
|
|
|
a9c310 |
+ errcode_t (*resize_bmap)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 new_end,
|
|
|
a9c310 |
__u64 new_real_end);
|
|
|
a9c310 |
/* bit set/test operators */
|
|
|
a9c310 |
- int (*mark_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
|
|
a9c310 |
- int (*unmark_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
|
|
a9c310 |
- int (*test_bmap)(ext2fs_generic_bitmap_64 bitmap, __u64 arg);
|
|
|
a9c310 |
- void (*mark_bmap_extent)(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+ int (*mark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
|
|
|
a9c310 |
+ int (*unmark_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
|
|
|
a9c310 |
+ int (*test_bmap)(ext2fs_generic_bitmap bitmap, __u64 arg);
|
|
|
a9c310 |
+ void (*mark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num);
|
|
|
a9c310 |
- void (*unmark_bmap_extent)(ext2fs_generic_bitmap_64 bitmap, __u64 arg,
|
|
|
a9c310 |
+ void (*unmark_bmap_extent)(ext2fs_generic_bitmap bitmap, __u64 arg,
|
|
|
a9c310 |
unsigned int num);
|
|
|
a9c310 |
- int (*test_clear_bmap_extent)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ int (*test_clear_bmap_extent)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 arg, unsigned int num);
|
|
|
a9c310 |
- errcode_t (*set_bmap_range)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ errcode_t (*set_bmap_range)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *in);
|
|
|
a9c310 |
- errcode_t (*get_bmap_range)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ errcode_t (*get_bmap_range)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, size_t num, void *out);
|
|
|
a9c310 |
- void (*clear_bmap)(ext2fs_generic_bitmap_64 bitmap);
|
|
|
a9c310 |
- void (*print_stats)(ext2fs_generic_bitmap_64);
|
|
|
a9c310 |
+ void (*clear_bmap)(ext2fs_generic_bitmap bitmap);
|
|
|
a9c310 |
+ void (*print_stats)(ext2fs_generic_bitmap);
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Find the first zero bit between start and end, inclusive.
|
|
|
a9c310 |
* May be NULL, in which case a generic function is used. */
|
|
|
a9c310 |
- errcode_t (*find_first_zero)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ errcode_t (*find_first_zero)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out);
|
|
|
a9c310 |
/* Find the first set bit between start and end, inclusive.
|
|
|
a9c310 |
* May be NULL, in which case a generic function is used. */
|
|
|
a9c310 |
- errcode_t (*find_first_set)(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+ errcode_t (*find_first_set)(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out);
|
|
|
a9c310 |
};
|
|
|
a9c310 |
|
|
|
a9c310 |
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
|
|
|
0fba97 |
index 4b7c836a..ba83534c 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/ext2fs.h
|
|
|
a9c310 |
+++ b/lib/ext2fs/ext2fs.h
|
|
|
a9c310 |
@@ -111,14 +111,9 @@ typedef struct struct_ext2_filsys *ext2_filsys;
|
|
|
a9c310 |
#define EXT2FS_UNMARK_ERROR 1
|
|
|
a9c310 |
#define EXT2FS_TEST_ERROR 2
|
|
|
a9c310 |
|
|
|
a9c310 |
-struct ext2fs_struct_generic_bitmap_base {
|
|
|
a9c310 |
- errcode_t magic;
|
|
|
a9c310 |
- ext2_filsys fs;
|
|
|
a9c310 |
-};
|
|
|
a9c310 |
-
|
|
|
a9c310 |
-typedef struct ext2fs_struct_generic_bitmap_base *ext2fs_generic_bitmap;
|
|
|
a9c310 |
-typedef struct ext2fs_struct_generic_bitmap_base *ext2fs_inode_bitmap;
|
|
|
a9c310 |
-typedef struct ext2fs_struct_generic_bitmap_base *ext2fs_block_bitmap;
|
|
|
a9c310 |
+typedef struct ext2fs_struct_generic_bitmap *ext2fs_generic_bitmap;
|
|
|
a9c310 |
+typedef struct ext2fs_struct_generic_bitmap *ext2fs_inode_bitmap;
|
|
|
a9c310 |
+typedef struct ext2fs_struct_generic_bitmap *ext2fs_block_bitmap;
|
|
|
a9c310 |
|
|
|
a9c310 |
#define EXT2_FIRST_INODE(s) EXT2_FIRST_INO(s)
|
|
|
a9c310 |
|
|
|
a9c310 |
diff --git a/lib/ext2fs/gen_bitmap.c b/lib/ext2fs/gen_bitmap.c
|
|
|
0fba97 |
index 1536d4b3..b545ed7f 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/gen_bitmap.c
|
|
|
a9c310 |
+++ b/lib/ext2fs/gen_bitmap.c
|
|
|
a9c310 |
@@ -28,7 +28,7 @@
|
|
|
a9c310 |
#include "ext2_fs.h"
|
|
|
a9c310 |
#include "ext2fsP.h"
|
|
|
a9c310 |
|
|
|
a9c310 |
-struct ext2fs_struct_generic_bitmap_32 {
|
|
|
a9c310 |
+struct ext2fs_struct_generic_bitmap {
|
|
|
a9c310 |
errcode_t magic;
|
|
|
a9c310 |
ext2_filsys fs;
|
|
|
a9c310 |
__u32 start, end;
|
|
|
a9c310 |
@@ -39,8 +39,6 @@ struct ext2fs_struct_generic_bitmap_32 {
|
|
|
a9c310 |
__u32 reserved[7];
|
|
|
a9c310 |
};
|
|
|
a9c310 |
|
|
|
a9c310 |
-typedef struct ext2fs_struct_generic_bitmap_32 *ext2fs_generic_bitmap_32;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
#define EXT2FS_IS_32_BITMAP(bmap) \
|
|
|
a9c310 |
(((bmap)->magic == EXT2_ET_MAGIC_GENERIC_BITMAP) || \
|
|
|
a9c310 |
((bmap)->magic == EXT2_ET_MAGIC_BLOCK_BITMAP) || \
|
|
|
a9c310 |
@@ -55,11 +53,9 @@ typedef struct ext2fs_struct_generic_bitmap_32 *ext2fs_generic_bitmap_32;
|
|
|
a9c310 |
* Used by previously inlined function, so we have to export this and
|
|
|
a9c310 |
* not change the function signature
|
|
|
a9c310 |
*/
|
|
|
a9c310 |
-void ext2fs_warn_bitmap2(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+void ext2fs_warn_bitmap2(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
int code, unsigned long arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
#ifndef OMIT_COM_ERR
|
|
|
a9c310 |
if (bitmap->description)
|
|
|
a9c310 |
com_err(0, bitmap->base_error_code+code,
|
|
|
a9c310 |
@@ -83,11 +79,11 @@ errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
|
|
|
a9c310 |
const char *descr, char *init_map,
|
|
|
a9c310 |
ext2fs_generic_bitmap *ret)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap;
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bitmap;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
size_t size;
|
|
|
a9c310 |
|
|
|
a9c310 |
- retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap_32),
|
|
|
a9c310 |
+ retval = ext2fs_get_mem(sizeof(struct ext2fs_struct_generic_bitmap),
|
|
|
a9c310 |
&bitmap);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
@@ -131,7 +127,7 @@ errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
|
|
|
a9c310 |
memcpy(bitmap->bitmap, init_map, size);
|
|
|
a9c310 |
else
|
|
|
a9c310 |
memset(bitmap->bitmap, 0, size);
|
|
|
a9c310 |
- *ret = (ext2fs_generic_bitmap) bitmap;
|
|
|
a9c310 |
+ *ret = bitmap;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -145,11 +141,9 @@ errcode_t ext2fs_allocate_generic_bitmap(__u32 start,
|
|
|
a9c310 |
start, end, real_end, descr, 0, ret);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap gen_src,
|
|
|
a9c310 |
+errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap src,
|
|
|
a9c310 |
ext2fs_generic_bitmap *dest)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 src = (ext2fs_generic_bitmap_32) gen_src;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
return (ext2fs_make_generic_bitmap(src->magic, src->fs,
|
|
|
a9c310 |
src->start, src->end,
|
|
|
a9c310 |
src->real_end,
|
|
|
a9c310 |
@@ -157,11 +151,9 @@ errcode_t ext2fs_copy_generic_bitmap(ext2fs_generic_bitmap gen_src,
|
|
|
a9c310 |
dest));
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap gen_bitmap)
|
|
|
a9c310 |
+void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
- if (check_magic(gen_bitmap))
|
|
|
a9c310 |
+ if (check_magic(bitmap))
|
|
|
a9c310 |
return;
|
|
|
a9c310 |
|
|
|
a9c310 |
bitmap->magic = 0;
|
|
|
a9c310 |
@@ -179,8 +171,6 @@ void ext2fs_free_generic_bitmap(ext2fs_inode_bitmap gen_bitmap)
|
|
|
a9c310 |
int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
blk_t bitno)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -193,18 +183,16 @@ int ext2fs_test_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- if ((bitno < bitmap32->start) || (bitno > bitmap32->end)) {
|
|
|
a9c310 |
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, bitno);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_test_bit(bitno - bitmap32->start, bitmap32->bitmap);
|
|
|
a9c310 |
+ return ext2fs_test_bit(bitno - bitmap->start, bitmap->bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u32 bitno)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -217,18 +205,16 @@ int ext2fs_mark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- if ((bitno < bitmap32->start) || (bitno > bitmap32->end)) {
|
|
|
a9c310 |
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap2(bitmap, EXT2FS_MARK_ERROR, bitno);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_set_bit(bitno - bitmap32->start, bitmap32->bitmap);
|
|
|
a9c310 |
+ return ext2fs_set_bit(bitno - bitmap->start, bitmap->bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
blk_t bitno)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -241,17 +227,15 @@ int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- if ((bitno < bitmap32->start) || (bitno > bitmap32->end)) {
|
|
|
a9c310 |
+ if ((bitno < bitmap->start) || (bitno > bitmap->end)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR, bitno);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_clear_bit(bitno - bitmap32->start, bitmap32->bitmap);
|
|
|
a9c310 |
+ return ext2fs_clear_bit(bitno - bitmap->start, bitmap->bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
__u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -264,13 +248,11 @@ __u32 ext2fs_get_generic_bitmap_start(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- return bitmap32->start;
|
|
|
a9c310 |
+ return bitmap->start;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
__u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -282,13 +264,11 @@ __u32 ext2fs_get_generic_bitmap_end(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
#endif
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return bitmap32->end;
|
|
|
a9c310 |
+ return bitmap->end;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap32 = (ext2fs_generic_bitmap_32) bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (EXT2FS_IS_64_BITMAP(bitmap)) {
|
|
|
a9c310 |
ext2fs_warn_bitmap32(bitmap, __func__);
|
|
|
a9c310 |
@@ -302,16 +282,14 @@ void ext2fs_clear_generic_bitmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
return;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- memset(bitmap32->bitmap, 0,
|
|
|
a9c310 |
- (size_t) (((bitmap32->real_end - bitmap32->start) / 8) + 1));
|
|
|
a9c310 |
+ memset(bitmap->bitmap, 0,
|
|
|
a9c310 |
+ (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1));
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap gen_bitmap,
|
|
|
a9c310 |
+errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap bitmap,
|
|
|
a9c310 |
errcode_t magic, errcode_t neq,
|
|
|
a9c310 |
ext2_ino_t end, ext2_ino_t *oend)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
EXT2_CHECK_MAGIC(bitmap, magic);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (end > bitmap->real_end)
|
|
|
a9c310 |
@@ -324,9 +302,8 @@ errcode_t ext2fs_fudge_generic_bitmap_end(ext2fs_inode_bitmap gen_bitmap,
|
|
|
a9c310 |
|
|
|
a9c310 |
errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
|
|
|
a9c310 |
__u32 new_end, __u32 new_real_end,
|
|
|
a9c310 |
- ext2fs_generic_bitmap gen_bmap)
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bmap = (ext2fs_generic_bitmap_32) gen_bmap;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
size_t size, new_size;
|
|
|
a9c310 |
__u32 bitno;
|
|
|
a9c310 |
@@ -367,11 +344,9 @@ errcode_t ext2fs_resize_generic_bitmap(errcode_t magic,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
|
|
|
a9c310 |
- ext2fs_generic_bitmap gen_bm1,
|
|
|
a9c310 |
- ext2fs_generic_bitmap gen_bm2)
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bm1,
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bm2)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bm1 = (ext2fs_generic_bitmap_32) gen_bm1;
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bm2 = (ext2fs_generic_bitmap_32) gen_bm2;
|
|
|
a9c310 |
blk_t i;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!bm1 || bm1->magic != magic)
|
|
|
a9c310 |
@@ -386,16 +361,15 @@ errcode_t ext2fs_compare_generic_bitmap(errcode_t magic, errcode_t neq,
|
|
|
a9c310 |
return neq;
|
|
|
a9c310 |
|
|
|
a9c310 |
for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
|
|
|
a9c310 |
- if (ext2fs_fast_test_block_bitmap(gen_bm1, i) !=
|
|
|
a9c310 |
- ext2fs_fast_test_block_bitmap(gen_bm2, i))
|
|
|
a9c310 |
+ if (ext2fs_fast_test_block_bitmap(bm1, i) !=
|
|
|
a9c310 |
+ ext2fs_fast_test_block_bitmap(bm2, i))
|
|
|
a9c310 |
return neq;
|
|
|
a9c310 |
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap gen_map)
|
|
|
a9c310 |
+void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap map)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 map = (ext2fs_generic_bitmap_32) gen_map;
|
|
|
a9c310 |
__u32 i, j;
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Protect loop from wrap-around if map->real_end is maxed */
|
|
|
a9c310 |
@@ -405,13 +379,11 @@ void ext2fs_set_generic_bitmap_padding(ext2fs_generic_bitmap gen_map)
|
|
|
a9c310 |
ext2fs_set_bit(j, map->bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
+errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
errcode_t magic,
|
|
|
a9c310 |
__u32 start, __u32 num,
|
|
|
a9c310 |
void *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bmap = (ext2fs_generic_bitmap_32) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap || (bmap->magic != magic))
|
|
|
a9c310 |
return magic;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -422,13 +394,11 @@ errcode_t ext2fs_get_generic_bitmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
+errcode_t ext2fs_set_generic_bitmap_range(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
errcode_t magic,
|
|
|
a9c310 |
__u32 start, __u32 num,
|
|
|
a9c310 |
void *in)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bmap = (ext2fs_generic_bitmap_32) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap || (bmap->magic != magic))
|
|
|
a9c310 |
return magic;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -462,11 +432,10 @@ int ext2fs_mem_is_zero(const char *mem, size_t len)
|
|
|
a9c310 |
/*
|
|
|
a9c310 |
* Return true if all of the bits in a specified range are clear
|
|
|
a9c310 |
*/
|
|
|
a9c310 |
-static int ext2fs_test_clear_generic_bitmap_range(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+static int ext2fs_test_clear_generic_bitmap_range(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
unsigned int start,
|
|
|
a9c310 |
unsigned int len)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
size_t start_byte, len_byte = len >> 3;
|
|
|
a9c310 |
unsigned int start_bit, len_bit = len % 8;
|
|
|
a9c310 |
int first_bit = 0;
|
|
|
a9c310 |
@@ -535,15 +504,14 @@ static int ext2fs_test_clear_generic_bitmap_range(ext2fs_generic_bitmap gen_bitm
|
|
|
a9c310 |
return ext2fs_mem_is_zero(ADDR + start_byte, len_byte);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u32 start, __u32 end,
|
|
|
a9c310 |
__u32 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
blk_t b;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (start < bitmap->start || end > bitmap->end || start > end) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -559,15 +527,14 @@ errcode_t ext2fs_find_first_zero_generic_bitmap(ext2fs_generic_bitmap gen_bitmap
|
|
|
a9c310 |
return ENOENT;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u32 start, __u32 end,
|
|
|
a9c310 |
__u32 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
blk_t b;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (start < bitmap->start || end > bitmap->end || start > end) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -583,11 +550,9 @@ errcode_t ext2fs_find_first_set_generic_bitmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
return ENOENT;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap gen_bitmap,
|
|
|
a9c310 |
+int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
|
|
a9c310 |
blk_t block, int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_BLOCK_BITMAP);
|
|
|
a9c310 |
if ((block < bitmap->start) || (block > bitmap->real_end) ||
|
|
|
a9c310 |
(block+num-1 > bitmap->real_end)) {
|
|
|
a9c310 |
@@ -599,11 +564,9 @@ int ext2fs_test_block_bitmap_range(ext2fs_block_bitmap gen_bitmap,
|
|
|
a9c310 |
bitmap, block, num);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap gen_bitmap,
|
|
|
a9c310 |
+int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap bitmap,
|
|
|
a9c310 |
ext2_ino_t inode, int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
EXT2_CHECK_MAGIC(bitmap, EXT2_ET_MAGIC_INODE_BITMAP);
|
|
|
a9c310 |
if ((inode < bitmap->start) || (inode > bitmap->real_end) ||
|
|
|
a9c310 |
(inode+num-1 > bitmap->real_end)) {
|
|
|
a9c310 |
@@ -615,10 +578,9 @@ int ext2fs_test_inode_bitmap_range(ext2fs_inode_bitmap gen_bitmap,
|
|
|
a9c310 |
bitmap, inode, num);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap gen_bitmap,
|
|
|
a9c310 |
+void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
|
|
a9c310 |
blk_t block, int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
int i;
|
|
|
a9c310 |
|
|
|
a9c310 |
if ((block < bitmap->start) || (block > bitmap->end) ||
|
|
|
a9c310 |
@@ -631,10 +593,9 @@ void ext2fs_mark_block_bitmap_range(ext2fs_block_bitmap gen_bitmap,
|
|
|
a9c310 |
ext2fs_fast_set_bit(block + i - bitmap->start, bitmap->bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap gen_bitmap,
|
|
|
a9c310 |
- blk_t block, int num)
|
|
|
a9c310 |
+void ext2fs_unmark_block_bitmap_range(ext2fs_block_bitmap bitmap,
|
|
|
a9c310 |
+ blk_t block, int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_32 bitmap = (ext2fs_generic_bitmap_32) gen_bitmap;
|
|
|
a9c310 |
int i;
|
|
|
a9c310 |
|
|
|
a9c310 |
if ((block < bitmap->start) || (block > bitmap->end) ||
|
|
|
a9c310 |
diff --git a/lib/ext2fs/gen_bitmap64.c b/lib/ext2fs/gen_bitmap64.c
|
|
|
a9c310 |
index 6e4d8b71..47ba2baf 100644
|
|
|
a9c310 |
--- a/lib/ext2fs/gen_bitmap64.c
|
|
|
a9c310 |
+++ b/lib/ext2fs/gen_bitmap64.c
|
|
|
a9c310 |
@@ -68,7 +68,7 @@
|
|
|
a9c310 |
* e2fsck can request an encoding which is optimized for that.
|
|
|
a9c310 |
*/
|
|
|
a9c310 |
|
|
|
a9c310 |
-static void warn_bitmap(ext2fs_generic_bitmap_64 bitmap,
|
|
|
a9c310 |
+static void warn_bitmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
int code, __u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
#ifndef OMIT_COM_ERR
|
|
|
a9c310 |
@@ -93,7 +93,7 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
|
|
a9c310 |
const char *descr,
|
|
|
a9c310 |
ext2fs_generic_bitmap *ret)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap;
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bitmap;
|
|
|
a9c310 |
struct ext2_bitmap_ops *ops;
|
|
|
a9c310 |
ext2_ino_t num_dirs;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
@@ -119,7 +119,7 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- retval = ext2fs_get_memzero(sizeof(struct ext2fs_struct_generic_bitmap_64),
|
|
|
a9c310 |
+ retval = ext2fs_get_memzero(sizeof(struct ext2fs_struct_generic_bitmap),
|
|
|
a9c310 |
&bitmap);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
@@ -170,12 +170,12 @@ errcode_t ext2fs_alloc_generic_bmap(ext2_filsys fs, errcode_t magic,
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- *ret = (ext2fs_generic_bitmap) bitmap;
|
|
|
a9c310 |
+ *ret = bitmap;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
#ifdef ENABLE_BMAP_STATS
|
|
|
a9c310 |
-static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
+static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
struct ext2_bmap_statistics *stats = &bitmap->stats;
|
|
|
a9c310 |
#ifdef ENABLE_BMAP_STATS_OPS
|
|
|
a9c310 |
@@ -241,15 +241,13 @@ static void ext2fs_print_bmap_statistics(ext2fs_generic_bitmap_64 bitmap)
|
|
|
a9c310 |
}
|
|
|
a9c310 |
#endif
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_free_generic_bmap(ext2fs_generic_bitmap gen_bmap)
|
|
|
a9c310 |
+void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
return;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bmap)) {
|
|
|
a9c310 |
- ext2fs_free_generic_bitmap(gen_bmap);
|
|
|
a9c310 |
+ ext2fs_free_generic_bitmap(bmap);
|
|
|
a9c310 |
return;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -273,25 +271,24 @@ void ext2fs_free_generic_bmap(ext2fs_generic_bitmap gen_bmap)
|
|
|
a9c310 |
ext2fs_free_mem(&bmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap gen_src,
|
|
|
a9c310 |
+errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
|
|
|
a9c310 |
ext2fs_generic_bitmap *dest)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 src = (ext2fs_generic_bitmap_64) gen_src;
|
|
|
a9c310 |
char *descr, *new_descr;
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 new_bmap;
|
|
|
a9c310 |
+ ext2fs_generic_bitmap new_bmap;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!src)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(src))
|
|
|
a9c310 |
- return ext2fs_copy_generic_bitmap(gen_src, dest);
|
|
|
a9c310 |
+ return ext2fs_copy_generic_bitmap(src, dest);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(src))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Allocate a new bitmap struct */
|
|
|
a9c310 |
- retval = ext2fs_get_memzero(sizeof(struct ext2fs_struct_generic_bitmap_64),
|
|
|
a9c310 |
+ retval = ext2fs_get_memzero(sizeof(struct ext2fs_struct_generic_bitmap),
|
|
|
a9c310 |
&new_bmap);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
@@ -339,23 +336,21 @@ errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap gen_src,
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- *dest = (ext2fs_generic_bitmap) new_bmap;
|
|
|
a9c310 |
+ *dest = new_bmap;
|
|
|
a9c310 |
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
+errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
__u64 new_end,
|
|
|
a9c310 |
__u64 new_real_end)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bmap))
|
|
|
a9c310 |
- return ext2fs_resize_generic_bitmap(gen_bmap->magic, new_end,
|
|
|
a9c310 |
- new_real_end, gen_bmap);
|
|
|
a9c310 |
+ return ext2fs_resize_generic_bitmap(bmap->magic, new_end,
|
|
|
a9c310 |
+ new_real_end, bmap);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bmap))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
@@ -365,12 +360,10 @@ errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
return bmap->bitmap_ops->resize_bmap(bmap, new_end, new_real_end);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
errcode_t neq,
|
|
|
a9c310 |
__u64 end, __u64 *oend)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -378,8 +371,7 @@ errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
ext2_ino_t tmp_oend;
|
|
|
a9c310 |
int retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
- retval = ext2fs_fudge_generic_bitmap_end(gen_bitmap,
|
|
|
a9c310 |
- bitmap->magic,
|
|
|
a9c310 |
+ retval = ext2fs_fudge_generic_bitmap_end(bitmap, bitmap->magic,
|
|
|
a9c310 |
neq, end, &tmp_oend);
|
|
|
a9c310 |
if (oend)
|
|
|
a9c310 |
*oend = tmp_oend;
|
|
|
a9c310 |
@@ -397,15 +389,13 @@ errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-__u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap gen_bitmap)
|
|
|
a9c310 |
+__u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap))
|
|
|
a9c310 |
- return ext2fs_get_generic_bitmap_start(gen_bitmap);
|
|
|
a9c310 |
+ return ext2fs_get_generic_bitmap_start(bitmap);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
@@ -413,15 +403,13 @@ __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap gen_bitmap)
|
|
|
a9c310 |
return bitmap->start;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-__u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap gen_bitmap)
|
|
|
a9c310 |
+__u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap))
|
|
|
a9c310 |
- return ext2fs_get_generic_bitmap_end(gen_bitmap);
|
|
|
a9c310 |
+ return ext2fs_get_generic_bitmap_end(bitmap);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
@@ -429,31 +417,27 @@ __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap gen_bitmap)
|
|
|
a9c310 |
return bitmap->end;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap gen_bitmap)
|
|
|
a9c310 |
+void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap))
|
|
|
a9c310 |
- ext2fs_clear_generic_bitmap(gen_bitmap);
|
|
|
a9c310 |
+ ext2fs_clear_generic_bitmap(bitmap);
|
|
|
a9c310 |
else
|
|
|
a9c310 |
- bitmap->bitmap_ops->clear_bmap(bitmap);
|
|
|
a9c310 |
+ bitmap->bitmap_ops->clear_bmap (bitmap);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (arg & ~0xffffffffULL) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bitmap,
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bitmap,
|
|
|
a9c310 |
EXT2FS_MARK_ERROR, 0xffffffff);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_mark_generic_bitmap(gen_bitmap, arg);
|
|
|
a9c310 |
+ return ext2fs_mark_generic_bitmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
@@ -478,21 +462,19 @@ int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
return bitmap->bitmap_ops->mark_bmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (arg & ~0xffffffffULL) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bitmap, EXT2FS_UNMARK_ERROR,
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR,
|
|
|
a9c310 |
0xffffffff);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_unmark_generic_bitmap(gen_bitmap, arg);
|
|
|
a9c310 |
+ return ext2fs_unmark_generic_bitmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
@@ -510,20 +492,19 @@ int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
return bitmap->bitmap_ops->unmark_bmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_test_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
+int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 arg)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
if (!bitmap)
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bitmap)) {
|
|
|
a9c310 |
if (arg & ~0xffffffffULL) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bitmap, EXT2FS_TEST_ERROR,
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR,
|
|
|
a9c310 |
0xffffffff);
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_test_generic_bitmap(gen_bitmap, arg);
|
|
|
a9c310 |
+ return ext2fs_test_generic_bitmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
@@ -548,22 +529,20 @@ int ext2fs_test_generic_bmap(ext2fs_generic_bitmap gen_bitmap,
|
|
|
a9c310 |
return bitmap->bitmap_ops->test_bmap(bitmap, arg);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
+errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
__u64 start, unsigned int num,
|
|
|
a9c310 |
void *in)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bmap)) {
|
|
|
a9c310 |
if ((start+num-1) & ~0xffffffffULL) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bmap, EXT2FS_UNMARK_ERROR,
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bmap, EXT2FS_UNMARK_ERROR,
|
|
|
a9c310 |
0xffffffff);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_set_generic_bitmap_range(gen_bmap, bmap->magic,
|
|
|
a9c310 |
+ return ext2fs_set_generic_bitmap_range(bmap, bmap->magic,
|
|
|
a9c310 |
start, num, in);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -575,22 +554,20 @@ errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
return bmap->bitmap_ops->set_bmap_range(bmap, start, num, in);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
+errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap,
|
|
|
a9c310 |
__u64 start, unsigned int num,
|
|
|
a9c310 |
void *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bmap)) {
|
|
|
a9c310 |
if ((start+num-1) & ~0xffffffffULL) {
|
|
|
a9c310 |
- ext2fs_warn_bitmap2(gen_bmap,
|
|
|
a9c310 |
+ ext2fs_warn_bitmap2(bmap,
|
|
|
a9c310 |
EXT2FS_UNMARK_ERROR, 0xffffffff);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
- return ext2fs_get_generic_bitmap_range(gen_bmap, bmap->magic,
|
|
|
a9c310 |
+ return ext2fs_get_generic_bitmap_range(bmap, bmap->magic,
|
|
|
a9c310 |
start, num, out);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -603,11 +580,9 @@ errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap gen_bmap,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
|
|
a9c310 |
- ext2fs_generic_bitmap gen_bm1,
|
|
|
a9c310 |
- ext2fs_generic_bitmap gen_bm2)
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bm1,
|
|
|
a9c310 |
+ ext2fs_generic_bitmap bm2)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bm1 = (ext2fs_generic_bitmap_64) gen_bm1;
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bm2 = (ext2fs_generic_bitmap_64) gen_bm2;
|
|
|
a9c310 |
blk64_t i;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!bm1 || !bm2)
|
|
|
a9c310 |
@@ -617,8 +592,7 @@ errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
|
|
a9c310 |
|
|
|
a9c310 |
/* Now we know both bitmaps have the same magic */
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bm1))
|
|
|
a9c310 |
- return ext2fs_compare_generic_bitmap(bm1->magic, neq,
|
|
|
a9c310 |
- gen_bm1, gen_bm2);
|
|
|
a9c310 |
+ return ext2fs_compare_generic_bitmap(bm1->magic, neq, bm1, bm2);
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bm1))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
@@ -628,20 +602,19 @@ errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
|
|
|
a9c310 |
return neq;
|
|
|
a9c310 |
|
|
|
a9c310 |
for (i = bm1->end - ((bm1->end - bm1->start) % 8); i <= bm1->end; i++)
|
|
|
a9c310 |
- if (ext2fs_test_generic_bmap(gen_bm1, i) !=
|
|
|
a9c310 |
- ext2fs_test_generic_bmap(gen_bm2, i))
|
|
|
a9c310 |
+ if (ext2fs_test_generic_bmap(bm1, i) !=
|
|
|
a9c310 |
+ ext2fs_test_generic_bmap(bm2, i))
|
|
|
a9c310 |
return neq;
|
|
|
a9c310 |
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap gen_bmap)
|
|
|
a9c310 |
+void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
__u64 start, num;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (EXT2FS_IS_32_BITMAP(bmap)) {
|
|
|
a9c310 |
- ext2fs_set_generic_bitmap_padding(gen_bmap);
|
|
|
a9c310 |
+ ext2fs_set_generic_bitmap_padding(bmap);
|
|
|
a9c310 |
return;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -651,10 +624,9 @@ void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap gen_bmap)
|
|
|
a9c310 |
/* XXX ought to warn on error */
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
+int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap bmap,
|
|
|
a9c310 |
blk64_t block, unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
__u64 end = block + num;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
@@ -696,10 +668,9 @@ int ext2fs_test_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
return bmap->bitmap_ops->test_clear_bmap_extent(bmap, block, num);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
+void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap bmap,
|
|
|
a9c310 |
blk64_t block, unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
__u64 end = block + num;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
@@ -737,10 +708,9 @@ void ext2fs_mark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
bmap->bitmap_ops->mark_bmap_extent(bmap, block, num);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
+void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap bmap,
|
|
|
a9c310 |
blk64_t block, unsigned int num)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
__u64 end = block + num;
|
|
|
a9c310 |
|
|
|
a9c310 |
if (!bmap)
|
|
|
a9c310 |
@@ -778,10 +748,8 @@ void ext2fs_unmark_block_bitmap_range2(ext2fs_block_bitmap gen_bmap,
|
|
|
a9c310 |
bmap->bitmap_ops->unmark_bmap_extent(bmap, block, num);
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
-void ext2fs_warn_bitmap32(ext2fs_generic_bitmap gen_bitmap, const char *func)
|
|
|
a9c310 |
+void ext2fs_warn_bitmap32(ext2fs_generic_bitmap bitmap, const char *func)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bitmap = (ext2fs_generic_bitmap_64) gen_bitmap;
|
|
|
a9c310 |
-
|
|
|
a9c310 |
#ifndef OMIT_COM_ERR
|
|
|
a9c310 |
if (bitmap && bitmap->description)
|
|
|
a9c310 |
com_err(0, EXT2_ET_MAGIC_GENERIC_BITMAP,
|
|
|
a9c310 |
@@ -796,22 +764,21 @@ void ext2fs_warn_bitmap32(ext2fs_generic_bitmap gen_bitmap, const char *func)
|
|
|
a9c310 |
errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|
|
a9c310 |
ext2fs_block_bitmap *bitmap)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap, cmap;
|
|
|
a9c310 |
- ext2fs_block_bitmap gen_bmap = *bitmap, gen_cmap;
|
|
|
a9c310 |
+ ext2fs_block_bitmap cmap, bmap;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
blk64_t i, b_end, c_end;
|
|
|
a9c310 |
int n, ratio;
|
|
|
a9c310 |
|
|
|
a9c310 |
- bmap = (ext2fs_generic_bitmap_64) gen_bmap;
|
|
|
a9c310 |
- if (fs->cluster_ratio_bits == ext2fs_get_bitmap_granularity(gen_bmap))
|
|
|
a9c310 |
+ bmap = *bitmap;
|
|
|
a9c310 |
+
|
|
|
a9c310 |
+ if (fs->cluster_ratio_bits == ext2fs_get_bitmap_granularity(bmap))
|
|
|
a9c310 |
return 0; /* Nothing to do */
|
|
|
a9c310 |
|
|
|
a9c310 |
retval = ext2fs_allocate_block_bitmap(fs, "converted cluster bitmap",
|
|
|
a9c310 |
- &gen_cmap);
|
|
|
a9c310 |
+ &cmap);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
- cmap = (ext2fs_generic_bitmap_64) gen_cmap;
|
|
|
a9c310 |
i = bmap->start;
|
|
|
a9c310 |
b_end = bmap->end;
|
|
|
a9c310 |
bmap->end = bmap->real_end;
|
|
|
a9c310 |
@@ -820,8 +787,8 @@ errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|
|
a9c310 |
n = 0;
|
|
|
a9c310 |
ratio = 1 << fs->cluster_ratio_bits;
|
|
|
a9c310 |
while (i < bmap->real_end) {
|
|
|
a9c310 |
- if (ext2fs_test_block_bitmap2(gen_bmap, i)) {
|
|
|
a9c310 |
- ext2fs_mark_block_bitmap2(gen_cmap, i);
|
|
|
a9c310 |
+ if (ext2fs_test_block_bitmap2(bmap, i)) {
|
|
|
a9c310 |
+ ext2fs_mark_block_bitmap2(cmap, i);
|
|
|
a9c310 |
i += ratio - n;
|
|
|
a9c310 |
n = 0;
|
|
|
a9c310 |
continue;
|
|
|
a9c310 |
@@ -832,15 +799,14 @@ errcode_t ext2fs_convert_subcluster_bitmap(ext2_filsys fs,
|
|
|
a9c310 |
}
|
|
|
a9c310 |
bmap->end = b_end;
|
|
|
a9c310 |
cmap->end = c_end;
|
|
|
a9c310 |
- ext2fs_free_block_bitmap(gen_bmap);
|
|
|
a9c310 |
- *bitmap = (ext2fs_block_bitmap) cmap;
|
|
|
a9c310 |
+ ext2fs_free_block_bitmap(bmap);
|
|
|
a9c310 |
+ *bitmap = cmap;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap64 = (ext2fs_generic_bitmap_64) bitmap;
|
|
|
a9c310 |
__u64 cstart, cend, cout;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -866,27 +832,27 @@ errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
- cstart = start >> bmap64->cluster_bits;
|
|
|
a9c310 |
- cend = end >> bmap64->cluster_bits;
|
|
|
a9c310 |
+ cstart = start >> bitmap->cluster_bits;
|
|
|
a9c310 |
+ cend = end >> bitmap->cluster_bits;
|
|
|
a9c310 |
|
|
|
a9c310 |
- if (cstart < bmap64->start || cend > bmap64->end || start > end) {
|
|
|
a9c310 |
- warn_bitmap(bmap64, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
+ if (cstart < bitmap->start || cend > bitmap->end || start > end) {
|
|
|
a9c310 |
+ warn_bitmap(bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- if (bmap64->bitmap_ops->find_first_zero) {
|
|
|
a9c310 |
- retval = bmap64->bitmap_ops->find_first_zero(bmap64, cstart,
|
|
|
a9c310 |
+ if (bitmap->bitmap_ops->find_first_zero) {
|
|
|
a9c310 |
+ retval = bitmap->bitmap_ops->find_first_zero(bitmap, cstart,
|
|
|
a9c310 |
cend, &cout);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
found:
|
|
|
a9c310 |
- cout <<= bmap64->cluster_bits;
|
|
|
a9c310 |
+ cout <<= bitmap->cluster_bits;
|
|
|
a9c310 |
*out = (cout >= start) ? cout : start;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
for (cout = cstart; cout <= cend; cout++)
|
|
|
a9c310 |
- if (!bmap64->bitmap_ops->test_bmap(bmap64, cout))
|
|
|
a9c310 |
+ if (!bitmap->bitmap_ops->test_bmap(bitmap, cout))
|
|
|
a9c310 |
goto found;
|
|
|
a9c310 |
|
|
|
a9c310 |
return ENOENT;
|
|
|
a9c310 |
@@ -895,7 +861,6 @@ errcode_t ext2fs_find_first_zero_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
__u64 start, __u64 end, __u64 *out)
|
|
|
a9c310 |
{
|
|
|
a9c310 |
- ext2fs_generic_bitmap_64 bmap64 = (ext2fs_generic_bitmap_64) bitmap;
|
|
|
a9c310 |
__u64 cstart, cend, cout;
|
|
|
a9c310 |
errcode_t retval;
|
|
|
a9c310 |
|
|
|
a9c310 |
@@ -921,27 +886,27 @@ errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap,
|
|
|
a9c310 |
if (!EXT2FS_IS_64_BITMAP(bitmap))
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
|
|
|
a9c310 |
- cstart = start >> bmap64->cluster_bits;
|
|
|
a9c310 |
- cend = end >> bmap64->cluster_bits;
|
|
|
a9c310 |
+ cstart = start >> bitmap->cluster_bits;
|
|
|
a9c310 |
+ cend = end >> bitmap->cluster_bits;
|
|
|
a9c310 |
|
|
|
a9c310 |
- if (cstart < bmap64->start || cend > bmap64->end || start > end) {
|
|
|
a9c310 |
- warn_bitmap(bmap64, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
+ if (cstart < bitmap->start || cend > bitmap->end || start > end) {
|
|
|
a9c310 |
+ warn_bitmap(bitmap, EXT2FS_TEST_ERROR, start);
|
|
|
a9c310 |
return EINVAL;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
- if (bmap64->bitmap_ops->find_first_set) {
|
|
|
a9c310 |
- retval = bmap64->bitmap_ops->find_first_set(bmap64, cstart,
|
|
|
a9c310 |
+ if (bitmap->bitmap_ops->find_first_set) {
|
|
|
a9c310 |
+ retval = bitmap->bitmap_ops->find_first_set(bitmap, cstart,
|
|
|
a9c310 |
cend, &cout);
|
|
|
a9c310 |
if (retval)
|
|
|
a9c310 |
return retval;
|
|
|
a9c310 |
found:
|
|
|
a9c310 |
- cout <<= bmap64->cluster_bits;
|
|
|
a9c310 |
+ cout <<= bitmap->cluster_bits;
|
|
|
a9c310 |
*out = (cout >= start) ? cout : start;
|
|
|
a9c310 |
return 0;
|
|
|
a9c310 |
}
|
|
|
a9c310 |
|
|
|
a9c310 |
for (cout = cstart; cout <= cend; cout++)
|
|
|
a9c310 |
- if (bmap64->bitmap_ops->test_bmap(bmap64, cout))
|
|
|
a9c310 |
+ if (bitmap->bitmap_ops->test_bmap(bitmap, cout))
|
|
|
a9c310 |
goto found;
|
|
|
a9c310 |
|
|
|
a9c310 |
return ENOENT;
|
|
|
a9c310 |
--
|
|
|
0fba97 |
2.21.3
|
|
|
a9c310 |
|