aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debugfs/debugfs.c148
-rw-r--r--debugfs/debugfs.h6
-rw-r--r--debugfs/htree.c46
-rw-r--r--debugfs/icheck.c18
-rw-r--r--debugfs/logdump.c4
-rw-r--r--debugfs/lsdel.c6
-rw-r--r--debugfs/set_fields.c2
-rw-r--r--debugfs/unused.c6
-rw-r--r--debugfs/util.c30
9 files changed, 150 insertions, 116 deletions
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 2d640f2c..3bb309fd 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -45,8 +45,8 @@ const char *debug_prog_name;
ext2_filsys current_fs = NULL;
ext2_ino_t root, cwd;
-static void open_filesystem(char *device, int open_flags, blk_t superblock,
- blk_t blocksize, int catastrophic,
+static void open_filesystem(char *device, int open_flags, blk64_t superblock,
+ blk64_t blocksize, int catastrophic,
char *data_filename)
{
int retval;
@@ -125,8 +125,8 @@ void do_open_filesys(int argc, char **argv)
{
int c, err;
int catastrophic = 0;
- blk_t superblock = 0;
- blk_t blocksize = 0;
+ blk64_t superblock = 0;
+ blk64_t blocksize = 0;
int open_flags = EXT2_FLAG_SOFTSUPP_FEATURES;
char *data_filename = 0;
@@ -307,7 +307,6 @@ void do_show_super_stats(int argc, char *argv[])
{
dgrp_t i;
FILE *out;
- struct ext2_group_desc *gdp;
int c, header_only = 0;
int numdirs = 0, first, gdt_csum;
@@ -330,7 +329,7 @@ void do_show_super_stats(int argc, char *argv[])
list_super2(current_fs->super, out);
for (i=0; i < current_fs->group_desc_count; i++)
- numdirs += current_fs->group_desc[i].bg_used_dirs_count;
+ numdirs += ext2fs_bg_used_dirs_count(current_fs, i);
fprintf(out, "Directories: %d\n", numdirs);
if (header_only) {
@@ -340,27 +339,30 @@ void do_show_super_stats(int argc, char *argv[])
gdt_csum = EXT2_HAS_RO_COMPAT_FEATURE(current_fs->super,
EXT4_FEATURE_RO_COMPAT_GDT_CSUM);
- gdp = &current_fs->group_desc[0];
- for (i = 0; i < current_fs->group_desc_count; i++, gdp++) {
- fprintf(out, " Group %2d: block bitmap at %u, "
- "inode bitmap at %u, "
- "inode table at %u\n"
- " %d free %s, "
- "%d free %s, "
- "%d used %s%s",
- i, gdp->bg_block_bitmap,
- gdp->bg_inode_bitmap, gdp->bg_inode_table,
- gdp->bg_free_blocks_count,
- gdp->bg_free_blocks_count != 1 ? "blocks" : "block",
- gdp->bg_free_inodes_count,
- gdp->bg_free_inodes_count != 1 ? "inodes" : "inode",
- gdp->bg_used_dirs_count,
- gdp->bg_used_dirs_count != 1 ? "directories"
- : "directory", gdt_csum ? ", " : "\n");
+ for (i = 0; i < current_fs->group_desc_count; i++) {
+ fprintf(out, " Group %2d: block bitmap at %llu, "
+ "inode bitmap at %llu, "
+ "inode table at %llu\n"
+ " %u free %s, "
+ "%u free %s, "
+ "%u used %s%s",
+ i, ext2fs_block_bitmap_loc(current_fs, i),
+ ext2fs_inode_bitmap_loc(current_fs, i),
+ ext2fs_inode_table_loc(current_fs, i),
+ ext2fs_bg_free_blocks_count(current_fs, i),
+ ext2fs_bg_free_blocks_count(current_fs, i) != 1 ?
+ "blocks" : "block",
+ ext2fs_bg_free_inodes_count(current_fs, i),
+ ext2fs_bg_free_inodes_count(current_fs, i) != 1 ?
+ "inodes" : "inode",
+ ext2fs_bg_used_dirs_count(current_fs, i),
+ ext2fs_bg_used_dirs_count(current_fs, i) != 1 ? "directories"
+ : "directory", gdt_csum ? ", " : "\n");
if (gdt_csum)
- fprintf(out, "%d unused %s\n",
- gdp->bg_itable_unused,
- gdp->bg_itable_unused != 1 ? "inodes":"inode");
+ fprintf(out, "%u unused %s\n",
+ ext2fs_bg_itable_unused(current_fs, i),
+ ext2fs_bg_itable_unused(current_fs, i) != 1 ?
+ "inodes" : "inode");
first = 1;
print_bg_opts(current_fs, i, EXT2_BG_INODE_UNINIT, "Inode not init",
&first, out);
@@ -368,7 +370,7 @@ void do_show_super_stats(int argc, char *argv[])
&first, out);
if (gdt_csum) {
fprintf(out, "%sChecksum 0x%04x",
- first ? " [":", ", gdp->bg_checksum);
+ first ? " [":", ", ext2fs_bg_checksum(current_fs, i));
first = 0;
}
if (!first)
@@ -398,7 +400,7 @@ void do_dirty_filesys(int argc EXT2FS_ATTR((unused)),
struct list_blocks_struct {
FILE *f;
e2_blkcnt_t total;
- blk_t first_block, last_block;
+ blk64_t first_block, last_block;
e2_blkcnt_t first_bcnt, last_bcnt;
e2_blkcnt_t first;
};
@@ -412,18 +414,18 @@ static void finish_range(struct list_blocks_struct *lb)
else
fprintf(lb->f, ", ");
if (lb->first_block == lb->last_block)
- fprintf(lb->f, "(%lld):%u",
+ fprintf(lb->f, "(%lld):%llu",
(long long)lb->first_bcnt, lb->first_block);
else
- fprintf(lb->f, "(%lld-%lld):%u-%u",
+ fprintf(lb->f, "(%lld-%lld):%llu-%llu",
(long long)lb->first_bcnt, (long long)lb->last_bcnt,
lb->first_block, lb->last_block);
lb->first_block = 0;
}
static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
- blk_t *blocknr, e2_blkcnt_t blockcnt,
- blk_t ref_block EXT2FS_ATTR((unused)),
+ blk64_t *blocknr, e2_blkcnt_t blockcnt,
+ blk64_t ref_block EXT2FS_ATTR((unused)),
int ref_offset EXT2FS_ATTR((unused)),
void *private)
{
@@ -458,11 +460,11 @@ static int list_blocks_proc(ext2_filsys fs EXT2FS_ATTR((unused)),
else
fprintf(lb->f, ", ");
if (blockcnt == -1)
- fprintf(lb->f, "(IND):%u", *blocknr);
+ fprintf(lb->f, "(IND):%llu", (unsigned long long) *blocknr);
else if (blockcnt == -2)
- fprintf(lb->f, "(DIND):%u", *blocknr);
+ fprintf(lb->f, "(DIND):%llu", (unsigned long long) *blocknr);
else if (blockcnt == -3)
- fprintf(lb->f, "(TIND):%u", *blocknr);
+ fprintf(lb->f, "(TIND):%llu", (unsigned long long) *blocknr);
return 0;
}
@@ -543,8 +545,8 @@ static void dump_blocks(FILE *f, const char *prefix, ext2_ino_t inode)
lb.first_block = 0;
lb.f = f;
lb.first = 1;
- ext2fs_block_iterate2(current_fs, inode, BLOCK_FLAG_READ_ONLY, NULL,
- list_blocks_proc, (void *)&lb);
+ ext2fs_block_iterate3(current_fs, inode, BLOCK_FLAG_READ_ONLY, NULL,
+ list_blocks_proc, (void *)&lb);
finish_range(&lb);
if (lb.total)
fprintf(f, "\n%sTOTAL: %lld\n", prefix, (long long)lb.total);
@@ -990,8 +992,8 @@ void do_testi(int argc, char *argv[])
void do_freeb(int argc, char *argv[])
{
- blk_t block;
- blk_t count = 1;
+ blk64_t block;
+ blk64_t count = 1;
if (common_block_args_process(argc, argv, &block, &count))
return;
@@ -999,7 +1001,7 @@ void do_freeb(int argc, char *argv[])
return;
while (count-- > 0) {
if (!ext2fs_test_block_bitmap2(current_fs->block_map,block))
- com_err(argv[0], 0, "Warning: block %u already clear",
+ com_err(argv[0], 0, "Warning: block %llu already clear",
block);
ext2fs_unmark_block_bitmap2(current_fs->block_map,block);
block++;
@@ -1009,8 +1011,8 @@ void do_freeb(int argc, char *argv[])
void do_setb(int argc, char *argv[])
{
- blk_t block;
- blk_t count = 1;
+ blk64_t block;
+ blk64_t count = 1;
if (common_block_args_process(argc, argv, &block, &count))
return;
@@ -1018,7 +1020,7 @@ void do_setb(int argc, char *argv[])
return;
while (count-- > 0) {
if (ext2fs_test_block_bitmap2(current_fs->block_map,block))
- com_err(argv[0], 0, "Warning: block %u already set",
+ com_err(argv[0], 0, "Warning: block %llu already set",
block);
ext2fs_mark_block_bitmap2(current_fs->block_map,block);
block++;
@@ -1028,16 +1030,16 @@ void do_setb(int argc, char *argv[])
void do_testb(int argc, char *argv[])
{
- blk_t block;
- blk_t count = 1;
+ blk64_t block;
+ blk64_t count = 1;
if (common_block_args_process(argc, argv, &block, &count))
return;
while (count-- > 0) {
if (ext2fs_test_block_bitmap2(current_fs->block_map,block))
- printf("Block %u marked in use\n", block);
+ printf("Block %llu marked in use\n", block);
else
- printf("Block %u not in use\n", block);
+ printf("Block %llu not in use\n", block);
block++;
}
}
@@ -1329,14 +1331,16 @@ void do_link(int argc, char *argv[])
make_link(argv[1], argv[2]);
}
-static int mark_blocks_proc(ext2_filsys fs, blk_t *blocknr,
- int blockcnt EXT2FS_ATTR((unused)),
+static int mark_blocks_proc(ext2_filsys fs, blk64_t *blocknr,
+ e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+ blk64_t ref_block EXT2FS_ATTR((unused)),
+ int ref_offset EXT2FS_ATTR((unused)),
void *private EXT2FS_ATTR((unused)))
{
- blk_t block;
+ blk64_t block;
block = *blocknr;
- ext2fs_block_alloc_stats(fs, block, +1);
+ ext2fs_block_alloc_stats2(fs, block, +1);
return 0;
}
@@ -1372,8 +1376,8 @@ void do_undel(int argc, char *argv[])
if (debugfs_write_inode(ino, &inode, argv[0]))
return;
- ext2fs_block_iterate(current_fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
- mark_blocks_proc, NULL);
+ ext2fs_block_iterate3(current_fs, ino, BLOCK_FLAG_READ_ONLY, NULL,
+ mark_blocks_proc, NULL);
ext2fs_inode_alloc_stats2(current_fs, ino, +1, 0);
@@ -1414,7 +1418,7 @@ void do_unlink(int argc, char *argv[])
void do_find_free_block(int argc, char *argv[])
{
- blk_t free_blk, goal, first_free = 0;
+ blk64_t free_blk, goal, first_free = 0;
int count;
errcode_t retval;
char *tmp;
@@ -1448,8 +1452,8 @@ void do_find_free_block(int argc, char *argv[])
printf("Free blocks found: ");
free_blk = goal - 1;
while (count-- > 0) {
- retval = ext2fs_new_block(current_fs, free_blk + 1, 0,
- &free_blk);
+ retval = ext2fs_new_block2(current_fs, free_blk + 1, 0,
+ &free_blk);
if (first_free) {
if (first_free == free_blk)
break;
@@ -1459,7 +1463,7 @@ void do_find_free_block(int argc, char *argv[])
com_err("ext2fs_new_block", retval, 0);
return;
} else
- printf("%u ", free_blk);
+ printf("%llu ", free_blk);
}
printf("\n");
}
@@ -1751,14 +1755,16 @@ try_again:
}
-static int release_blocks_proc(ext2_filsys fs, blk_t *blocknr,
- int blockcnt EXT2FS_ATTR((unused)),
+static int release_blocks_proc(ext2_filsys fs, blk64_t *blocknr,
+ e2_blkcnt_t blockcnt EXT2FS_ATTR((unused)),
+ blk64_t ref_block EXT2FS_ATTR((unused)),
+ int ref_offset EXT2FS_ATTR((unused)),
void *private EXT2FS_ATTR((unused)))
{
- blk_t block;
+ blk64_t block;
block = *blocknr;
- ext2fs_block_alloc_stats(fs, block, -1);
+ ext2fs_block_alloc_stats2(fs, block, -1);
return 0;
}
@@ -1774,8 +1780,8 @@ static void kill_file_by_inode(ext2_ino_t inode)
if (!ext2fs_inode_has_valid_blocks(&inode_buf))
return;
- ext2fs_block_iterate(current_fs, inode, BLOCK_FLAG_READ_ONLY, NULL,
- release_blocks_proc, NULL);
+ ext2fs_block_iterate3(current_fs, inode, BLOCK_FLAG_READ_ONLY, NULL,
+ release_blocks_proc, NULL);
printf("\n");
ext2fs_inode_alloc_stats2(current_fs, inode, -1,
LINUX_S_ISDIR(inode_buf.i_mode));
@@ -1958,7 +1964,7 @@ void do_features(int argc, char *argv[])
void do_bmap(int argc, char *argv[])
{
ext2_ino_t ino;
- blk_t blk, pblk;
+ blk64_t blk, pblk;
int err;
errcode_t errcode;
@@ -1971,13 +1977,13 @@ void do_bmap(int argc, char *argv[])
return;
blk = parse_ulong(argv[2], argv[0], "logical_block", &err);
- errcode = ext2fs_bmap(current_fs, ino, 0, 0, 0, blk, &pblk);
+ errcode = ext2fs_bmap2(current_fs, ino, 0, 0, 0, blk, 0, &pblk);
if (errcode) {
com_err("argv[0]", errcode,
- "while mapping logical block %u\n", blk);
+ "while mapping logical block %llu\n", blk);
return;
}
- printf("%u\n", pblk);
+ printf("%llu\n", pblk);
}
void do_imap(int argc, char *argv[])
@@ -1996,12 +2002,12 @@ void do_imap(int argc, char *argv[])
offset = ((ino - 1) % EXT2_INODES_PER_GROUP(current_fs->super)) *
EXT2_INODE_SIZE(current_fs->super);
block = offset >> EXT2_BLOCK_SIZE_BITS(current_fs->super);
- if (!current_fs->group_desc[(unsigned)group].bg_inode_table) {
+ if (!ext2fs_inode_table_loc(current_fs, (unsigned)group)) {
com_err(argv[0], 0, "Inode table for group %lu is missing\n",
group);
return;
}
- block_nr = current_fs->group_desc[(unsigned)group].bg_inode_table +
+ block_nr = ext2fs_inode_table_loc(current_fs, (unsigned)group) +
block;
offset &= (EXT2_BLOCK_SIZE(current_fs->super) - 1);
@@ -2146,8 +2152,8 @@ int main(int argc, char **argv)
char *request = 0;
int exit_status = 0;
char *cmd_file = 0;
- blk_t superblock = 0;
- blk_t blocksize = 0;
+ blk64_t superblock = 0;
+ blk64_t blocksize = 0;
int catastrophic = 0;
char *data_filename = 0;
diff --git a/debugfs/debugfs.h b/debugfs/debugfs.h
index bbfa760b..deaa56fd 100644
--- a/debugfs/debugfs.h
+++ b/debugfs/debugfs.h
@@ -34,14 +34,16 @@ extern char *time_to_string(__u32);
extern time_t string_to_time(const char *);
extern unsigned long parse_ulong(const char *str, const char *cmd,
const char *descr, int *err);
-extern int strtoblk(const char *cmd, const char *str, blk_t *ret);
+extern unsigned long long parse_ulonglong(const char *str, const char *cmd,
+ const char *descr, int *err);
+extern int strtoblk(const char *cmd, const char *str, blk64_t *ret);
extern int common_args_process(int argc, char *argv[], int min_argc,
int max_argc, const char *cmd,
const char *usage, int flags);
extern int common_inode_args_process(int argc, char *argv[],
ext2_ino_t *inode, int flags);
extern int common_block_args_process(int argc, char *argv[],
- blk_t *block, blk_t *count);
+ blk64_t *block, blk64_t *count);
extern int debugfs_read_inode(ext2_ino_t ino, struct ext2_inode * inode,
const char *cmd);
extern int debugfs_read_inode_full(ext2_ino_t ino, struct ext2_inode * inode,
diff --git a/debugfs/htree.c b/debugfs/htree.c
index 36fdb0e3..08f9749e 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -31,7 +31,7 @@ static FILE *pager;
static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
struct ext2_dx_root_info * rootnode,
- blk_t blk, char *buf)
+ blk64_t blk, char *buf)
{
errcode_t errcode;
struct ext2_dir_entry *dirent;
@@ -39,25 +39,24 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
unsigned int offset = 0;
char name[EXT2_NAME_LEN + 1];
char tmp[EXT2_NAME_LEN + 16];
- blk_t pblk;
+ blk64_t pblk;
ext2_dirhash_t hash, minor_hash;
unsigned int rec_len;
int hash_alg;
- errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk);
+ errcode = ext2fs_bmap2(fs, ino, inode, buf, 0, blk, 0, &pblk);
if (errcode) {
com_err("htree_dump_leaf_node", errcode,
- "while mapping logical block %u\n", blk);
+ "while mapping logical block %llu\n", blk);
return;
}
- printf("Reading directory block %lu, phys %lu\n",
- (unsigned long) blk, (unsigned long) pblk);
+ printf("Reading directory block %llu, phys %llu\n", blk, pblk);
errcode = ext2fs_read_dir_block2(current_fs, pblk, buf, 0);
if (errcode) {
com_err("htree_dump_leaf_node", errcode,
- "while reading block %lu (%lu)\n",
- (unsigned long) blk, (unsigned long) pblk);
+ "while reading block %llu (%llu)\n",
+ blk, pblk);
return;
}
hash_alg = rootnode->hash_version;
@@ -78,7 +77,8 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
(rec_len < 8) ||
((rec_len % 4) != 0) ||
((((unsigned) dirent->name_len & 0xFF)+8) > rec_len)) {
- fprintf(pager, "Corrupted directory block (%u)!\n", blk);
+ fprintf(pager, "Corrupted directory block (%llu)!\n",
+ blk);
break;
}
thislen = ((dirent->name_len & 0xFF) < EXT2_NAME_LEN) ?
@@ -109,7 +109,7 @@ static void htree_dump_leaf_node(ext2_filsys fs, ext2_ino_t ino,
static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
struct ext2_dx_root_info * rootnode,
- blk_t blk, char *buf, int level);
+ blk64_t blk, char *buf, int level);
static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino,
@@ -158,11 +158,11 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino,
static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
struct ext2_inode *inode,
struct ext2_dx_root_info * rootnode,
- blk_t blk, char *buf, int level)
+ blk64_t blk, char *buf, int level)
{
char *cbuf;
errcode_t errcode;
- blk_t pblk;
+ blk64_t pblk;
cbuf = malloc(fs->blocksize);
if (!cbuf) {
@@ -170,17 +170,17 @@ static void htree_dump_int_block(ext2_filsys fs, ext2_ino_t ino,
return;
}
- errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk);
+ errcode = ext2fs_bmap2(fs, ino, inode, buf, 0, blk, 0, &pblk);
if (errcode) {
com_err("htree_dump_int_block", errcode,
- "while mapping logical block %u\n", blk);
+ "while mapping logical block %llu\n", blk);
goto errout;
}
errcode = io_channel_read_blk64(current_fs->io, pblk, 1, buf);
if (errcode) {
com_err("htree_dump_int_block", errcode,
- "while reading block %u\n", blk);
+ "while reading block %llu\n", blk);
goto errout;
}
@@ -199,7 +199,7 @@ void do_htree_dump(int argc, char *argv[])
struct ext2_inode inode;
int c;
int long_opt = 0;
- blk_t blk;
+ blk64_t blk;
char *buf = NULL;
struct ext2_dx_root_info *rootnode;
struct ext2_dx_entry *ent;
@@ -254,7 +254,7 @@ void do_htree_dump(int argc, char *argv[])
goto errout;
}
- errcode = ext2fs_bmap(current_fs, ino, &inode, buf, 0, 0, &blk);
+ errcode = ext2fs_bmap2(current_fs, ino, &inode, buf, 0, 0, 0, &blk);
if (errcode) {
com_err("do_htree_block", errcode,
"while mapping logical block 0\n");
@@ -348,8 +348,8 @@ struct process_block_struct {
int len;
};
-static int search_dir_block(ext2_filsys fs, blk_t *blocknr,
- e2_blkcnt_t blockcnt, blk_t ref_blk,
+static int search_dir_block(ext2_filsys fs, blk64_t *blocknr,
+ e2_blkcnt_t blockcnt, blk64_t ref_blk,
int ref_offset, void *priv_data);
void do_dirsearch(int argc, char *argv[])
@@ -377,16 +377,16 @@ void do_dirsearch(int argc, char *argv[])
pb.search_name = argv[2];
pb.len = strlen(pb.search_name);
- ext2fs_block_iterate2(current_fs, inode, BLOCK_FLAG_READ_ONLY, 0,
+ ext2fs_block_iterate3(current_fs, inode, BLOCK_FLAG_READ_ONLY, 0,
search_dir_block, &pb);
free(pb.buf);
}
-static int search_dir_block(ext2_filsys fs, blk_t *blocknr,
+static int search_dir_block(ext2_filsys fs, blk64_t *blocknr,
e2_blkcnt_t blockcnt,
- blk_t ref_blk EXT2FS_ATTR((unused)),
+ blk64_t ref_blk EXT2FS_ATTR((unused)),
int ref_offset EXT2FS_ATTR((unused)),
void *priv_data)
{
@@ -422,7 +422,7 @@ static int search_dir_block(ext2_filsys fs, blk_t *blocknr,
strncmp(p->search_name, dirent->name,
p->len) == 0) {
printf("Entry found at logical block %lld, "
- "phys %u, offset %u\n", (long long)blockcnt,
+ "phys %llu, offset %u\n", (long long)blockcnt,
*blocknr, offset);
printf("offset %u\n", offset);
return BLOCK_ABORT;
diff --git a/debugfs/icheck.c b/debugfs/icheck.c
index 4b090a9c..643bc5bc 100644
--- a/debugfs/icheck.c
+++ b/debugfs/icheck.c
@@ -19,7 +19,7 @@
#include "debugfs.h"
struct block_info {
- blk_t blk;
+ blk64_t blk;
ext2_ino_t ino;
};
@@ -31,9 +31,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)
{
@@ -111,11 +111,13 @@ void do_icheck(int argc, char **argv)
bw.inode = ino;
- if (inode.i_file_acl) {
- icheck_proc(current_fs, &inode.i_file_acl, 0,
+ if (ext2fs_file_acl_block(&inode)) {
+ blk64_t blk;
+ icheck_proc(current_fs, &blk, 0,
0, 0, &bw);
if (bw.blocks_left == 0)
break;
+ ext2fs_file_acl_block_set(&inode, blk);
}
if (!ext2fs_inode_has_valid_blocks(&inode))
@@ -127,7 +129,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,10 +155,10 @@ 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<block not found>\n", binfo->blk);
+ printf("%llu\t<block not found>\n", binfo->blk);
continue;
}
- printf("%u\t%u\n", binfo->blk, binfo->ino);
+ printf("%llu\t%u\n", binfo->blk, binfo->ino);
}
error_out:
diff --git a/debugfs/logdump.c b/debugfs/logdump.c
index 971d2b34..d755b2d4 100644
--- a/debugfs/logdump.c
+++ b/debugfs/logdump.c
@@ -157,7 +157,7 @@ void do_logdump(int argc, char **argv)
/ sizeof(struct ext2_inode));
inode_block_to_dump =
- current_fs->group_desc[inode_group].bg_inode_table +
+ ext2fs_inode_table_loc(current_fs, inode_group) +
(group_offset / inodes_per_block);
inode_offset_to_dump = ((group_offset % inodes_per_block)
* sizeof(struct ext2_inode));
@@ -182,7 +182,7 @@ void do_logdump(int argc, char **argv)
group_to_dump = ((block_to_dump -
es->s_first_data_block)
/ es->s_blocks_per_group);
- bitmap_to_dump = current_fs->group_desc[group_to_dump].bg_block_bitmap;
+ bitmap_to_dump = ext2fs_block_bitmap_loc(current_fs, group_to_dump);
}
if (!journal_fn && check_fs_open(argv[0]))
diff --git a/debugfs/lsdel.c b/debugfs/lsdel.c
index 7d9a74c4..91ac06ad 100644
--- a/debugfs/lsdel.c
+++ b/debugfs/lsdel.c
@@ -48,9 +48,9 @@ static int deleted_info_compare(const void *a, const void *b)
}
static int lsdel_proc(ext2_filsys fs,
- 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)
{
@@ -140,7 +140,7 @@ void do_lsdel(int argc, char **argv)
lsd.free_blocks = 0;
lsd.bad_blocks = 0;
- retval = ext2fs_block_iterate2(current_fs, ino,
+ retval = ext2fs_block_iterate3(current_fs, ino,
BLOCK_FLAG_READ_ONLY, block_buf,
lsdel_proc, &lsd);
if (retval) {
diff --git a/debugfs/set_fields.c b/debugfs/set_fields.c
index 9babccdd..7ba77825 100644
--- a/debugfs/set_fields.c
+++ b/debugfs/set_fields.c
@@ -417,7 +417,7 @@ static errcode_t parse_gd_csum(struct field_set_info *info, char *arg)
ext2fs_group_desc_csum_set(current_fs, set_bg);
set_gd = current_fs->group_desc[set_bg];
printf("Checksum set to 0x%04x\n",
- current_fs->group_desc[set_bg].bg_checksum);
+ ext2fs_bg_checksum(current_fs, set_bg));
return 0;
}
diff --git a/debugfs/unused.c b/debugfs/unused.c
index 598d08b3..b78d70b8 100644
--- a/debugfs/unused.c
+++ b/debugfs/unused.c
@@ -26,8 +26,8 @@ extern char *optarg;
void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv)
{
- unsigned long blk;
- unsigned char buf[EXT2_MAX_BLOCK_SIZE];
+ blk64_t blk;
+ unsigned char buf[EXT2_MAX_BLOCK_SIZE];
unsigned int i;
errcode_t retval;
@@ -49,7 +49,7 @@ void do_dump_unused(int argc EXT2FS_ATTR((unused)), char **argv)
break;
if (i >= current_fs->blocksize)
continue;
- printf("\nUnused block %lu contains non-zero data:\n\n",
+ printf("\nUnused block %llu contains non-zero data:\n\n",
blk);
for (i=0; i < current_fs->blocksize; i++)
fputc(buf[i], stdout);
diff --git a/debugfs/util.c b/debugfs/util.c
index e4ecb1fe..c3ac6f81 100644
--- a/debugfs/util.c
+++ b/debugfs/util.c
@@ -267,15 +267,39 @@ unsigned long parse_ulong(const char *str, const char *cmd,
}
/*
+ * This function will convert a string to an unsigned long long, printing
+ * an error message if it fails, and returning success or failure in err.
+ */
+unsigned long long parse_ulonglong(const char *str, const char *cmd,
+ const char *descr, int *err)
+{
+ char *tmp;
+ unsigned long long ret;
+
+ ret = strtoull(str, &tmp, 0);
+ if (*tmp == 0) {
+ if (err)
+ *err = 0;
+ return ret;
+ }
+ com_err(cmd, 0, "Bad %s - %s", descr, str);
+ if (err)
+ *err = 1;
+ else
+ exit(1);
+ return 0;
+}
+
+/*
* This function will convert a string to a block number. It returns
* 0 on success, 1 on failure.
*/
-int strtoblk(const char *cmd, const char *str, blk_t *ret)
+int strtoblk(const char *cmd, const char *str, blk64_t *ret)
{
blk_t blk;
int err;
- blk = parse_ulong(str, cmd, "block number", &err);
+ blk = parse_ulonglong(str, cmd, "block number", &err);
*ret = blk;
if (err)
com_err(cmd, 0, "Invalid block number: %s", str);
@@ -328,7 +352,7 @@ int common_inode_args_process(int argc, char *argv[],
* This is a helper function used by do_freeb, do_setb, and do_testb
*/
int common_block_args_process(int argc, char *argv[],
- blk_t *block, blk_t *count)
+ blk64_t *block, blk64_t *count)
{
int err;