Re: [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jes,

On Wed, Feb 10, 2016 at 9:20 PM, Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> wrote:
> "Maxin B. John" <maxin.john@xxxxxxxxx> writes:
>> Hi Jes,
>>
>> On Mon, Feb 8, 2016 at 6:00 PM, Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> wrote:
>>> "Maxin B. John" <maxin.john@xxxxxxxxx> writes:
>>>> From: "Maxin B. John" <maxin.john@xxxxxxxxx>
>>>>
>>>> Fixes this build error:
>>>>
>>>> | In file included from mdadm.c:28:0:
>>>> | mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
>>>> |  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
>>>> |  ^
>>>>
>>>> Signed-off-by: Maxin B. John <maxin.john@xxxxxxxxx>
>>>> ---
>>>>  mdadm.h | 9 +++++++++
>>>>  1 file changed, 9 insertions(+)
>>>
>>> Hi Maxin,
>>>
>>> I am not opposed to this, but I would like to understand why you see
>>> these duplicate defines. What defines it in your build environment?
>>
>>
>> I get the below listed error message with uclibc builds:
>
<snip>
>
> Maxin,
>
> I think it's actually wrong for uClibc to expose those macros with such
> a common name, but rather than picking up outside macros randomly I
> prefer to rename the mdadm ones to be sure we know what we are getting.

That looks reasonable to me.

> Instead of your patch, I applied this one instead. I hope that is fine
> with you.

Yes, this fix looks much better. Thank you!

> Cheers,
> Jes

Best Regards,
Maxin

>
> From dd47b4e0c45fd72b94a9a7d0f0a5046ef9c8d97b Mon Sep 17 00:00:00 2001
> From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
> 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_<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@xxxxxxxxx>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
> ---
>  mdadm.h | 52 ++++++++++++++++++++++++++--------------------------
>  1 file changed, 26 insertions(+), 26 deletions(-)
>
> diff --git a/mdadm.h b/mdadm.h
> index dd02be7..72888e2 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 <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)
> --
> 2.5.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux