Whamcloud - gitweb
git://git.whamcloud.com
/
tools
/
e2fsprogs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
e2fsck: clean up xattr checking code
[tools/e2fsprogs.git]
/
debugfs
/
icheck.c
diff --git
a/debugfs/icheck.c
b/debugfs/icheck.c
index
a6b182d
..
ed6e950
100644
(file)
--- a/
debugfs/icheck.c
+++ b/
debugfs/icheck.c
@@
-1,10
+1,11
@@
/*
* icheck.c --- given a list of blocks, generate a list of inodes
/*
* icheck.c --- given a list of blocks, generate a list of inodes
- *
+ *
* Copyright (C) 1994 Theodore Ts'o. This file may be redistributed
* under the terms of the GNU Public License.
*/
* Copyright (C) 1994 Theodore Ts'o. This file may be redistributed
* under the terms of the GNU Public License.
*/
+#include "config.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@
-19,7
+20,7
@@
#include "debugfs.h"
struct block_info {
#include "debugfs.h"
struct block_info {
- blk
_t
blk;
+ blk
64_t
blk;
ext2_ino_t ino;
};
ext2_ino_t ino;
};
@@
-31,9
+32,9
@@
struct block_walk_struct {
};
static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
};
static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
- blk
_t
*block_nr,
+ blk
64_t
*block_nr,
e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
- blk_t ref_block EXT2FS_ATTR((unused)),
+ blk
64
_t ref_block EXT2FS_ATTR((unused)),
int ref_offset EXT2FS_ATTR((unused)),
void *private)
{
int ref_offset EXT2FS_ATTR((unused)),
void *private)
{
@@
-48,11
+49,12
@@
static int icheck_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
}
if (!bw->blocks_left)
return BLOCK_ABORT;
}
if (!bw->blocks_left)
return BLOCK_ABORT;
-
+
return 0;
}
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;
{
struct block_walk_struct bw;
struct block_info *binfo;
@@
-62,7
+64,7
@@
void do_icheck(int argc, char **argv)
struct ext2_inode inode;
errcode_t retval;
char *block_buf;
struct ext2_inode inode;
errcode_t retval;
char *block_buf;
-
+
if (argc < 2) {
com_err(argv[0], 0, "Usage: icheck <block number> ...");
return;
if (argc < 2) {
com_err(argv[0], 0, "Usage: icheck <block number> ...");
return;
@@
-85,7
+87,7
@@
void do_icheck(int argc, char **argv)
}
for (i=1; i < argc; i++) {
}
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;
}
goto error_out;
}
@@
-104,21
+106,25
@@
void do_icheck(int argc, char **argv)
com_err("icheck", retval, "while starting inode scan");
goto error_out;
}
com_err("icheck", retval, "while starting inode scan");
goto error_out;
}
-
+
while (ino) {
while (ino) {
+ blk64_t blk;
+
if (!inode.i_links_count)
goto next;
bw.inode = ino;
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;
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_blocks
2(current_fs,
&inode))
goto next;
/*
* To handle filesystems touched by 0.3c extfs; can be
goto next;
/*
* To handle filesystems touched by 0.3c extfs; can be
@@
-127,7
+133,8
@@
void do_icheck(int argc, char **argv)
if (inode.i_dtime)
goto next;
if (inode.i_dtime)
goto next;
- retval = ext2fs_block_iterate2(current_fs, ino, 0, block_buf,
+ retval = ext2fs_block_iterate3(current_fs, ino,
+ BLOCK_FLAG_READ_ONLY, block_buf,
icheck_proc, &bw);
if (retval) {
com_err("icheck", retval,
icheck_proc, &bw);
if (retval) {
com_err("icheck", retval,
@@
-152,16
+159,17
@@
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("Block\tInode number\n");
for (i=0, binfo = bw.barray; i < bw.num_blocks; i++, binfo++) {
if (binfo->ino == 0) {
- printf("%u\t<block not found>\n", binfo->blk);
+ printf("%llu\t<block not found>\n",
+ (unsigned long long) binfo->blk);
continue;
}
continue;
}
- printf("%u\t%u\n", binfo->blk, binfo->ino);
+ printf("%llu\t%u\n", (unsigned long long) binfo->blk,
+ binfo->ino);
}
error_out:
free(bw.barray);
}
error_out:
free(bw.barray);
- if (block_buf)
- free(block_buf);
+ free(block_buf);
if (scan)
ext2fs_close_inode_scan(scan);
return;
if (scan)
ext2fs_close_inode_scan(scan);
return;