From 329272195e0bdff915a46dff766fbed4fb2beb07 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Wed, 17 Dec 2008 06:03:00 +0000 Subject: [PATCH] Branch b1_6 b=17459 i=adilger, bobijam Make change to ext2_* api for BIG-ENDIAN environment. --- lustre/include/liblustre.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index dc1e481..c3f9b53 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -210,17 +210,30 @@ typedef int (write_proc_t)(struct file *file, const char *buffer, static __inline__ int ext2_set_bit(int nr, void *addr) { +#ifdef __BIG_ENDIAN + return set_bit((nr ^ ((BITS_PER_LONG-1) & ~0x7)), addr); +#else return set_bit(nr, addr); +#endif } static __inline__ int ext2_clear_bit(int nr, void *addr) { +#ifdef __BIG_ENDIAN + return clear_bit((nr ^ ((BITS_PER_LONG-1) & ~0x7)), addr); +#else return clear_bit(nr, addr); +#endif } static __inline__ int ext2_test_bit(int nr, void *addr) { +#ifdef __BIG_ENDIAN + __const__ unsigned char *tmp = (__const__ unsigned char *) addr; + return (tmp[nr >> 3] >> (nr & 7)) & 1; +#else return test_bit(nr, addr); +#endif } /* modules */ -- 1.8.3.1