Ken McGuire's patch to make mke2fs and e2fsck work on big endian systems like

PPC, with an obligatory couple of swipes from me.
This commit is contained in:
Rob Landley 2006-01-23 21:38:06 +00:00
parent 6130b9b160
commit 391a904f46
5 changed files with 17 additions and 31 deletions

View File

@ -30,7 +30,7 @@ EXT2FS_SRC := gen_bitmap.c bitops.c ismounted.c mkjournal.c unix_io.c \
bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \
dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \
dirhash.c version.c flushb.c unlink.c check_desc.c valid_blk.c \
ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c
ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c
EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC))
EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS))

View File

@ -54,4 +54,10 @@ typedef long errcode_t;
#define HAVE_SYS_TYPES_H 1
#define HAVE_UNISTD_H 1
/* Endianness */
#if __BYTE_ORDER== __BIG_ENDIAN
#define ENABLE_SWAPFS 1
#define WORDS_BIGENDIAN 1
#endif
#endif /* __E2FSBB_H__ */

View File

@ -15674,9 +15674,16 @@ restart:
if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
fatal_error(ctx, 0);
#ifdef ENABLE_SWAPFS
#ifdef WORDS_BIGENDIAN
#define NATIVE_FLAG EXT2_FLAG_SWAP_BYTES;
#else
#define NATIVE_FLAG 0;
#endif
if (normalize_swapfs) {
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) ==
ext2fs_native_flag()) {
if ((fs->flags & EXT2_FLAG_SWAP_BYTES) == NATIVE_FLAG) {
fprintf(stderr, _("%s: Filesystem byte order "
"already normalized.\n"), ctx->device_name);
fatal_error(ctx, 0);

View File

@ -34,7 +34,7 @@ extern "C" {
* has been configured or if we're being built on a CPU architecture
* with a non-native byte order.
*/
#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN)
#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN) || __BYTE_ORDER== __BIG_ENDIAN
#define EXT2FS_ENABLE_SWAPFS
#endif

View File

@ -1,27 +0,0 @@
/*
* native.c --- returns the ext2_flag for a native byte order
*
* Copyright (C) 1996 Theodore Ts'o.
*
* %Begin-Header%
* This file may be redistributed under the terms of the GNU Public
* License.
* %End-Header%
*/
#include <stdio.h>
#include "ext2_fs.h"
#include "ext2fs.h"
int ext2fs_native_flag(void)
{
#ifdef WORDS_BIGENDIAN
return EXT2_FLAG_SWAP_BYTES;
#else
return 0;
#endif
}