htree.c (htree_dump_int_node): Add byte swapping code sot that

the htree dump function works on a big-endian machine.
This commit is contained in:
Theodore Ts'o 2002-07-18 22:19:51 -04:00
parent 8d7f458743
commit 621732c956
2 changed files with 23 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2002-07-18 Theodore Ts'o <tytso@mit.edu>
* htree.c (htree_dump_int_node): Add byte swapping code sot that
the htree dump function works on a big-endian machine.
2002-07-15 Theodore Ts'o <tytso@mit.edu>
* debugfs.c (do_show_super_stats): Calculate and print the number

View File

@ -102,29 +102,36 @@ static void htree_dump_int_node(ext2_filsys fs, ext2_ino_t ino,
struct ext2_dx_entry *ent,
char *buf, int level)
{
struct ext2_dx_countlimit *limit;
int i;
struct ext2_dx_countlimit limit;
struct ext2_dx_entry e;
int i;
limit = (struct ext2_dx_countlimit *) ent;
limit = *((struct ext2_dx_countlimit *) ent);
limit.count = ext2fs_le16_to_cpu(limit.count);
limit.limit = ext2fs_le16_to_cpu(limit.limit);
fprintf(pager, "Number of entries (count): %d\n", limit->count);
fprintf(pager, "Number of entries (limit): %d\n", limit->limit);
fprintf(pager, "Number of entries (count): %d\n", limit.count);
fprintf(pager, "Number of entries (limit): %d\n", limit.limit);
for (i=0; i < limit->count; i++)
for (i=0; i < limit.count; i++)
fprintf(pager, "Entry #%d: Hash 0x%08x, block %d\n", i,
i ? ent[i].hash : 0, ent[i].block);
i ? ext2fs_le32_to_cpu(ent[i].hash) : 0,
ext2fs_le32_to_cpu(ent[i].block));
fprintf(pager, "\n");
for (i=0; i < limit->count; i++) {
for (i=0; i < limit.count; i++) {
e.hash = ext2fs_le32_to_cpu(ent[i].hash);
e.block = ext2fs_le32_to_cpu(ent[i].block);
fprintf(pager, "Entry #%d: Hash 0x%08x, block %d\n", i,
i ? ent[i].hash : 0, ent[i].block);
i ? e.hash : 0, e.block);
if (level)
htree_dump_int_block(fs, ino, inode, root,
ent[i].block, buf, level-1);
e.block, buf, level-1);
else
htree_dump_leaf_node(fs, ino, inode, root,
ent[i].block, buf);
e.block, buf);
}
fprintf(pager, "---------------------\n");