summaryrefslogtreecommitdiff
path: root/debugfs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2002-07-18 22:19:51 -0400
committerTheodore Ts'o <tytso@mit.edu>2002-07-18 22:19:51 -0400
commit621732c956f8ff049d032354fc8d6eab9abab1f4 (patch)
treee10b73705f5aea3b86f96d7995965f8aca50faf2 /debugfs
parent8d7f458743c2e37f15f58a38a67a85c3a8bb5f3d (diff)
downloade2fsprogs-621732c956f8ff049d032354fc8d6eab9abab1f4.tar.gz
htree.c (htree_dump_int_node): Add byte swapping code sot that
the htree dump function works on a big-endian machine.
Diffstat (limited to 'debugfs')
-rw-r--r--debugfs/ChangeLog5
-rw-r--r--debugfs/htree.c29
2 files changed, 23 insertions, 11 deletions
diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog
index aacb43da..7ddbd21a 100644
--- a/debugfs/ChangeLog
+++ b/debugfs/ChangeLog
@@ -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
diff --git a/debugfs/htree.c b/debugfs/htree.c
index 0da7c55d..e5838499 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -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");