X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=debugfs%2Ficheck.c;h=71164cf740a0a4e178927455e1db91ff3a04606c;hb=a935b93dcac8473864587c2e305c2d19b8fcd591;hp=2f880c05fa5665b210ea5dcbf363242898c56681;hpb=efc6f628e15de95bcd13e4f0ee223cb42115d520;p=tools%2Fe2fsprogs.git diff --git a/debugfs/icheck.c b/debugfs/icheck.c index 2f880c0..71164cf 100644 --- a/debugfs/icheck.c +++ b/debugfs/icheck.c @@ -5,6 +5,7 @@ * under the terms of the GNU Public License. */ +#include "config.h" #include #include #include @@ -19,7 +20,7 @@ #include "debugfs.h" struct block_info { - blk_t blk; + blk64_t blk; ext2_ino_t ino; }; @@ -31,9 +32,9 @@ struct block_walk_struct { }; static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)), - blk_t *block_nr, + blk64_t *block_nr, e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)), - blk_t ref_block EXT2FS_ATTR((unused)), + blk64_t ref_block EXT2FS_ATTR((unused)), int ref_offset EXT2FS_ATTR((unused)), void *private) { @@ -52,7 +53,8 @@ static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)), return 0; } -void do_icheck(int argc, char **argv) +void do_icheck(int argc, char **argv, int sci_idx EXT2FS_ATTR((unused)), + void *infop EXT2FS_ATTR((unused))) { struct block_walk_struct bw; struct block_info *binfo; @@ -85,7 +87,7 @@ void do_icheck(int argc, char **argv) } for (i=1; i < argc; i++) { - if (strtoblk(argv[0], argv[i], &bw.barray[i-1].blk)) + if (strtoblk(argv[0], argv[i], NULL, &bw.barray[i-1].blk)) goto error_out; } @@ -106,19 +108,23 @@ void do_icheck(int argc, char **argv) } while (ino) { + blk64_t blk; + if (!inode.i_links_count) goto next; bw.inode = ino; - if (inode.i_file_acl) { - icheck_proc(current_fs, &inode.i_file_acl, 0, + blk = ext2fs_file_acl_block(current_fs, &inode); + if (blk) { + icheck_proc(current_fs, &blk, 0, 0, 0, &bw); if (bw.blocks_left == 0) break; + ext2fs_file_acl_block_set(current_fs, &inode, blk); } - if (!ext2fs_inode_has_valid_blocks(&inode)) + if (!ext2fs_inode_has_valid_blocks2(current_fs, &inode)) goto next; /* * To handle filesystems touched by 0.3c extfs; can be @@ -127,7 +133,7 @@ void do_icheck(int argc, char **argv) if (inode.i_dtime) goto next; - retval = ext2fs_block_iterate2(current_fs, ino, + retval = ext2fs_block_iterate3(current_fs, ino, BLOCK_FLAG_READ_ONLY, block_buf, icheck_proc, &bw); if (retval) { @@ -153,16 +159,15 @@ void do_icheck(int argc, char **argv) printf("Block\tInode number\n"); for (i=0, binfo = bw.barray; i < bw.num_blocks; i++, binfo++) { if (binfo->ino == 0) { - printf("%u\t\n", binfo->blk); + printf("%llu\t\n", binfo->blk); continue; } - printf("%u\t%u\n", binfo->blk, binfo->ino); + printf("%llu\t%u\n", binfo->blk, binfo->ino); } error_out: free(bw.barray); - if (block_buf) - free(block_buf); + free(block_buf); if (scan) ext2fs_close_inode_scan(scan); return;