xfs-masters
[Top] [All Lists]

[xfs-masters] warning: "__BIG_ENDIAN" is not defined

To: linux-xfs@xxxxxxxxxxx
Subject: [xfs-masters] warning: "__BIG_ENDIAN" is not defined
From: "Luck, Tony" <tony.luck@xxxxxxxxx>
Date: Wed, 7 Sep 2005 14:45:49 -0700
Cc: xfs-masters@xxxxxxxxxxx, nathans@xxxxxxx, linux-kernel@xxxxxxxxxxxxxxx
Reply-to: xfs-masters@xxxxxxxxxxx
Sender: xfs-masters-bounce@xxxxxxxxxxx
I see a lot (90) of warnings when building xfs on ia64.  The
problem is code that does:

#if __BYTE_ORDER != __BIG_ENDIAN

since __BIG_ENDIAN is not defined on ia64.  I assume that other
little endian architectures see the same thing, while big endian
machines must see complaints about __LITTLE_ENDIAN being undefined.

gcc version 3.4.3 (as shipped on RedHat EL4).

Following patch was compiled tested on ia64 ... all ".o" files in the
fs/xfs directory are identical when compiled with/without this patch
applied, but you would be wise to apply the same test on a big-endian
machine before applying it.

Signed-off-by: Tony Luck <tony.luck@xxxxxxxxx>

---

 fs/xfs/xfs_arch.h       |    2 +-
 fs/xfs/xfs_bmap_btree.c |    4 ++--
 fs/xfs/xfs_bmap_btree.h |    6 +++---
 fs/xfs/xfs_dir_leaf.h   |    6 +++---
 fs/xfs/xfs_inode_item.c |    4 ++--
 fs/xfs/xfs_log_priv.h   |    6 +++---
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/fs/xfs/xfs_arch.h b/fs/xfs/xfs_arch.h
--- a/fs/xfs/xfs_arch.h
+++ b/fs/xfs/xfs_arch.h
@@ -52,7 +52,7 @@
 /* do we need conversion? */
 
 #define ARCH_NOCONVERT 1
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
 # define ARCH_CONVERT  0
 #else
 # define ARCH_CONVERT  ARCH_NOCONVERT
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -2017,7 +2017,7 @@ xfs_bmbt_get_state(
                                ext_flag);
 }
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifdef __LITTLE_ENDIAN
 /* Endian flipping versions of the bmbt extraction functions */
 void
 xfs_bmbt_disk_get_all(
@@ -2531,7 +2531,7 @@ xfs_bmbt_set_allf(
 #endif /* XFS_BIG_BLKNOS */
 }
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifdef __LITTLE_ENDIAN
 /*
  * Set all the fields in a bmap extent record from the uncompressed form.
  */
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -62,7 +62,7 @@ typedef struct xfs_bmdr_block
  *  l1:0-20 are blockcount.
  */
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
 
 #define BMBT_TOTAL_BITLEN      128     /* 128 bits, 16 bytes */
 #define BMBT_EXNTFLAG_BITOFF   0
@@ -505,7 +505,7 @@ xfs_exntst_t
 xfs_bmbt_get_state(
        xfs_bmbt_rec_t  *r);
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifdef __LITTLE_ENDIAN
 void
 xfs_bmbt_disk_get_all(
        xfs_bmbt_rec_t  *r,
@@ -623,7 +623,7 @@ xfs_bmbt_set_state(
        xfs_bmbt_rec_t  *r,
        xfs_exntst_t    v);
 
-#if __BYTE_ORDER != __BIG_ENDIAN
+#ifdef __LITTLE_ENDIAN
 void
 xfs_bmbt_disk_set_all(
        xfs_bmbt_rec_t  *r,
diff --git a/fs/xfs/xfs_dir_leaf.h b/fs/xfs/xfs_dir_leaf.h
--- a/fs/xfs/xfs_dir_leaf.h
+++ b/fs/xfs/xfs_dir_leaf.h
@@ -127,13 +127,13 @@ typedef union {
         * Watch the order here (endian-ness dependent).
         */
        struct {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
                xfs_dahash_t    h;      /* hash value */
                __uint32_t      be;     /* block and entry */
-#else  /* __BYTE_ORDER == __BIG_ENDIAN */
+#else  /* __BIG_ENDIAN */
                __uint32_t      be;     /* block and entry */
                xfs_dahash_t    h;      /* hash value */
-#endif /* __BYTE_ORDER == __BIG_ENDIAN */
+#endif /* __BIG_ENDIAN */
        } s;
 } xfs_dircook_t;
 
diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -339,7 +339,7 @@ xfs_inode_item_format(
                        nrecs = ip->i_df.if_bytes /
                                (uint)sizeof(xfs_bmbt_rec_t);
                        ASSERT(nrecs > 0);
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
                        if (nrecs == ip->i_d.di_nextents) {
                                /*
                                 * There are no delayed allocation
@@ -467,7 +467,7 @@ xfs_inode_item_format(
 #endif
                        ASSERT(nrecs > 0);
                        ASSERT(nrecs == ip->i_d.di_anextents);
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
                        /*
                         * There are not delayed allocation extents
                         * for attributes, so just point at the array.
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -112,7 +112,7 @@ struct xfs_mount;
  * this has endian issues, of course.
  */
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
 #define GET_CLIENT_ID(i,arch) \
     ((i) & 0xff)
 #else
@@ -366,10 +366,10 @@ typedef struct xlog_op_header {
 #define XLOG_FMT_IRIX_BE  3
 
 /* our fmt */
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef __LITTLE_ENDIAN
 #define XLOG_FMT XLOG_FMT_LINUX_LE
 #else
-#if __BYTE_ORDER == __BIG_ENDIAN
+#ifdef __BIG_ENDIAN
 #define XLOG_FMT XLOG_FMT_LINUX_BE
 #else
 #error unknown byte order


<Prev in Thread] Current Thread [Next in Thread>