1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

Make lvm2 compile on big endian archs; use the kernel/glibc's endian

conversion stuff, instead of implementing our own.  Tested on a little
endian system (x86); I'll let the debian handle big endian testing.  :)
This commit is contained in:
Andres Salomon 2002-05-07 05:54:14 +00:00
parent b7749b7a96
commit b9923fe3f2

View 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