]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
htree.c (htree_dump_int_node): Add byte swapping code sot that
authorTheodore Ts'o <tytso@mit.edu>
Fri, 19 Jul 2002 02:19:51 +0000 (22:19 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 19 Jul 2002 02:19:51 +0000 (22:19 -0400)
the htree dump function works on a big-endian machine.

debugfs/ChangeLog
debugfs/htree.c

index aacb43da6b96f37b5cc57617ba255d3049c6b671..7ddbd21aef3ca9411e3977bf877b995808433ffe 100644 (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
index 0da7c55d33620b43389a33614a3539944273b7d7..e583849901f244a48a1b44f4157f1b53a3f6861f 100644 (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");