From dd47b4e0c45fd72b94a9a7d0f0a5046ef9c8d97b Mon Sep 17 00:00:00 2001 From: Jes Sorensen Date: Wed, 10 Feb 2016 14:15:38 -0500 Subject: [PATCH] mdadm.h: rename bswap macros to avoid clash with uClibc definitions uClibc exposes it's own version of bswap_ 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" Signed-off-by: Jes Sorensen --- mdadm.h | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/mdadm.h b/mdadm.h index dd02be71..72888e2d 100755 --- a/mdadm.h +++ b/mdadm.h @@ -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 */ -#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) -- 2.39.2