]> sourceware.org Git - lvm2.git/commitdiff
Make lvm2 compile on big endian archs; use the kernel/glibc's endian
authorAndres Salomon <dilinger@voxel.net>
Tue, 7 May 2002 05:54:14 +0000 (05:54 +0000)
committerAndres Salomon <dilinger@voxel.net>
Tue, 7 May 2002 05:54:14 +0000 (05:54 +0000)
conversion stuff, instead of implementing our own.  Tested on a little
endian system (x86); I'll let the debian handle big endian testing.  :)

lib/mm/xlate.h

index 6d4dc4bb3809730f87c5fe8bc2db290bcef94057..97b0afaea140930ba631e835040fc12f09d9fd0e 100644 (file)
@@ -8,25 +8,21 @@
 #ifndef _LVM_XLATE_H
 #define _LVM_XLATE_H
 
-/* FIXME: finish these as inlines */
+#include <asm/byteorder.h>
 
-uint16_t shuffle16(uint16_t n);
-uint32_t shuffle32(uint32_t n);
-uint64_t shuffle64(uint64_t n);
+static inline uint16_t xlate16(uint16_t x)
+{
+       return __cpu_to_le16(x);
+}
 
-/* xlate functions move data between core and disk */
-#if __BYTE_ORDER == __BIG_ENDIAN
-#   define xlate16(x) shuffle16(x)
-#   define xlate32(x) shuffle32(x)
-#   define xlate64(x) shuffle64(x)
+static inline uint32_t xlate32(uint32_t x)
+{
+       return __cpu_to_le32(x);
+}
 
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
-#   define xlate16(x) (x)
-#   define xlate32(x) (x)
-#   define xlate64(x) (x)
-
-#else
-#   error "__BYTE_ORDER must be defined as __LITTLE_ENDIAN or __BIG_ENDIAN"
-#endif
+static inline uint64_t xlate64(uint64_t x)
+{
+       return __cpu_to_le64(x);
+}
 
 #endif
This page took 0.041898 seconds and 5 git commands to generate.