diff options
-rw-r--r-- | e2fsprogs/Makefile.in | 2 | ||||
-rw-r--r-- | e2fsprogs/e2fsbb.h | 6 | ||||
-rw-r--r-- | e2fsprogs/e2fsck.c | 11 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/ext2fs.h | 2 | ||||
-rw-r--r-- | e2fsprogs/ext2fs/native.c | 27 |
5 files changed, 17 insertions, 31 deletions
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in index c492c67..6873e5a 100644 --- a/e2fsprogs/Makefile.in +++ b/e2fsprogs/Makefile.in @@ -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)) diff --git a/e2fsprogs/e2fsbb.h b/e2fsprogs/e2fsbb.h index 6a3d28c..f8ab0f4 100644 --- a/e2fsprogs/e2fsbb.h +++ b/e2fsprogs/e2fsbb.h @@ -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__ */ diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c index 8b96b50..94ba1ee 100644 --- a/e2fsprogs/e2fsck.c +++ b/e2fsprogs/e2fsck.c @@ -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); diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h index eda9622..e2e8657 100644 --- a/e2fsprogs/ext2fs/ext2fs.h +++ b/e2fsprogs/ext2fs/ext2fs.h @@ -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 index 85d0989..0000000 --- a/e2fsprogs/ext2fs/native.c +++ /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 -} - - - |