e2fsprogs add new functions with 64-bit blk64_t
PATCH 15/21 e2fsprogs add new functions with 64-bit blk64_t
Summary of this patch:
[15/21] add new functions which manipulate bitmap with 64-bit blk64_t
- add new functions, which use 64-bit blk64_t and manipulate bitmap, leaving existing functions as they are.
Signed-off-by Takashi Sato [email protected]
---
debugfs/debugfs.c +5 -5
@@ -708,10 +708,10 @@ void do_freeb(int argc, char *argv[])if (check_fs_read_write (argv[0 ]))return ;while (count-- >0 ) { -if (!ext2fs_test_block_bitmap (current_fs->block_map,block)) +if (!ext2fs_test_block_bitmap_64 (current_fs->block_map,block))com_err (argv[0 ],0 ,"Warning: block %u already clear" , block); -ext2fs_unmark_block_bitmap (current_fs->block_map,block); +ext2fs_unmark_block_bitmap_64 (current_fs->block_map,block); block++; }ext2fs_mark_bb_dirty (current_fs);
@@ -727,10 +727,10 @@ void do_setb(int argc, char *argv[])if (check_fs_read_write (argv[0 ]))return ;while (count-- >0 ) { -if (ext2fs_test_block_bitmap (current_fs->block_map,block)) +if (ext2fs_test_block_bitmap_64 (current_fs->block_map,block))com_err (argv[0 ],0 ,"Warning: block %u already set" , block); -ext2fs_mark_block_bitmap (current_fs->block_map,block); +ext2fs_mark_block_bitmap_64 (current_fs->block_map,block); block++; }ext2fs_mark_bb_dirty (current_fs);
@@ -744,7 +744,7 @@ void do_testb(int argc, char *argv[])if (common_block_args_process (argc, argv, &block, &count))return ;while (count-- >0 ) { -if (ext2fs_test_block_bitmap (current_fs->block_map,block)) +if (ext2fs_test_block_bitmap_64 (current_fs->block_map,block))printf ("Block %u marked in use\n" , block);else printf ("Block %u not in use\n" , block);
debugfs/logdump.c +1 -1
@@ -618,7 +618,7 @@ static void dump_metadata_block(FILE *oufprintf (out_file," (block bitmap for block %u: " "block is %s)\n" , block_to_dump, -ext2fs_test_bit (offset, buf) ?"SET" :"CLEAR" ); +ext2fs_test_bit_64 (offset, buf) ?"SET" :"CLEAR" ); }if (fs_blocknr == inode_block_to_dump) {
debugfs/lsdel.c +1 -1
@@ -62,7 +62,7 @@ static int lsdel_proc(ext2_filsys fs,return BLOCK_ABORT ; } -if (!ext2fs_test_block_bitmap (fs->block_map,*block_nr)) +if (!ext2fs_test_block_bitmap_64 (fs->block_map,*block_nr)) lsd->free_blocks++;return 0 ;
debugfs/unused.c +1 -1
@@ -33,7 +33,7 @@ void do_dump_unused(int argc EXT2FS_ATTRfor (blk=current_fs->super->s_first_data_block; blk < current_fs->super->s_blocks_count; blk++) { -if (ext2fs_test_block_bitmap (current_fs->block_map,blk)) +if (ext2fs_test_block_bitmap_64 (current_fs->block_map,blk))continue ; retval =io_channel_read_blk (current_fs->io, blk,1 , buf);if (retval) {
e2fsck/pass1.c +16 -16
@@ -1081,7 +1081,7 @@ static _INLINE_ void mark_block_used(e2fclear_problem_context (&pctx); -if (ext2fs_fast_test_block_bitmap (ctx->block_found_map, block)) { +if (ext2fs_fast_test_block_bitmap_64 (ctx->block_found_map, block)) {if (!ctx->block_dup_map) { pctx.errcode = ext2fs_allocate_block_bitmap(ctx->fs, _("multiply claimed block map"),
@@ -1095,9 +1095,9 @@ static _INLINE_ void mark_block_used(e2freturn ; } } -ext2fs_fast_mark_block_bitmap (ctx->block_dup_map, block); +ext2fs_fast_mark_block_bitmap_64 (ctx->block_dup_map, block); }else { -ext2fs_fast_mark_block_bitmap (ctx->block_found_map, block); +ext2fs_fast_mark_block_bitmap_64 (ctx->block_found_map, block); } }
@@ -1210,7 +1210,7 @@ static int check_ext_attr(e2fsck_t ctx,#endif /* Have we seen this EA block before? */ -if (ext2fs_fast_test_block_bitmap (ctx->block_ea_map, blk)) { +if (ext2fs_fast_test_block_bitmap_64 (ctx->block_ea_map, blk)) {if (ea_refcount_decrement (ctx->refcount, blk,0 ) ==0 )return 1 ;/* Ooops, this EA was referenced more than it stated */
@@ -1299,7 +1299,7 @@ static int check_ext_attr(e2fsck_t ctx,if (count)ea_refcount_store (ctx->refcount, blk, count);mark_block_used (ctx, blk); -ext2fs_fast_mark_block_bitmap (ctx->block_ea_map, blk); +ext2fs_fast_mark_block_bitmap_64 (ctx->block_ea_map, blk);return 1 ;
@@ -1761,13 +1761,13 @@ static int process_bad_block(ext2_filsys }if (blockcnt <0 ) { -if (ext2fs_test_block_bitmap (p->fs_meta_blocks, blk)) { +if (ext2fs_test_block_bitmap_64 (p->fs_meta_blocks, blk)) { p->bbcheck =1 ;if (fix_problem (ctx,PR_1_BB_FS_BLOCK , pctx)) { *block_nr =0 ;return BLOCK_CHANGED ; } - }else if (ext2fs_test_block_bitmap (ctx->block_found_map, + }else if (ext2fs_test_block_bitmap_64 (ctx->block_found_map, blk)) { p->bbcheck =1 ; if (fix_problem(ctx, PR_1_BBINODE_BAD_METABLOCK,
@@ -1791,8 +1791,8 @@ static int process_bad_block(ext2_filsys* there's an overlap between the filesystem table blocks * (bitmaps and inode table) and the bad block list. */ -if (!ext2fs_test_block_bitmap (ctx->block_found_map, blk)) { -ext2fs_mark_block_bitmap (ctx->block_found_map, blk); +if (!ext2fs_test_block_bitmap_64 (ctx->block_found_map, blk)) { +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, blk);return 0 ; }/*
@@ -1927,7 +1927,7 @@ static void new_table_block(e2fsck_t ctx pctx.blk2 =0 ;for (i =0 ; i < num; i++) { pctx.blk = i; -ext2fs_mark_block_bitmap (ctx->block_found_map, (*new_block)+i); +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, (*new_block)+i);if (old_block) { pctx.errcode =io_channel_read_blk (fs->io, old_block + i,1 , buf);
@@ -2005,7 +2005,7 @@ static void mark_table_blocks(e2fsck_t cfor (j =0 , b = fs->group_desc[i].bg_inode_table; j < fs->inode_blocks_per_group; j++, b++) { -if (ext2fs_test_block_bitmap (ctx->block_found_map, +if (ext2fs_test_block_bitmap_64 (ctx->block_found_map, b)) { pctx.blk = b; if (fix_problem(ctx,
@@ -2014,7 +2014,7 @@ static void mark_table_blocks(e2fsck_t c ctx->invalid_bitmaps++; } }else { -ext2fs_mark_block_bitmap (ctx->block_found_map, +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, b); } }
@@ -2024,7 +2024,7 @@ static void mark_table_blocks(e2fsck_t c* Mark block used for the block bitmap */ if (fs->group_desc[i].bg_block_bitmap) { -if (ext2fs_test_block_bitmap (ctx->block_found_map, +if (ext2fs_test_block_bitmap_64 (ctx->block_found_map, fs->group_desc[i].bg_block_bitmap)) { pctx.blk = fs->group_desc[i].bg_block_bitmap;if (fix_problem (ctx,PR_1_BB_CONFLICT , &pctx)) {
@@ -2032,7 +2032,7 @@ static void mark_table_blocks(e2fsck_t c ctx->invalid_bitmaps++; } }else { -ext2fs_mark_block_bitmap (ctx->block_found_map, +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, fs->group_desc[i].bg_block_bitmap); }
@@ -2041,7 +2041,7 @@ static void mark_table_blocks(e2fsck_t c* Mark block used for the inode bitmap */ if (fs->group_desc[i].bg_inode_bitmap) { -if (ext2fs_test_block_bitmap (ctx->block_found_map, +if (ext2fs_test_block_bitmap_64 (ctx->block_found_map, fs->group_desc[i].bg_inode_bitmap)) { pctx.blk = fs->group_desc[i].bg_inode_bitmap;if (fix_problem (ctx,PR_1_IB_CONFLICT , &pctx)) {
@@ -2049,7 +2049,7 @@ static void mark_table_blocks(e2fsck_t c ctx->invalid_bitmaps++; } }else { -ext2fs_mark_block_bitmap (ctx->block_found_map, +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, fs->group_desc[i].bg_inode_bitmap); } }
e2fsck/pass1b.c +8 -8
@@ -320,7 +320,7 @@ static int process_pass1b_block(ext2_fil p = (struct process_block_struct *) priv_data; ctx = p->ctx; -if (!ext2fs_test_block_bitmap (ctx->block_dup_map, *block_nr)) +if (!ext2fs_test_block_bitmap_64 (ctx->block_dup_map, *block_nr))return 0 ;/* OK, this is a duplicate block */
@@ -527,7 +527,7 @@ static void decrement_badcount(e2fsck_t p->num_bad--;if (p->num_bad <=0 || (p->num_bad ==1 && !check_if_fs_block (ctx, block))) -ext2fs_unmark_block_bitmap (ctx->block_dup_map, block); +ext2fs_unmark_block_bitmap_64 (ctx->block_dup_map, block); } static int delete_file_block(ext2_filsys fs,
@@ -548,7 +548,7 @@ static int delete_file_block(ext2_filsysif (HOLE_BLKADDR (*block_nr))return 0 ; -if (ext2fs_test_block_bitmap (ctx->block_dup_map, *block_nr)) { +if (ext2fs_test_block_bitmap_64 (ctx->block_dup_map, *block_nr)) { n =dict_lookup (&blk_dict,INT_TO_VOIDPTR (*block_nr));if (n) { p = (struct dup_block *)dnode_get (n);
@@ -558,7 +558,7 @@ static int delete_file_block(ext2_filsys_ ("internal error; can't find dup_blk for %u\n" ), *block_nr); }else { -ext2fs_unmark_block_bitmap (ctx->block_found_map, *block_nr); +ext2fs_unmark_block_bitmap_64 (ctx->block_found_map, *block_nr);ext2fs_block_alloc_stats (fs, *block_nr,-1 ); }
@@ -616,7 +616,7 @@ static void delete_file(e2fsck_t ctx, ex* of keeping the accounting straight. */ if ((count ==0 ) || -ext2fs_test_block_bitmap (ctx->block_dup_map, +ext2fs_test_block_bitmap_64 (ctx->block_dup_map, inode.i_file_acl))delete_file_block (fs, &inode.i_file_acl,BLOCK_COUNT_EXTATTR ,0 ,0 , &pb);
@@ -650,7 +650,7 @@ static int clone_file_block(ext2_filsysif (HOLE_BLKADDR (*block_nr))return 0 ; -if (ext2fs_test_block_bitmap (ctx->block_dup_map, *block_nr)) { +if (ext2fs_test_block_bitmap_64 (ctx->block_dup_map, *block_nr)) { n =dict_lookup (&blk_dict,INT_TO_VOIDPTR (*block_nr));if (n) { p = (struct dup_block *)dnode_get (n);
@@ -686,9 +686,9 @@ static int clone_file_block(ext2_filsys }decrement_badcount (ctx, *block_nr, p); *block_nr = new_block; -ext2fs_mark_block_bitmap (ctx->block_found_map, +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, new_block); -ext2fs_mark_block_bitmap (fs->block_map, new_block); +ext2fs_mark_block_bitmap_64 (fs->block_map, new_block);return BLOCK_CHANGED ; }else com_err("clone_file_block", 0,
e2fsck/pass2.c +4 -4
@@ -1079,7 +1079,7 @@ static int deallocate_inode_block(ext2_fif ((*block_nr < fs->super->s_first_data_block) || (*block_nr >= fs->super->s_blocks_count))return 0 ; -ext2fs_unmark_block_bitmap (ctx->block_found_map, *block_nr); +ext2fs_unmark_block_bitmap_64 (ctx->block_found_map, *block_nr);ext2fs_block_alloc_stats (fs, *block_nr,-1 );return 0 ; }
@@ -1127,7 +1127,7 @@ static void deallocate_inode(e2fsck_t ctreturn ; }if (count ==0 ) { -ext2fs_unmark_block_bitmap (ctx->block_found_map, +ext2fs_unmark_block_bitmap_64 (ctx->block_found_map, inode.i_file_acl);ext2fs_block_alloc_stats (fs, inode.i_file_acl,-1 ); }
@@ -1344,8 +1344,8 @@ static int allocate_dir_block(e2fsck_t cfix_problem (ctx,PR_2_ALLOC_DIRBOCK , pctx);return 1 ; } -ext2fs_mark_block_bitmap (ctx->block_found_map, blk); -ext2fs_mark_block_bitmap (fs->block_map, blk); +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, blk); +ext2fs_mark_block_bitmap_64 (fs->block_map, blk);ext2fs_mark_bb_dirty (fs);/*
e2fsck/pass3.c +4 -4
@@ -191,8 +191,8 @@ static void check_root(e2fsck_t ctx) ctx->flags |=E2F_FLAG_ABORT ;return ; } -ext2fs_mark_block_bitmap (ctx->block_found_map, blk); -ext2fs_mark_block_bitmap (fs->block_map, blk); +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, blk); +ext2fs_mark_block_bitmap_64 (fs->block_map, blk);ext2fs_mark_bb_dirty (fs);/*
@@ -429,7 +429,7 @@ ext2_ino_t e2fsck_get_lost_and_found(e2ffix_problem (ctx,PR_3_ERR_LPF_NEW_BLOCK , &pctx);return 0 ; } -ext2fs_mark_block_bitmap (ctx->block_found_map, blk); +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, blk);ext2fs_block_alloc_stats (fs, blk,+1 );/*
@@ -743,7 +743,7 @@ static int expand_dir_proc(ext2_filsys f }ext2fs_free_mem (&block); *blocknr = new_blk; -ext2fs_mark_block_bitmap (ctx->block_found_map, new_blk); +ext2fs_mark_block_bitmap_64 (ctx->block_found_map, new_blk);ext2fs_block_alloc_stats (fs, new_blk,+1 ); es->newblocks++;
e2fsck/pass5.c +6 -6
@@ -163,8 +163,8 @@ redo_counts:for (i = fs->super->s_first_data_block; i < fs->super->s_blocks_count; i++) { - actual =ext2fs_fast_test_block_bitmap (ctx->block_found_map, i); - bitmap =ext2fs_fast_test_block_bitmap (fs->block_map, i); + actual =ext2fs_fast_test_block_bitmap_64 (ctx->block_found_map, i); + bitmap =ext2fs_fast_test_block_bitmap_64 (fs->block_map, i);if (actual == bitmap) goto do_counts;
@@ -509,7 +509,7 @@ static void check_block_end(e2fsck_t ctx end = fs->block_map->start + (EXT2_BLOCKS_PER_GROUP (fs->super) * (__u64 )fs->group_desc_count) -1 ; - pctx.errcode =ext2fs_fudge_block_bitmap_end (fs->block_map, end, + pctx.errcode =ext2fs_fudge_block_bitmap_end_64 (fs->block_map, end, &save_blocks_count);if (pctx.errcode) { pctx.num =3 ;
@@ -521,10 +521,10 @@ static void check_block_end(e2fsck_t ctxreturn ;for (i = save_blocks_count +1 ; i <= end; i++) { -if (!ext2fs_test_block_bitmap (fs->block_map, i)) { +if (!ext2fs_test_block_bitmap_64 (fs->block_map, i)) {if (fix_problem (ctx,PR_5_BLOCK_BMAP_PADDING , &pctx)) {for (i = save_blocks_count +1 ; i <= end; i++) -ext2fs_mark_block_bitmap (fs->block_map, +ext2fs_mark_block_bitmap_64 (fs->block_map, i);ext2fs_mark_bb_dirty (fs); }else
@@ -533,7 +533,7 @@ static void check_block_end(e2fsck_t ctx } } - pctx.errcode =ext2fs_fudge_block_bitmap_end (fs->block_map, + pctx.errcode =ext2fs_fudge_block_bitmap_end_64 (fs->block_map, save_blocks_count,0 );if (pctx.errcode) { pctx.num =4 ;
e2fsck/rehash.c +1 -1
@@ -602,7 +602,7 @@ static int write_dir_block(ext2_filsys fif (blockcnt >= wd->outdir->num) {e2fsck_read_bitmaps (wd->ctx); blk = *block_nr; -ext2fs_unmark_block_bitmap (wd->ctx->block_found_map, blk); +ext2fs_unmark_block_bitmap_64 (wd->ctx->block_found_map, blk);ext2fs_block_alloc_stats (fs, blk,-1 ); *block_nr =0 ; wd->cleared++;
e2fsck/super.c +1 -1
@@ -97,7 +97,7 @@ static int release_inode_block(ext2_filsreturn BLOCK_ABORT ; } -if (!ext2fs_test_block_bitmap (fs->block_map, blk)) { +if (!ext2fs_test_block_bitmap_64 (fs->block_map, blk)) {fix_problem (ctx,PR_0_ORPHAN_ALREADY_CLEARED_BLOCK , pctx); goto return_abort; }
lib/ext2fs/alloc.c +2 -2
@@ -88,7 +88,7 @@ errcode_t ext2fs_new_block(ext2_filsys f goal = fs->super->s_first_data_block; i = goal; do { - if (!ext2fs_fast_test_block_bitmap(map, i)) { + if (!ext2fs_fast_test_block_bitmap_64(map, i)) { *ret = i; return 0; }
@@ -162,7 +162,7 @@ errcode_t ext2fs_get_free_blocks(ext2_fiif (b+num-1 >= fs->super->s_blocks_count) b = fs->super->s_first_data_block; do { - if (ext2fs_fast_test_block_bitmap_range(map, b, num)) { + if (ext2fs_fast_test_block_bitmap_range_64(map, b, num)) { *ret = b; return 0; }
lib/ext2fs/alloc_sb.c +3 -3
@@ -44,14 +44,14 @@ int ext2fs_reserve_super_and_bgd(ext2_fi fs->desc_blocks + fs->super->s_reserved_gdt_blocks;if (super_blk || (group ==0 )) -ext2fs_mark_block_bitmap (bmap, super_blk); +ext2fs_mark_block_bitmap_64 (bmap, super_blk);if (old_desc_blk) {for (j=0 ; j < old_desc_blocks; j++) -ext2fs_mark_block_bitmap (bmap, old_desc_blk + j); +ext2fs_mark_block_bitmap_64 (bmap, old_desc_blk + j); }if (new_desc_blk) -ext2fs_mark_block_bitmap (bmap, new_desc_blk); +ext2fs_mark_block_bitmap_64 (bmap, new_desc_blk);return num_blocks; }
lib/ext2fs/alloc_stats.c +2 -2
@@ -42,9 +42,9 @@ void ext2fs_block_alloc_stats(ext2_filsyint group =ext2fs_group_of_blk (fs, blk);if (inuse >0 ) -ext2fs_mark_block_bitmap (fs->block_map, blk); +ext2fs_mark_block_bitmap_64 (fs->block_map, blk);else -ext2fs_unmark_block_bitmap (fs->block_map, blk); +ext2fs_unmark_block_bitmap_64 (fs->block_map, blk); fs->group_desc[group].bg_free_blocks_count -= inuse; fs->super->s_free_blocks_count -= inuse;ext2fs_mark_super_dirty (fs);
lib/ext2fs/alloc_tables.c +3 -3
@@ -65,7 +65,7 @@ errcode_t ext2fs_allocate_group_table(ex last_blk, 1, bmap, &new_blk);if (retval)return retval; -ext2fs_mark_block_bitmap (bmap, new_blk); +ext2fs_mark_block_bitmap_64 (bmap, new_blk); fs->group_desc[group].bg_block_bitmap = new_blk; }
@@ -77,7 +77,7 @@ errcode_t ext2fs_allocate_group_table(ex last_blk, 1, bmap, &new_blk);if (retval)return retval; -ext2fs_mark_block_bitmap (bmap, new_blk); +ext2fs_mark_block_bitmap_64 (bmap, new_blk); fs->group_desc[group].bg_inode_bitmap = new_blk; }
@@ -93,7 +93,7 @@ errcode_t ext2fs_allocate_group_table(exfor (j=0 , blk = new_blk; j < fs->inode_blocks_per_group; j++, blk++) -ext2fs_mark_block_bitmap (bmap, blk); +ext2fs_mark_block_bitmap_64 (bmap, blk); fs->group_desc[group].bg_inode_table = new_blk; }
lib/ext2fs/bb_inode.c +1 -1
@@ -235,7 +235,7 @@ static int set_bad_block_proc(ext2_filsy retry:if (rec->ind_blocks_ptr < rec->ind_blocks_size) { blk = rec->ind_blocks[rec->ind_blocks_ptr++]; -if (ext2fs_test_block_bitmap (fs->block_map, blk)) +if (ext2fs_test_block_bitmap_64 (fs->block_map, blk)) goto retry; }else { retval =ext2fs_new_block (fs,0 ,0 , &blk);
lib/ext2fs/bitmaps.c +22 -6
@@ -27,7 +27,7 @@#include "ext2_fs.h" #include "ext2fs.h" -static errcode_t make_bitmap (__u32 start,__u32 end,__u32 real_end, +static errcode_t make_bitmap (__u32 start,__u32 end,__u64 real_end,const char *descr,char *init_map,ext2fs_generic_bitmap *ret) {
@@ -78,6 +78,15 @@ errcode_t ext2fs_allocate_generic_bitmapconst char *descr, ext2fs_generic_bitmap *ret) { + return make_bitmap(start, end, real_end, descr, 0, ret); +} + +errcode_t ext2fs_allocate_generic_bitmap_64 (__u32 start, +__u32 end, +__u64 real_end, +const char *descr, +ext2fs_generic_bitmap *ret) +{return make_bitmap (start, end, real_end, descr,0 , ret); }
@@ -103,7 +112,7 @@ void ext2fs_set_bitmap_padding(ext2fs_ge__u32 i, j;for (i=map->end+1 , j = i - map->start; i <= map->real_end; i++, j++) -ext2fs_set_bit (j, map->bitmap); +ext2fs_set_bit_64 (j, map->bitmap);return ; }
@@ -124,7 +133,7 @@ errcode_t ext2fs_allocate_inode_bitmap(e end = fs->super->s_inodes_count; real_end = (EXT2_INODES_PER_GROUP (fs->super) * fs->group_desc_count); - retval =ext2fs_allocate_generic_bitmap (start, end, real_end, + retval =ext2fs_allocate_generic_bitmap_64 (start, end, real_end, descr, &bitmap);if (retval)return retval;
@@ -143,7 +152,8 @@ errcode_t ext2fs_allocate_block_bitmap(e {ext2fs_block_bitmap bitmap;errcode_t retval; -__u32 start, end, real_end; +__u32 start, end; +__u64 real_end;EXT2_CHECK_MAGIC (fs,EXT2_ET_MAGIC_EXT2FS_FILSYS );
@@ -151,10 +161,10 @@ errcode_t ext2fs_allocate_block_bitmap(e start = fs->super->s_first_data_block; end = fs->super->s_blocks_count-1 ; - real_end = (EXT2_BLOCKS_PER_GROUP (fs->super) + real_end = ((__u64 )EXT2_BLOCKS_PER_GROUP (fs->super) * fs->group_desc_count)-1 + start; - retval =ext2fs_allocate_generic_bitmap (start, end, real_end, + retval =ext2fs_allocate_generic_bitmap_64 (start, end, real_end, descr, &bitmap);if (retval)return retval;
@@ -183,6 +193,12 @@ errcode_t ext2fs_fudge_inode_bitmap_end(errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap bitmap,blk_t end,blk_t *oend) { +ext2fs_fudge_block_bitmap_end_64 (bitmap, end, (blk64_t *)oend); +} + +errcode_t ext2fs_fudge_block_bitmap_end_64 (ext2fs_block_bitmap bitmap, +blk64_t end,blk64_t *oend) +{EXT2_CHECK_MAGIC (bitmap,EXT2_ET_MAGIC_BLOCK_BITMAP );if (end > bitmap->real_end)
lib/ext2fs/bitops.c +23 -0
@@ -77,6 +77,17 @@ void ext2fs_warn_bitmap(errcode_t errcod#endif } +void ext2fs_warn_bitmap_64 (errcode_t errcode,blk64_t arg, +const char *description) +{ +#ifndef OMIT_COM_ERR +if (description) +com_err (0 , errcode,"#%llu for %s" , arg, description); +else +com_err (0 , errcode,"#%llu" , arg); +#endif +} +void ext2fs_warn_bitmap2 (ext2fs_generic_bitmap bitmap,int code,unsigned long arg) {
@@ -89,3 +100,15 @@ void ext2fs_warn_bitmap2(ext2fs_generic_#endif } +void ext2fs_warn_bitmap2_64 (ext2fs_generic_bitmap bitmap, +int code,blk64_t arg) +{ +#ifndef OMIT_COM_ERR +if (bitmap->description) +com_err (0 , bitmap->base_error_code+code, +"#%llu for %s" , arg, bitmap->description); +else +com_err (0 , bitmap->base_error_code + code,"#%llu" , arg); +#endif +} +
lib/ext2fs/bitops.h +266 -20
531 lines not on this page · raw message
lib/ext2fs/ext2fs.h +13 -1
@@ -103,7 +103,7 @@ struct ext2fs_struct_generic_bitmap {errcode_t magic;ext2_filsys fs;__u32 start, end; -__u32 real_end; +__u64 real_end;char * description;char * bitmap;errcode_t base_error_code;
@@ -549,6 +549,11 @@ extern errcode_t ext2fs_allocate_generic__u32 real_end, const char *descr, ext2fs_generic_bitmap *ret); +extern errcode_t ext2fs_allocate_generic_bitmap_64 (__u32 start, +__u32 end, +__u64 real_end, +const char *descr, +ext2fs_generic_bitmap *ret);extern errcode_t ext2fs_allocate_block_bitmap (ext2_filsys fs,const char *descr,ext2fs_block_bitmap *ret);
@@ -559,6 +564,8 @@ extern errcode_t ext2fs_fudge_inode_bitm ext2_ino_t end, ext2_ino_t *oend);extern errcode_t ext2fs_fudge_block_bitmap_end (ext2fs_block_bitmap bitmap,blk_t end,blk_t *oend); +extern errcode_t ext2fs_fudge_block_bitmap_end_64 (ext2fs_block_bitmap bitmap, +blk64_t end,blk64_t *oend);extern void ext2fs_clear_inode_bitmap (ext2fs_inode_bitmap bitmap);extern void ext2fs_clear_block_bitmap (ext2fs_block_bitmap bitmap);extern errcode_t ext2fs_read_bitmaps (ext2_filsys fs);
@@ -917,10 +924,15 @@ extern errcode_t ext2fs_create_resize_inextern errcode_t ext2fs_resize_generic_bitmap (__u32 new_end,__u32 new_real_end,ext2fs_generic_bitmap bmap); +extern errcode_t ext2fs_resize_generic_bitmap_64 (__u32 new_end, +__u64 new_real_end, +ext2fs_generic_bitmap bmap);extern errcode_t ext2fs_resize_inode_bitmap (__u32 new_end,__u32 new_real_end,ext2fs_inode_bitmap bmap);extern errcode_t ext2fs_resize_block_bitmap (__u32 new_end,__u32 new_real_end,ext2fs_block_bitmap bmap); +extern errcode_t ext2fs_resize_block_bitmap_64 (__u32 new_end,__u64 new_real_end, +ext2fs_block_bitmap bmap);extern errcode_t ext2fs_copy_bitmap (ext2fs_generic_bitmap src,ext2fs_generic_bitmap *dest);
lib/ext2fs/gen_bitmap.c +22 -2
@@ -34,7 +34,17 @@ int ext2fs_mark_generic_bitmap(ext2fs_geext2fs_warn_bitmap2 (bitmap,EXT2FS_MARK_ERROR , bitno);return 0 ; } -return ext2fs_set_bit (bitno - bitmap->start, bitmap->bitmap); +return ext2fs_set_bit_64 (bitno - bitmap->start, bitmap->bitmap); +} + +int ext2fs_mark_generic_bitmap_64 (ext2fs_generic_bitmap bitmap, +__u64 bitno) +{ +if ((bitno < bitmap->start) || (bitno > bitmap->end)) { +ext2fs_warn_bitmap2_64 (bitmap,EXT2FS_MARK_ERROR , bitno); +return 0 ; + } +return ext2fs_set_bit_64 (bitno - bitmap->start, bitmap->bitmap); } int ext2fs_unmark_generic_bitmap(ext2fs_generic_bitmap bitmap,
@@ -44,5 +54,15 @@ int ext2fs_unmark_generic_bitmap(ext2fs_ext2fs_warn_bitmap2 (bitmap,EXT2FS_UNMARK_ERROR , bitno);return 0 ; } -return ext2fs_clear_bit (bitno - bitmap->start, bitmap->bitmap); +return ext2fs_clear_bit_64 (bitno - bitmap->start, bitmap->bitmap); +} + +int ext2fs_unmark_generic_bitmap_64 (ext2fs_generic_bitmap bitmap, +blk64_t bitno) +{ +if ((bitno < bitmap->start) || (bitno > bitmap->end)) { +ext2fs_warn_bitmap2_64 (bitmap,EXT2FS_UNMARK_ERROR , bitno); +return 0 ; + } +return ext2fs_clear_bit_64 (bitno - bitmap->start, bitmap->bitmap); }
lib/ext2fs/rs_bitmap.c +64 -3
91 lines not on this page · raw message
lib/ext2fs/rw_bitmaps.c +1 -1
@@ -124,7 +124,7 @@ errcode_t ext2fs_write_block_bitmap (ext % EXT2_BLOCKS_PER_GROUP(fs->super));if (nbits)for (j = nbits; j < fs->blocksize *8 ; j++) -ext2fs_set_bit (j, bitmap_block); +ext2fs_set_bit_64 (j, bitmap_block); } blk = fs->group_desc[i].bg_block_bitmap;if (blk) {
lib/ext2fs/tst_iscan.c +4 -4
@@ -174,19 +174,19 @@ static void check_map(void)unsigned long blk;for (i=0 ; test_vec[i]; i++) { -if (ext2fs_test_block_bitmap (touched_map, test_vec[i])) { +if (ext2fs_test_block_bitmap_64 (touched_map, test_vec[i])) {printf ("Bad block was touched --- %d\n" , test_vec[i]); failed++; first_no_comma =1 ; } -ext2fs_mark_block_bitmap (touched_map, test_vec[i]); +ext2fs_mark_block_bitmap_64 (touched_map, test_vec[i]); }for (i =0 ; i < test_fs->group_desc_count; i++) {for (j=0 , blk = test_fs->group_desc[i].bg_inode_table; j < test_fs->inode_blocks_per_group; j++, blk++) { -if (!ext2fs_test_block_bitmap (touched_map, blk) && - !ext2fs_test_block_bitmap (bad_block_map, blk)) { +if (!ext2fs_test_block_bitmap_64 (touched_map, blk) && + !ext2fs_test_block_bitmap_64 (bad_block_map, blk)) {printf ("Missing block --- %lu\n" , blk); failed++; }
misc/dumpe2fs.c +1 -1
@@ -42,7 +42,7 @@ extern int optind;#include "../version.h" #include "nls-enable.h" -#define in_use (m, x) (ext2fs_test_bit ((x), (m))) +#define in_use (m, x) (ext2fs_test_bit_64 ((x), (m)))const char * program_name ="dumpe2fs" ;char * device_name =NULL ;
misc/e2image.c +11 -11
@@ -223,9 +223,9 @@ static int process_dir_block(ext2_filsys p = (struct process_block_struct *) priv_data; -ext2fs_mark_block_bitmap (meta_block_map, *block_nr); +ext2fs_mark_block_bitmap_64 (meta_block_map, *block_nr);if (scramble_block_map && p->is_dir && blockcnt >=0 ) -ext2fs_mark_block_bitmap (scramble_block_map, *block_nr); +ext2fs_mark_block_bitmap_64 (scramble_block_map, *block_nr);return 0 ; }
@@ -237,7 +237,7 @@ static int process_file_block(ext2_filsy void *priv_data EXT2FS_ATTR((unused))) {if (blockcnt <0 ) { -ext2fs_mark_block_bitmap (meta_block_map, *block_nr); +ext2fs_mark_block_bitmap_64 (meta_block_map, *block_nr); }return 0 ; }
@@ -251,13 +251,13 @@ static void mark_table_blocks(ext2_filsy/* * Mark primary superblock */ -ext2fs_mark_block_bitmap (meta_block_map, block); +ext2fs_mark_block_bitmap_64 (meta_block_map, block);/* * Mark the primary superblock descriptors */ for (j =0 ; j < fs->desc_blocks; j++) { -ext2fs_mark_block_bitmap (meta_block_map, +ext2fs_mark_block_bitmap_64 (meta_block_map,ext2fs_descriptor_block_loc (fs, block, j)); }
@@ -269,14 +269,14 @@ static void mark_table_blocks(ext2_filsyfor (j =0 , b = fs->group_desc[i].bg_inode_table; j < (unsigned ) fs->inode_blocks_per_group; j++, b++) -ext2fs_mark_block_bitmap (meta_block_map, b); +ext2fs_mark_block_bitmap_64 (meta_block_map, b); }/* * Mark block used for the block bitmap */ if (fs->group_desc[i].bg_block_bitmap) { -ext2fs_mark_block_bitmap (meta_block_map, +ext2fs_mark_block_bitmap_64 (meta_block_map, fs->group_desc[i].bg_block_bitmap); }
@@ -284,7 +284,7 @@ static void mark_table_blocks(ext2_filsy* Mark block used for the inode bitmap */ if (fs->group_desc[i].bg_inode_bitmap) { -ext2fs_mark_block_bitmap (meta_block_map, +ext2fs_mark_block_bitmap_64 (meta_block_map, fs->group_desc[i].bg_inode_bitmap); } block += fs->super->s_blocks_per_group;
@@ -414,14 +414,14 @@ static void output_meta_data_blocks(ext2memset (zero_buf,0 , fs->blocksize);for (blk =0 ; blk < fs->super->s_blocks_count; blk++) {if ((blk >= fs->super->s_first_data_block) && -ext2fs_test_block_bitmap (meta_block_map, blk)) { +ext2fs_test_block_bitmap_64 (meta_block_map, blk)) { retval =io_channel_read_blk (fs->io, blk,1 , buf);if (retval) {com_err (program_name, retval,"error reading block %d" , blk); }if (scramble_block_map && -ext2fs_test_block_bitmap (scramble_block_map, blk)) +ext2fs_test_block_bitmap_64 (scramble_block_map, blk))scramble_dir_block (fs, blk, buf);if ((fd !=1 ) &&check_zero_block (buf, fs->blocksize)) goto sparse_write;
@@ -500,7 +500,7 @@ static void write_raw_image_file(ext2_fiif (!inode.i_links_count)continue ;if (inode.i_file_acl) { -ext2fs_mark_block_bitmap (meta_block_map, +ext2fs_mark_block_bitmap_64 (meta_block_map, inode.i_file_acl); }if (!ext2fs_inode_has_valid_blocks (&inode))
misc/mke2fs.c +1 -1
@@ -277,7 +277,7 @@ _("Warning: the backup superblock/groupexit (1 ); }while (ext2fs_badblocks_list_iterate (bb_iter, &blk)) -ext2fs_mark_block_bitmap (fs->block_map, blk); +ext2fs_mark_block_bitmap_64 (fs->block_map, blk);ext2fs_badblocks_list_iterate_end (bb_iter); }
misc/tune2fs.c +1 -1
@@ -210,7 +210,7 @@ static int release_blocks_proc(ext2_filsint group; block = *blocknr; -ext2fs_unmark_block_bitmap (fs->block_map,block); +ext2fs_unmark_block_bitmap_64 (fs->block_map,block); group =ext2fs_group_of_blk (fs, block); fs->group_desc[group].bg_free_blocks_count++; fs->super->s_free_blocks_count++;
resize/resize2fs.c +41 -41
215 lines not on this page · raw message