mirror of https://github.com/vitalif/e2fsprogs
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>bitmap-optimize
parent
27a0e958e6
commit
ccc7cf0328
|
@ -321,8 +321,10 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
gdp = (struct ext2_group_desc *) dest;
|
gdp = (struct ext2_group_desc *) dest;
|
||||||
for (j=0; j < groups_per_block*first_meta_bg; j++)
|
for (j=0; j < groups_per_block*first_meta_bg; j++) {
|
||||||
ext2fs_swap_group_desc2(fs, gdp++);
|
gdp = ext2fs_group_desc(fs, fs->group_desc, j);
|
||||||
|
ext2fs_swap_group_desc2(fs, gdp);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
dest += fs->blocksize*first_meta_bg;
|
dest += fs->blocksize*first_meta_bg;
|
||||||
}
|
}
|
||||||
|
@ -334,7 +336,7 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
for (j=0; j < groups_per_block; j++) {
|
for (j=0; j < groups_per_block; j++) {
|
||||||
/* The below happens to work... be careful. */
|
/* 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);
|
ext2fs_swap_group_desc2(fs, gdp);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -72,7 +72,7 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
|
||||||
sb->s_flags = ext2fs_swab32(sb->s_flags);
|
sb->s_flags = ext2fs_swab32(sb->s_flags);
|
||||||
sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written);
|
sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written);
|
||||||
sb->s_snapshot_inum = ext2fs_swab32(sb->s_snapshot_inum);
|
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 =
|
sb->s_snapshot_r_blocks_count =
|
||||||
ext2fs_swab64(sb->s_snapshot_r_blocks_count);
|
ext2fs_swab64(sb->s_snapshot_r_blocks_count);
|
||||||
sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list);
|
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_itable_unused = ext2fs_swab16(gdp->bg_itable_unused);
|
||||||
gdp->bg_checksum = ext2fs_swab16(gdp->bg_checksum);
|
gdp->bg_checksum = ext2fs_swab16(gdp->bg_checksum);
|
||||||
/* If we're 32-bit, we're done */
|
/* 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;
|
return;
|
||||||
|
|
||||||
/* Swap the 64-bit parts */
|
/* Swap the 64-bit parts */
|
||||||
|
|
Loading…
Reference in New Issue