aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2006-01-23 21:38:06 +0000
committerRob Landley <rob@landley.net>2006-01-23 21:38:06 +0000
commit391a904f46d96430c8462bf077708b7179f4810d (patch)
tree5bdb4d58c9fb7bad6096a7e889caaeac0da11e96
parent6130b9b16027d09cacff9da44f3cd6efb57b9c54 (diff)
downloadbusybox-w32-391a904f46d96430c8462bf077708b7179f4810d.tar.gz
busybox-w32-391a904f46d96430c8462bf077708b7179f4810d.tar.bz2
busybox-w32-391a904f46d96430c8462bf077708b7179f4810d.zip
Ken McGuire's patch to make mke2fs and e2fsck work on big endian systems like
PPC, with an obligatory couple of swipes from me.
-rw-r--r--e2fsprogs/Makefile.in2
-rw-r--r--e2fsprogs/e2fsbb.h6
-rw-r--r--e2fsprogs/e2fsck.c11
-rw-r--r--e2fsprogs/ext2fs/ext2fs.h2
-rw-r--r--e2fsprogs/ext2fs/native.c27
5 files changed, 17 insertions, 31 deletions
diff --git a/e2fsprogs/Makefile.in b/e2fsprogs/Makefile.in
index c492c6779..6873e5adc 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 \
30 bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \ 30 bb_inode.c newdir.c alloc_sb.c lookup.c dirblock.c expanddir.c \
31 dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \ 31 dir_iterate.c link.c res_gdt.c icount.c get_pathname.c dblist.c \
32 dirhash.c version.c flushb.c unlink.c check_desc.c valid_blk.c \ 32 dirhash.c version.c flushb.c unlink.c check_desc.c valid_blk.c \
33 ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c 33 ext_attr.c bmap.c dblist_dir.c ext2fs_inline.c swapfs.c
34EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC)) 34EXT2FS_SRCS := $(patsubst %,ext2fs/%, $(EXT2FS_SRC))
35EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS)) 35EXT2FS_OBJS := $(patsubst %.c,%.o, $(EXT2FS_SRCS))
36 36
diff --git a/e2fsprogs/e2fsbb.h b/e2fsprogs/e2fsbb.h
index 6a3d28c69..f8ab0f493 100644
--- a/e2fsprogs/e2fsbb.h
+++ b/e2fsprogs/e2fsbb.h
@@ -54,4 +54,10 @@ typedef long errcode_t;
54#define HAVE_SYS_TYPES_H 1 54#define HAVE_SYS_TYPES_H 1
55#define HAVE_UNISTD_H 1 55#define HAVE_UNISTD_H 1
56 56
57/* Endianness */
58#if __BYTE_ORDER== __BIG_ENDIAN
59#define ENABLE_SWAPFS 1
60#define WORDS_BIGENDIAN 1
61#endif
62
57#endif /* __E2FSBB_H__ */ 63#endif /* __E2FSBB_H__ */
diff --git a/e2fsprogs/e2fsck.c b/e2fsprogs/e2fsck.c
index 8b96b5068..94ba1ee5e 100644
--- a/e2fsprogs/e2fsck.c
+++ b/e2fsprogs/e2fsck.c
@@ -15674,9 +15674,16 @@ restart:
15674 if (ctx->flags & E2F_FLAG_SIGNAL_MASK) 15674 if (ctx->flags & E2F_FLAG_SIGNAL_MASK)
15675 fatal_error(ctx, 0); 15675 fatal_error(ctx, 0);
15676#ifdef ENABLE_SWAPFS 15676#ifdef ENABLE_SWAPFS
15677
15678#ifdef WORDS_BIGENDIAN
15679#define NATIVE_FLAG EXT2_FLAG_SWAP_BYTES;
15680#else
15681#define NATIVE_FLAG 0;
15682#endif
15683
15684
15677 if (normalize_swapfs) { 15685 if (normalize_swapfs) {
15678 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) == 15686 if ((fs->flags & EXT2_FLAG_SWAP_BYTES) == NATIVE_FLAG) {
15679 ext2fs_native_flag()) {
15680 fprintf(stderr, _("%s: Filesystem byte order " 15687 fprintf(stderr, _("%s: Filesystem byte order "
15681 "already normalized.\n"), ctx->device_name); 15688 "already normalized.\n"), ctx->device_name);
15682 fatal_error(ctx, 0); 15689 fatal_error(ctx, 0);
diff --git a/e2fsprogs/ext2fs/ext2fs.h b/e2fsprogs/ext2fs/ext2fs.h
index eda962239..e2e86579b 100644
--- a/e2fsprogs/ext2fs/ext2fs.h
+++ b/e2fsprogs/ext2fs/ext2fs.h
@@ -34,7 +34,7 @@ extern "C" {
34 * has been configured or if we're being built on a CPU architecture 34 * has been configured or if we're being built on a CPU architecture
35 * with a non-native byte order. 35 * with a non-native byte order.
36 */ 36 */
37#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN) 37#if defined(ENABLE_SWAPFS) || defined(WORDS_BIGENDIAN) || __BYTE_ORDER== __BIG_ENDIAN
38#define EXT2FS_ENABLE_SWAPFS 38#define EXT2FS_ENABLE_SWAPFS
39#endif 39#endif
40 40
diff --git a/e2fsprogs/ext2fs/native.c b/e2fsprogs/ext2fs/native.c
deleted file mode 100644
index 85d098967..000000000
--- a/e2fsprogs/ext2fs/native.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * native.c --- returns the ext2_flag for a native byte order
3 *
4 * Copyright (C) 1996 Theodore Ts'o.
5 *
6 * %Begin-Header%
7 * This file may be redistributed under the terms of the GNU Public
8 * License.
9 * %End-Header%
10 */
11
12#include <stdio.h>
13
14#include "ext2_fs.h"
15#include "ext2fs.h"
16
17int ext2fs_native_flag(void)
18{
19#ifdef WORDS_BIGENDIAN
20 return EXT2_FLAG_SWAP_BYTES;
21#else
22 return 0;
23#endif
24}
25
26
27