X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lib%2Fext2fs%2Ftst_iscan.c;h=70bfbeccf93a7ac95b962e9813e524236dad3da4;hb=2d545e3762636a1f5d4be5ee831c3d188d007ed5;hp=fc0053b8ef8c116e3b2fbd2483c630db50613584;hpb=31dbecd482405e0d3a67eb58e1a1c8cb9f2ad83e;p=tools%2Fe2fsprogs.git diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c index fc0053b..70bfbec 100644 --- a/lib/ext2fs/tst_iscan.c +++ b/lib/ext2fs/tst_iscan.c @@ -1,14 +1,15 @@ /* * tst_inode.c --- this function tests the inode scan function - * + * * Copyright (C) 1996 by Theodore Ts'o. - * + * * %Begin-Header% - * This file may be redistributed under the terms of the GNU Public - * License. + * This file may be redistributed under the terms of the GNU Library + * General Public License, version 2. * %End-Header% */ +#include "config.h" #include #include #if HAVE_UNISTD_H @@ -22,15 +23,10 @@ #include #endif -#if EXT2_FLAT_INCLUDES #include "ext2_fs.h" -#else -#include -#endif - #include "ext2fs.h" -blk_t test_vec[] = { 8, 12, 24, 34, 43, 44, 100, 0 }; +blk64_t test_vec[] = { 8, 12, 24, 34, 43, 44, 100, 0 }; ext2_filsys test_fs; ext2fs_block_bitmap bad_block_map, touched_map; @@ -40,7 +36,7 @@ badblocks_list test_badblocks; int first_no_comma = 1; int failed = 0; -static void test_read_blk(unsigned long block, int count, errcode_t err) +static void iscan_test_read_blk64(unsigned long long block, int count, errcode_t err) { int i; @@ -50,20 +46,25 @@ static void test_read_blk(unsigned long block, int count, errcode_t err) printf(", "); if (count > 1) - printf("%lu-%lu", block, block+count-1); + printf("%llu-%llu", block, block+count-1); else - printf("%lu", block); + printf("%llu", block); for (i=0; i < count; i++, block++) { - if (ext2fs_test_block_bitmap(touched_map, block)) { - printf("\nDuplicate block?!? --- %lu\n", block); + if (ext2fs_test_block_bitmap2(touched_map, block)) { + printf("\nDuplicate block?!? --- %llu\n", block); failed++; first_no_comma = 1; } - ext2fs_mark_block_bitmap(touched_map, block); + ext2fs_mark_block_bitmap2(touched_map, block); } } +static void iscan_test_read_blk(unsigned long block, int count, errcode_t err) +{ + iscan_test_read_blk64(block, count, err); +} + /* * Setup the variables for doing the inode scan test. */ @@ -76,12 +77,13 @@ static void setup(void) initialize_ext2_error_table(); memset(¶m, 0, sizeof(param)); - param.s_blocks_count = 12000; + ext2fs_blocks_count_set(¶m, 12000); + + test_io_cb_read_blk = iscan_test_read_blk; + test_io_cb_read_blk64 = iscan_test_read_blk64; - test_io_cb_read_blk = test_read_blk; - - retval = ext2fs_initialize("test fs", 0, ¶m, + retval = ext2fs_initialize("test fs", EXT2_FLAG_64BITS, ¶m, test_io_manager, &test_fs); if (retval) { com_err("setup", retval, @@ -115,20 +117,20 @@ static void setup(void) "While allocating bad inode bitmap"); exit(1); } - - retval = badblocks_list_create(&test_badblocks, 5); + + retval = ext2fs_badblocks_list_create(&test_badblocks, 5); if (retval) { com_err("setup", retval, "while creating badblocks list"); exit(1); } for (i=0; test_vec[i]; i++) { - retval = badblocks_list_add(test_badblocks, test_vec[i]); + retval = ext2fs_badblocks_list_add(test_badblocks, test_vec[i]); if (retval) { com_err("setup", retval, "while adding test vector %d", i); exit(1); } - ext2fs_mark_block_bitmap(bad_block_map, test_vec[i]); + ext2fs_mark_block_bitmap2(bad_block_map, test_vec[i]); } test_fs->badblocks = test_badblocks; } @@ -157,7 +159,7 @@ static void iterate(void) while (ino) { retval = ext2fs_get_next_inode(scan, &ino, &inode); if (retval == EXT2_ET_BAD_BLOCK_IN_INODE_TABLE) { - ext2fs_mark_inode_bitmap(bad_inode_map, ino); + ext2fs_mark_inode_bitmap2(bad_inode_map, ino); continue; } if (retval) { @@ -176,35 +178,35 @@ static void iterate(void) static void check_map(void) { int i, j, first=1; - unsigned long blk; + blk64_t blk; for (i=0; test_vec[i]; i++) { - if (ext2fs_test_block_bitmap(touched_map, test_vec[i])) { - printf("Bad block was touched --- %d\n", test_vec[i]); + if (ext2fs_test_block_bitmap2(touched_map, test_vec[i])) { + printf("Bad block was touched --- %llu\n", test_vec[i]); failed++; first_no_comma = 1; } - ext2fs_mark_block_bitmap(touched_map, test_vec[i]); + ext2fs_mark_block_bitmap2(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; + for (j=0, blk = ext2fs_inode_table_loc(test_fs, i); 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)) { - printf("Missing block --- %lu\n", blk); + if (!ext2fs_test_block_bitmap2(touched_map, blk) && + !ext2fs_test_block_bitmap2(bad_block_map, blk)) { + printf("Missing block --- %llu\n", blk); failed++; } } } printf("Bad inodes: "); for (i=1; i <= test_fs->super->s_inodes_count; i++) { - if (ext2fs_test_inode_bitmap(bad_inode_map, i)) { + if (ext2fs_test_inode_bitmap2(bad_inode_map, i)) { if (first) first = 0; else printf(", "); - printf("%d", i); + printf("%u", i); } } printf("\n");