Ken McGuire's patch to make mke2fs and e2fsck work on big endian systems like
authorRob Landley <rob@landley.net>
Mon, 23 Jan 2006 21:38:06 +0000 (21:38 -0000)
committerRob Landley <rob@landley.net>
Mon, 23 Jan 2006 21:38:06 +0000 (21:38 -0000)
PPC, with an obligatory couple of swipes from me.

e2fsprogs/Makefile.in
e2fsprogs/e2fsbb.h
e2fsprogs/e2fsck.c
e2fsprogs/ext2fs/ext2fs.h
e2fsprogs/ext2fs/native.c [deleted file]

index c492c67792a09953d8b952c3c3decff6e7792a10..6873e5adcad4a02ddea9b41c9b226133aa9b2eca 100644 (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))
 
index 6a3d28c69666876854630274b73ff5e00d479685..f8ab0f4932006464fa1a14540443e6a8fe66b605 100644 (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__ */
index 8b96b506806f765019a39513550f8b1efa60dd14..94ba1ee5e3bf614842dd57e1e44e659840c364b5 100644 (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);
index eda962239bc00e23f3fa83b866cf7a55724ccbe7..e2e86579bd42208cf28a3083a746572e312e97c4 100644 (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
 
diff --git a/e2fsprogs/ext2fs/native.c b/e2fsprogs/ext2fs/native.c
deleted file mode 100644 (file)
index 85d0989..0000000
+++ /dev/null
@@ -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
-}
-
-       
-