mdadm.h: rename bswap macros to avoid clash with uClibc definitions

uClibc exposes it's own version of bswap_<X> macros. Rather than
pulling in random macros by change, rename the mdadm ones to make sure
we know what we are getting.

Reported-by: "Maxin B. John" <maxin.john@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
This commit is contained in:
Jes Sorensen 2016-02-10 14:15:38 -05:00
parent 986b868817
commit dd47b4e0c4
1 changed files with 26 additions and 26 deletions

52
mdadm.h
View File

@ -139,20 +139,20 @@ struct dlm_lksb {
* and there is no standard conversion function so... */
/* And dietlibc doesn't think byteswap is ok, so.. */
/* #include <byteswap.h> */
#define bswap_16(x) (((x) & 0x00ffU) << 8 | \
((x) & 0xff00U) >> 8)
#define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
((x) & 0xff000000U) >> 24 | \
((x) & 0x0000ff00U) << 8 | \
((x) & 0x00ff0000U) >> 8)
#define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
((x) & 0xff00000000000000ULL) >> 56 | \
((x) & 0x000000000000ff00ULL) << 40 | \
((x) & 0x00ff000000000000ULL) >> 40 | \
((x) & 0x0000000000ff0000ULL) << 24 | \
((x) & 0x0000ff0000000000ULL) >> 24 | \
((x) & 0x00000000ff000000ULL) << 8 | \
((x) & 0x000000ff00000000ULL) >> 8)
#define __mdadm_bswap_16(x) (((x) & 0x00ffU) << 8 | \
((x) & 0xff00U) >> 8)
#define __mdadm_bswap_32(x) (((x) & 0x000000ffU) << 24 | \
((x) & 0xff000000U) >> 24 | \
((x) & 0x0000ff00U) << 8 | \
((x) & 0x00ff0000U) >> 8)
#define __mdadm_bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
((x) & 0xff00000000000000ULL) >> 56 | \
((x) & 0x000000000000ff00ULL) << 40 | \
((x) & 0x00ff000000000000ULL) >> 40 | \
((x) & 0x0000000000ff0000ULL) << 24 | \
((x) & 0x0000ff0000000000ULL) >> 24 | \
((x) & 0x00000000ff000000ULL) << 8 | \
((x) & 0x000000ff00000000ULL) >> 8)
#if !defined(__KLIBC__)
#if BYTE_ORDER == LITTLE_ENDIAN
@ -163,19 +163,19 @@ struct dlm_lksb {
#define __le32_to_cpu(_x) (unsigned int)(_x)
#define __le64_to_cpu(_x) (unsigned long long)(_x)
#define __cpu_to_be16(_x) bswap_16(_x)
#define __cpu_to_be32(_x) bswap_32(_x)
#define __cpu_to_be64(_x) bswap_64(_x)
#define __be16_to_cpu(_x) bswap_16(_x)
#define __be32_to_cpu(_x) bswap_32(_x)
#define __be64_to_cpu(_x) bswap_64(_x)
#define __cpu_to_be16(_x) __mdadm_bswap_16(_x)
#define __cpu_to_be32(_x) __mdadm_bswap_32(_x)
#define __cpu_to_be64(_x) __mdadm_bswap_64(_x)
#define __be16_to_cpu(_x) __mdadm_bswap_16(_x)
#define __be32_to_cpu(_x) __mdadm_bswap_32(_x)
#define __be64_to_cpu(_x) __mdadm_bswap_64(_x)
#elif BYTE_ORDER == BIG_ENDIAN
#define __cpu_to_le16(_x) bswap_16(_x)
#define __cpu_to_le32(_x) bswap_32(_x)
#define __cpu_to_le64(_x) bswap_64(_x)
#define __le16_to_cpu(_x) bswap_16(_x)
#define __le32_to_cpu(_x) bswap_32(_x)
#define __le64_to_cpu(_x) bswap_64(_x)
#define __cpu_to_le16(_x) __mdadm_bswap_16(_x)
#define __cpu_to_le32(_x) __mdadm_bswap_32(_x)
#define __cpu_to_le64(_x) __mdadm_bswap_64(_x)
#define __le16_to_cpu(_x) __mdadm_bswap_16(_x)
#define __le32_to_cpu(_x) __mdadm_bswap_32(_x)
#define __le64_to_cpu(_x) __mdadm_bswap_64(_x)
#define __cpu_to_be16(_x) (unsigned int)(_x)
#define __cpu_to_be32(_x) (unsigned int)(_x)