diff options
author | Theodore Ts'o <tytso@mit.edu> | 2010-07-30 18:41:47 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2010-07-30 18:41:47 -0400 |
commit | ccc7cf032852dd5c84b227bafb481b1d158e2b5e (patch) | |
tree | 1414aa2274b586e4aa681c3caf4d4000de77ad24 | |
parent | 27a0e958e619c3ca105e575670416a964fa2678f (diff) | |
download | e2fsprogs-ccc7cf032852dd5c84b227bafb481b1d158e2b5e.tar.gz |
libext2fs: fix obvious big-endian bugs introduced by 64-bit changes
These patches fix obvious bone-headed mistakes, so e2fsprogs will now
build and mostly work on powerpc. The m_meta_bg, u_mke2fs, and
u_tune2fs tests are still failing, however, so there's still work to do...
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r-- | lib/ext2fs/openfs.c | 8 | ||||
-rw-r--r-- | lib/ext2fs/swapfs.c | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c index 50aa207e..a0269c73 100644 --- a/lib/ext2fs/openfs.c +++ b/lib/ext2fs/openfs.c @@ -321,8 +321,10 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, goto cleanup; #ifdef WORDS_BIGENDIAN gdp = (struct ext2_group_desc *) dest; - for (j=0; j < groups_per_block*first_meta_bg; j++) - ext2fs_swap_group_desc2(fs, gdp++); + for (j=0; j < groups_per_block*first_meta_bg; j++) { + gdp = ext2fs_group_desc(fs, fs->group_desc, j); + ext2fs_swap_group_desc2(fs, gdp); + } #endif dest += fs->blocksize*first_meta_bg; } @@ -334,7 +336,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options, #ifdef WORDS_BIGENDIAN for (j=0; j < groups_per_block; j++) { /* The below happens to work... be careful. */ - gdp = ext2fs_group_desc(fs, blk, j); + gdp = ext2fs_group_desc(fs, fs->group_desc, j); ext2fs_swap_group_desc2(fs, gdp); } #endif diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c index 619bd2d5..de7585c1 100644 --- a/lib/ext2fs/swapfs.c +++ b/lib/ext2fs/swapfs.c @@ -72,7 +72,7 @@ void ext2fs_swap_super(struct ext2_super_block * sb) sb->s_flags = ext2fs_swab32(sb->s_flags); sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written); sb->s_snapshot_inum = ext2fs_swab32(sb->s_snapshot_inum); - sb->s_snapshot_id = ext2fs_swab32(s_snapshot_id); + sb->s_snapshot_id = ext2fs_swab32(sb->s_snapshot_id); sb->s_snapshot_r_blocks_count = ext2fs_swab64(sb->s_snapshot_r_blocks_count); sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list); @@ -107,7 +107,8 @@ void ext2fs_swap_group_desc2(ext2_filsys fs, struct ext2_group_desc *gdp) gdp->bg_itable_unused = ext2fs_swab16(gdp->bg_itable_unused); gdp->bg_checksum = ext2fs_swab16(gdp->bg_checksum); /* If we're 32-bit, we're done */ - if (fs && (!fs->super->s_desc_size >= EXT2_MIN_DESC_SIZE_64BIT)) + if (fs && (!fs->super->s_desc_size || + (fs->super->s_desc_size < EXT2_MIN_DESC_SIZE_64BIT))) return; /* Swap the 64-bit parts */ |