libext2fs: remove unnecessary casts to ext2fs_generic_bitmap

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
bitmap-optimize
Namhyung Kim 2010-11-29 17:55:06 +09:00 committed by Theodore Ts'o
parent e163242102
commit 877d1dc0ab
1 changed files with 30 additions and 49 deletions

View File

@ -144,7 +144,7 @@ void ext2fs_free_generic_bmap(ext2fs_generic_bitmap bmap)
return; return;
if (EXT2FS_IS_32_BITMAP(bmap)) { if (EXT2FS_IS_32_BITMAP(bmap)) {
ext2fs_free_generic_bitmap((ext2fs_generic_bitmap) bmap); ext2fs_free_generic_bitmap(bmap);
return; return;
} }
@ -171,8 +171,7 @@ errcode_t ext2fs_copy_generic_bmap(ext2fs_generic_bitmap src,
return EINVAL; return EINVAL;
if (EXT2FS_IS_32_BITMAP(src)) if (EXT2FS_IS_32_BITMAP(src))
return ext2fs_copy_generic_bitmap((ext2fs_generic_bitmap) src, return ext2fs_copy_generic_bitmap(src, dest);
(ext2fs_generic_bitmap *) dest);
if (!EXT2FS_IS_64_BITMAP(src)) if (!EXT2FS_IS_64_BITMAP(src))
return EINVAL; return EINVAL;
@ -222,11 +221,9 @@ errcode_t ext2fs_resize_generic_bmap(ext2fs_generic_bitmap bmap,
if (!bmap) if (!bmap)
return EINVAL; return EINVAL;
if (EXT2FS_IS_32_BITMAP(bmap)) { if (EXT2FS_IS_32_BITMAP(bmap))
return ext2fs_resize_generic_bitmap(bmap->magic, return ext2fs_resize_generic_bitmap(bmap->magic, new_end,
new_end, new_real_end, new_real_end, bmap);
(ext2fs_generic_bitmap) bmap);
}
if (!EXT2FS_IS_64_BITMAP(bmap)) if (!EXT2FS_IS_64_BITMAP(bmap))
return EINVAL; return EINVAL;
@ -245,9 +242,8 @@ errcode_t ext2fs_fudge_generic_bmap_end(ext2fs_generic_bitmap bitmap,
ext2_ino_t tmp_oend; ext2_ino_t tmp_oend;
int retval; int retval;
retval = ext2fs_fudge_generic_bitmap_end((ext2fs_generic_bitmap) bitmap, retval = ext2fs_fudge_generic_bitmap_end(bitmap, bitmap->magic,
bitmap->magic, neq, neq, end, &tmp_oend);
end, &tmp_oend);
if (oend) if (oend)
*oend = tmp_oend; *oend = tmp_oend;
return retval; return retval;
@ -269,11 +265,8 @@ __u64 ext2fs_get_generic_bmap_start(ext2fs_generic_bitmap bitmap)
if (!bitmap) if (!bitmap)
return EINVAL; return EINVAL;
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap))
return ext2fs_get_generic_bitmap_start((ext2fs_generic_bitmap) return ext2fs_get_generic_bitmap_start(bitmap);
bitmap);
}
if (!EXT2FS_IS_64_BITMAP(bitmap)) if (!EXT2FS_IS_64_BITMAP(bitmap))
return EINVAL; return EINVAL;
@ -286,11 +279,8 @@ __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap)
if (!bitmap) if (!bitmap)
return EINVAL; return EINVAL;
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap))
return ext2fs_get_generic_bitmap_end((ext2fs_generic_bitmap) return ext2fs_get_generic_bitmap_end(bitmap);
bitmap);
}
if (!EXT2FS_IS_64_BITMAP(bitmap)) if (!EXT2FS_IS_64_BITMAP(bitmap))
return EINVAL; return EINVAL;
@ -300,10 +290,8 @@ __u64 ext2fs_get_generic_bmap_end(ext2fs_generic_bitmap bitmap)
void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap) void ext2fs_clear_generic_bmap(ext2fs_generic_bitmap bitmap)
{ {
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap))
ext2fs_clear_generic_bitmap((ext2fs_generic_bitmap) bitmap); ext2fs_clear_generic_bitmap(bitmap);
return;
}
bitmap->bitmap_ops->clear_bmap (bitmap); bitmap->bitmap_ops->clear_bmap (bitmap);
} }
@ -316,12 +304,11 @@ int ext2fs_mark_generic_bmap(ext2fs_generic_bitmap bitmap,
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap)) {
if (arg & ~0xffffffffULL) { if (arg & ~0xffffffffULL) {
ext2fs_warn_bitmap2((ext2fs_generic_bitmap) bitmap, ext2fs_warn_bitmap2(bitmap,
EXT2FS_MARK_ERROR, 0xffffffff); EXT2FS_MARK_ERROR, 0xffffffff);
return 0; return 0;
} }
return ext2fs_mark_generic_bitmap((ext2fs_generic_bitmap) return ext2fs_mark_generic_bitmap(bitmap, arg);
bitmap, arg);
} }
if (!EXT2FS_IS_64_BITMAP(bitmap)) if (!EXT2FS_IS_64_BITMAP(bitmap))
@ -343,12 +330,11 @@ int ext2fs_unmark_generic_bmap(ext2fs_generic_bitmap bitmap,
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap)) {
if (arg & ~0xffffffffULL) { if (arg & ~0xffffffffULL) {
ext2fs_warn_bitmap2((ext2fs_generic_bitmap) bitmap, ext2fs_warn_bitmap2(bitmap, EXT2FS_UNMARK_ERROR,
EXT2FS_UNMARK_ERROR, 0xffffffff); 0xffffffff);
return 0; return 0;
} }
return ext2fs_unmark_generic_bitmap((ext2fs_generic_bitmap) return ext2fs_unmark_generic_bitmap(bitmap, arg);
bitmap, arg);
} }
if (!EXT2FS_IS_64_BITMAP(bitmap)) if (!EXT2FS_IS_64_BITMAP(bitmap))
@ -370,12 +356,11 @@ int ext2fs_test_generic_bmap(ext2fs_generic_bitmap bitmap,
if (EXT2FS_IS_32_BITMAP(bitmap)) { if (EXT2FS_IS_32_BITMAP(bitmap)) {
if (arg & ~0xffffffffULL) { if (arg & ~0xffffffffULL) {
ext2fs_warn_bitmap2((ext2fs_generic_bitmap) bitmap, ext2fs_warn_bitmap2(bitmap, EXT2FS_TEST_ERROR,
EXT2FS_TEST_ERROR, 0xffffffff); 0xffffffff);
return 0; return 0;
} }
return ext2fs_test_generic_bitmap((ext2fs_generic_bitmap) return ext2fs_test_generic_bitmap(bitmap, arg);
bitmap, arg);
} }
if (!EXT2FS_IS_64_BITMAP(bitmap)) if (!EXT2FS_IS_64_BITMAP(bitmap))
@ -398,13 +383,12 @@ errcode_t ext2fs_set_generic_bmap_range(ext2fs_generic_bitmap bmap,
if (EXT2FS_IS_32_BITMAP(bmap)) { if (EXT2FS_IS_32_BITMAP(bmap)) {
if ((start+num) & ~0xffffffffULL) { if ((start+num) & ~0xffffffffULL) {
ext2fs_warn_bitmap2((ext2fs_generic_bitmap) bmap, ext2fs_warn_bitmap2(bmap, EXT2FS_UNMARK_ERROR,
EXT2FS_UNMARK_ERROR, 0xffffffff); 0xffffffff);
return EINVAL; return EINVAL;
} }
return ext2fs_set_generic_bitmap_range((ext2fs_generic_bitmap) bmap, return ext2fs_set_generic_bitmap_range(bmap, bmap->magic,
bmap->magic, start, num, start, num, in);
in);
} }
if (!EXT2FS_IS_64_BITMAP(bmap)) if (!EXT2FS_IS_64_BITMAP(bmap))
@ -422,13 +406,12 @@ errcode_t ext2fs_get_generic_bmap_range(ext2fs_generic_bitmap bmap,
if (EXT2FS_IS_32_BITMAP(bmap)) { if (EXT2FS_IS_32_BITMAP(bmap)) {
if ((start+num) & ~0xffffffffULL) { if ((start+num) & ~0xffffffffULL) {
ext2fs_warn_bitmap2((ext2fs_generic_bitmap) bmap, ext2fs_warn_bitmap2(bmap,
EXT2FS_UNMARK_ERROR, 0xffffffff); EXT2FS_UNMARK_ERROR, 0xffffffff);
return EINVAL; return EINVAL;
} }
return ext2fs_get_generic_bitmap_range((ext2fs_generic_bitmap) bmap, return ext2fs_get_generic_bitmap_range(bmap, bmap->magic,
bmap->magic, start, num, start, num, out);
out);
} }
if (!EXT2FS_IS_64_BITMAP(bmap)) if (!EXT2FS_IS_64_BITMAP(bmap))
@ -450,9 +433,7 @@ errcode_t ext2fs_compare_generic_bmap(errcode_t neq,
/* Now we know both bitmaps have the same magic */ /* Now we know both bitmaps have the same magic */
if (EXT2FS_IS_32_BITMAP(bm1)) if (EXT2FS_IS_32_BITMAP(bm1))
return ext2fs_compare_generic_bitmap(bm1->magic, neq, return ext2fs_compare_generic_bitmap(bm1->magic, neq, bm1, bm2);
(ext2fs_generic_bitmap) bm1,
(ext2fs_generic_bitmap) bm2);
if (!EXT2FS_IS_64_BITMAP(bm1)) if (!EXT2FS_IS_64_BITMAP(bm1))
return EINVAL; return EINVAL;
@ -474,7 +455,7 @@ void ext2fs_set_generic_bmap_padding(ext2fs_generic_bitmap bmap)
__u64 start, num; __u64 start, num;
if (EXT2FS_IS_32_BITMAP(bmap)) { if (EXT2FS_IS_32_BITMAP(bmap)) {
ext2fs_set_generic_bitmap_padding((ext2fs_generic_bitmap) bmap); ext2fs_set_generic_bitmap_padding(bmap);
return; return;
} }