All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h
@ 2016-02-05 22:28 Maxin B. John
  2016-02-05 22:28 ` [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc Maxin B. John
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Maxin B. John @ 2016-02-05 22:28 UTC (permalink / raw)
  To: linux-raid; +Cc: Maxin B. John

From: "Maxin B. John" <maxin.john@intel.com>

This fixes a compile warning when building with musl:

 In file included from util.c:27:0:
 |
 qemux86-64/usr/include/sys/poll.h:1:2:
 error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
 [-Werror=cpp]
 |  #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
 |   ^

Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
 util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util.c b/util.c
index 970d484..3e6d293 100644
--- a/util.c
+++ b/util.c
@@ -24,7 +24,6 @@
 
 #include	"mdadm.h"
 #include	"md_p.h"
-#include	<sys/poll.h>
 #include	<sys/socket.h>
 #include	<sys/utsname.h>
 #include	<sys/wait.h>
@@ -32,6 +31,7 @@
 #include	<sys/resource.h>
 #include	<sys/vfs.h>
 #include	<linux/magic.h>
+#include	<poll.h>
 #include	<ctype.h>
 #include	<dirent.h>
 #include	<signal.h>
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc
  2016-02-05 22:28 [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Maxin B. John
@ 2016-02-05 22:28 ` Maxin B. John
  2016-02-08 16:00   ` Jes Sorensen
  2016-02-05 22:28 ` [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain Maxin B. John
  2016-02-08 15:59 ` [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Jes Sorensen
  2 siblings, 1 reply; 10+ messages in thread
From: Maxin B. John @ 2016-02-05 22:28 UTC (permalink / raw)
  To: linux-raid; +Cc: Maxin B. John

From: "Maxin B. John" <maxin.john@intel.com>

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@intel.com>
---
 mdadm.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/mdadm.h b/mdadm.h
index dd02be7..230e60f 100755
--- a/mdadm.h
+++ b/mdadm.h
@@ -139,12 +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> */
+
+#ifndef bswap_16
 #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
 		     ((x) & 0xff00U) >> 8)
+#endif
+
+#ifndef bswap_32
 #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
 		     ((x) & 0xff000000U) >> 24 | \
 		     ((x) & 0x0000ff00U) << 8  | \
 		     ((x) & 0x00ff0000U) >> 8)
+#endif
+
+#ifndef bswap_64
 #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
 		     ((x) & 0xff00000000000000ULL) >> 56 | \
 		     ((x) & 0x000000000000ff00ULL) << 40 | \
@@ -153,6 +161,7 @@ struct dlm_lksb {
 		     ((x) & 0x0000ff0000000000ULL) >> 24 | \
 		     ((x) & 0x00000000ff000000ULL) << 8 | \
 		     ((x) & 0x000000ff00000000ULL) >> 8)
+#endif
 
 #if !defined(__KLIBC__)
 #if BYTE_ORDER == LITTLE_ENDIAN
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain
  2016-02-05 22:28 [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Maxin B. John
  2016-02-05 22:28 ` [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc Maxin B. John
@ 2016-02-05 22:28 ` Maxin B. John
  2016-02-06  1:17   ` Xiao Ni
  2016-02-08 15:59 ` [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Jes Sorensen
  2 siblings, 1 reply; 10+ messages in thread
From: Maxin B. John @ 2016-02-05 22:28 UTC (permalink / raw)
  To: linux-raid; +Cc: Maxin B. John

From: "Maxin B. John" <maxin.john@intel.com>

With x32 toolchain, this code caused the below listed error:

| Monitor.c: In function 'check_array':
| Monitor.c:545:16: error: comparison between signed and unsigned
integer expressions [-Werror=sign-compare]
|   if (st->utime == array.utime &&

Signed-off-by: Maxin B. John <maxin.john@intel.com>
---
 Monitor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Monitor.c b/Monitor.c
index f19c2e5..748d61b 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -542,7 +542,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		alert("NewArray", st->devname, NULL, ainfo);
 	}
 
-	if (st->utime == array.utime &&
+	if ((unsigned long)st->utime == array.utime &&
 	    st->failed == array.failed_disks &&
 	    st->working == array.working_disks &&
 	    st->spare == array.spare_disks &&
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain
  2016-02-05 22:28 ` [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain Maxin B. John
@ 2016-02-06  1:17   ` Xiao Ni
  2016-02-06  5:27     ` Maxin B. John
  0 siblings, 1 reply; 10+ messages in thread
From: Xiao Ni @ 2016-02-06  1:17 UTC (permalink / raw)
  To: Maxin B. John; +Cc: linux-raid, Maxin B. John



----- Original Message -----
> From: "Maxin B. John" <maxin.john@gmail.com>
> To: linux-raid@vger.kernel.org
> Cc: "Maxin B. John" <maxin.john@intel.com>
> Sent: Saturday, February 6, 2016 6:28:18 AM
> Subject: [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain
> 
> From: "Maxin B. John" <maxin.john@intel.com>
> 
> With x32 toolchain, this code caused the below listed error:
> 
> | Monitor.c: In function 'check_array':
> | Monitor.c:545:16: error: comparison between signed and unsigned
> integer expressions [-Werror=sign-compare]
> |   if (st->utime == array.utime &&
> 
> Signed-off-by: Maxin B. John <maxin.john@intel.com>
> ---
>  Monitor.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Monitor.c b/Monitor.c
> index f19c2e5..748d61b 100644
> --- a/Monitor.c
> +++ b/Monitor.c
> @@ -542,7 +542,7 @@ static int check_array(struct state *st, struct
> mdstat_ent *mdstat,
>  		alert("NewArray", st->devname, NULL, ainfo);
>  	}
>  
> -	if (st->utime == array.utime &&
> +	if ((unsigned long)st->utime == array.utime &&
>  	    st->failed == array.failed_disks &&
>  	    st->working == array.working_disks &&
>  	    st->spare == array.spare_disks &&

Hi Maxin

I sent the patch some days ago and I think it's not what Jes wanted. You can
see the mails in the list. I'll send the patch again.

Best Regards
Xiao

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain
  2016-02-06  1:17   ` Xiao Ni
@ 2016-02-06  5:27     ` Maxin B. John
  0 siblings, 0 replies; 10+ messages in thread
From: Maxin B. John @ 2016-02-06  5:27 UTC (permalink / raw)
  To: Xiao Ni; +Cc: linux-raid

Hi Xiao,

On Sat, Feb 6, 2016 at 3:17 AM, Xiao Ni <xni@redhat.com> wrote:
>
>
> ----- Original Message -----
>> From: "Maxin B. John" <maxin.john@gmail.com>
>> To: linux-raid@vger.kernel.org
>> Cc: "Maxin B. John" <maxin.john@intel.com>
>> Sent: Saturday, February 6, 2016 6:28:18 AM
>> Subject: [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain
>>
>> From: "Maxin B. John" <maxin.john@intel.com>
>>
>> With x32 toolchain, this code caused the below listed error:
>>
>> | Monitor.c: In function 'check_array':
>> | Monitor.c:545:16: error: comparison between signed and unsigned
>> integer expressions [-Werror=sign-compare]
>> |   if (st->utime == array.utime &&
>>
>> Signed-off-by: Maxin B. John <maxin.john@intel.com>
>> ---
>>  Monitor.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/Monitor.c b/Monitor.c
>> index f19c2e5..748d61b 100644
>> --- a/Monitor.c
>> +++ b/Monitor.c
>> @@ -542,7 +542,7 @@ static int check_array(struct state *st, struct
>> mdstat_ent *mdstat,
>>               alert("NewArray", st->devname, NULL, ainfo);
>>       }
>>
>> -     if (st->utime == array.utime &&
>> +     if ((unsigned long)st->utime == array.utime &&
>>           st->failed == array.failed_disks &&
>>           st->working == array.working_disks &&
>>           st->spare == array.spare_disks &&
>
> Hi Maxin
>
> I sent the patch some days ago and I think it's not what Jes wanted. You can
> see the mails in the list. I'll send the patch again.
>
Ah, I missed it. Thanks for fixing it.

> Best Regards
> Xiao

Thanks and Regards,
Maxin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h
  2016-02-05 22:28 [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Maxin B. John
  2016-02-05 22:28 ` [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc Maxin B. John
  2016-02-05 22:28 ` [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain Maxin B. John
@ 2016-02-08 15:59 ` Jes Sorensen
  2 siblings, 0 replies; 10+ messages in thread
From: Jes Sorensen @ 2016-02-08 15:59 UTC (permalink / raw)
  To: Maxin B. John; +Cc: linux-raid, Maxin B. John

"Maxin B. John" <maxin.john@gmail.com> writes:
> From: "Maxin B. John" <maxin.john@intel.com>
>
> This fixes a compile warning when building with musl:
>
>  In file included from util.c:27:0:
>  |
>  qemux86-64/usr/include/sys/poll.h:1:2:
>  error: #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
>  [-Werror=cpp]
>  |  #warning redirecting incorrect #include <sys/poll.h> to <poll.h>
>  |   ^
>
> Signed-off-by: Maxin B. John <maxin.john@intel.com>
> ---
>  util.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied!

Thanks,
Jes

>
> diff --git a/util.c b/util.c
> index 970d484..3e6d293 100644
> --- a/util.c
> +++ b/util.c
> @@ -24,7 +24,6 @@
>  
>  #include	"mdadm.h"
>  #include	"md_p.h"
> -#include	<sys/poll.h>
>  #include	<sys/socket.h>
>  #include	<sys/utsname.h>
>  #include	<sys/wait.h>
> @@ -32,6 +31,7 @@
>  #include	<sys/resource.h>
>  #include	<sys/vfs.h>
>  #include	<linux/magic.h>
> +#include	<poll.h>
>  #include	<ctype.h>
>  #include	<dirent.h>
>  #include	<signal.h>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc
  2016-02-05 22:28 ` [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc Maxin B. John
@ 2016-02-08 16:00   ` Jes Sorensen
  2016-02-08 16:10     ` Maxin B. John
  0 siblings, 1 reply; 10+ messages in thread
From: Jes Sorensen @ 2016-02-08 16:00 UTC (permalink / raw)
  To: Maxin B. John; +Cc: linux-raid, Maxin B. John

"Maxin B. John" <maxin.john@gmail.com> writes:
> From: "Maxin B. John" <maxin.john@intel.com>
>
> 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@intel.com>
> ---
>  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?

Cheers,
Jes

>
> diff --git a/mdadm.h b/mdadm.h
> index dd02be7..230e60f 100755
> --- a/mdadm.h
> +++ b/mdadm.h
> @@ -139,12 +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> */
> +
> +#ifndef bswap_16
>  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
>  		     ((x) & 0xff00U) >> 8)
> +#endif
> +
> +#ifndef bswap_32
>  #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
>  		     ((x) & 0xff000000U) >> 24 | \
>  		     ((x) & 0x0000ff00U) << 8  | \
>  		     ((x) & 0x00ff0000U) >> 8)
> +#endif
> +
> +#ifndef bswap_64
>  #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
>  		     ((x) & 0xff00000000000000ULL) >> 56 | \
>  		     ((x) & 0x000000000000ff00ULL) << 40 | \
> @@ -153,6 +161,7 @@ struct dlm_lksb {
>  		     ((x) & 0x0000ff0000000000ULL) >> 24 | \
>  		     ((x) & 0x00000000ff000000ULL) << 8 | \
>  		     ((x) & 0x000000ff00000000ULL) >> 8)
> +#endif
>  
>  #if !defined(__KLIBC__)
>  #if BYTE_ORDER == LITTLE_ENDIAN

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc
  2016-02-08 16:00   ` Jes Sorensen
@ 2016-02-08 16:10     ` Maxin B. John
  2016-02-10 19:20       ` Jes Sorensen
  0 siblings, 1 reply; 10+ messages in thread
From: Maxin B. John @ 2016-02-08 16:10 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: linux-raid, Maxin B. John

Hi Jes,

On Mon, Feb 8, 2016 at 6:00 PM, Jes Sorensen <Jes.Sorensen@redhat.com> wrote:
> "Maxin B. John" <maxin.john@gmail.com> writes:
>> From: "Maxin B. John" <maxin.john@intel.com>
>>
>> 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@intel.com>
>> ---
>>  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:

| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o mdadm.o mdadm.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o config.o config.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o policy.o policy.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o mdstat.o mdstat.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o ReadMe.o ReadMe.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o util.o util.c
| x86_64-poky-linux-uclibc-gcc  -m64 -march=core2 -mtune=core2 -msse3
-mfpmath=sse --sysroot=/home/maxin/poky/build/tmp/sysroots/qemux86-64
-Wall -Werror -Wstrict-prototypes -Wextra -Wno-unused-parameter -O2
-pipe -g -feliminate-unused-debug-types -fno-strict-aliasing
-DSendmail=\""/usr/sbin/sendmail -t"\" -DCONFFILE=\"/etc/mdadm.conf\"
-DCONFFILE2=\"/etc/mdadm/mdadm.conf\" -DMAP_DIR=\"/run/mdadm\"
-DMAP_FILE=\"map\" -DMDMON_DIR=\"/run/mdadm\"
-DFAILED_SLOTS_DIR=\"/run/mdadm/failed-slots\" -DNO_COROSYNC -DNO_DLM
 -DUSE_PTHREADS  -DBINDIR=\"/sbin\"  -c -o maps.o maps.c
| In file included from mdadm.c:28:0:
| mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
|  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
|  ^
| In file included from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
|                  from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
|                  from mdadm.h:36,
|                  from mdadm.c:28:
| /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:29:0:
note: this is the location of the previous definition
|  #define bswap_16(x) __bswap_16 (x)
|  ^
| In file included from mdadm.c:28:0:
| mdadm.h:144:0: error: "bswap_32" redefined [-Werror]
|  #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
|  ^
| In file included from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
|                  from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
|                  from mdadm.h:36,
|                  from mdadm.c:28:
| /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:32:0:
note: this is the location of the previous definition
|  #define bswap_32(x) __bswap_32 (x)
|  ^
| In file included from mdadm.c:28:0:
| mdadm.h:148:0: error: "bswap_64" redefined [-Werror]
|  #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
|  ^
| In file included from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
|                  from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
|                  from mdadm.h:36,
|                  from mdadm.c:28:
| /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:36:0:
note: this is the location of the previous definition
|  # define bswap_64(x) __bswap_64 (x)
|  ^
| In file included from config.c:25:0:
| mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
|  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
|  ^
| In file included from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
|                  from
/home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
|                  from mdadm.h:36,
|                  from config.c:25:
| /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:29:0:
note: this is the location of the previous definition
|  #define bswap_16(x) __bswap_16 (x)
|  ^
......

> Jes

Best Regards,
Maxin

>>
>> diff --git a/mdadm.h b/mdadm.h
>> index dd02be7..230e60f 100755
>> --- a/mdadm.h
>> +++ b/mdadm.h
>> @@ -139,12 +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> */
>> +
>> +#ifndef bswap_16
>>  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
>>                    ((x) & 0xff00U) >> 8)
>> +#endif
>> +
>> +#ifndef bswap_32
>>  #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
>>                    ((x) & 0xff000000U) >> 24 | \
>>                    ((x) & 0x0000ff00U) << 8  | \
>>                    ((x) & 0x00ff0000U) >> 8)
>> +#endif
>> +
>> +#ifndef bswap_64
>>  #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
>>                    ((x) & 0xff00000000000000ULL) >> 56 | \
>>                    ((x) & 0x000000000000ff00ULL) << 40 | \
>> @@ -153,6 +161,7 @@ struct dlm_lksb {
>>                    ((x) & 0x0000ff0000000000ULL) >> 24 | \
>>                    ((x) & 0x00000000ff000000ULL) << 8 | \
>>                    ((x) & 0x000000ff00000000ULL) >> 8)
>> +#endif
>>
>>  #if !defined(__KLIBC__)
>>  #if BYTE_ORDER == LITTLE_ENDIAN

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc
  2016-02-08 16:10     ` Maxin B. John
@ 2016-02-10 19:20       ` Jes Sorensen
  2016-02-11 11:26         ` Maxin B. John
  0 siblings, 1 reply; 10+ messages in thread
From: Jes Sorensen @ 2016-02-10 19:20 UTC (permalink / raw)
  To: Maxin B. John; +Cc: linux-raid, Maxin B. John

"Maxin B. John" <maxin.john@gmail.com> writes:
> Hi Jes,
>
> On Mon, Feb 8, 2016 at 6:00 PM, Jes Sorensen <Jes.Sorensen@redhat.com> wrote:
>> "Maxin B. John" <maxin.john@gmail.com> writes:
>>> From: "Maxin B. John" <maxin.john@intel.com>
>>>
>>> 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@intel.com>
>>> ---
>>>  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:

<ship>

> | In file included from mdadm.c:28:0:
> | mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
> |  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
> |  ^
> | In file included from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
> |                  from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
> |                  from mdadm.h:36,
> |                  from mdadm.c:28:
> | /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:29:0:
> note: this is the location of the previous definition
> |  #define bswap_16(x) __bswap_16 (x)
> |  ^
> | In file included from mdadm.c:28:0:
> | mdadm.h:144:0: error: "bswap_32" redefined [-Werror]
> |  #define bswap_32(x) (((x) & 0x000000ffU) << 24 | \
> |  ^
> | In file included from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
> |                  from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
> |                  from mdadm.h:36,
> |                  from mdadm.c:28:
> | /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:32:0:
> note: this is the location of the previous definition
> |  #define bswap_32(x) __bswap_32 (x)
> |  ^
> | In file included from mdadm.c:28:0:
> | mdadm.h:148:0: error: "bswap_64" redefined [-Werror]
> |  #define bswap_64(x) (((x) & 0x00000000000000ffULL) << 56 | \
> |  ^
> | In file included from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
> |                  from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
> |                  from mdadm.h:36,
> |                  from mdadm.c:28:
> | /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:36:0:
> note: this is the location of the previous definition
> |  # define bswap_64(x) __bswap_64 (x)
> |  ^
> | In file included from config.c:25:0:
> | mdadm.h:142:0: error: "bswap_16" redefined [-Werror]
> |  #define bswap_16(x) (((x) & 0x00ffU) << 8 | \
> |  ^
> | In file included from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/endian.h:59:0,
> |                  from
> /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/sys/types.h:216,
> |                  from mdadm.h:36,
> |                  from config.c:25:
> | /home/maxin/poky/build/tmp/sysroots/qemux86-64/usr/include/byteswap.h:29:0:
> note: this is the location of the previous definition
> |  #define bswap_16(x) __bswap_16 (x)
> |  ^
> ......

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.

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

Cheers,
Jes

From dd47b4e0c45fd72b94a9a7d0f0a5046ef9c8d97b Mon Sep 17 00:00:00 2001
From: Jes Sorensen <Jes.Sorensen@redhat.com>
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@gmail.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc
  2016-02-10 19:20       ` Jes Sorensen
@ 2016-02-11 11:26         ` Maxin B. John
  0 siblings, 0 replies; 10+ messages in thread
From: Maxin B. John @ 2016-02-11 11:26 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: linux-raid, Maxin B. John

Hi Jes,

On Wed, Feb 10, 2016 at 9:20 PM, Jes Sorensen <Jes.Sorensen@redhat.com> wrote:
> "Maxin B. John" <maxin.john@gmail.com> writes:
>> Hi Jes,
>>
>> On Mon, Feb 8, 2016 at 6:00 PM, Jes Sorensen <Jes.Sorensen@redhat.com> wrote:
>>> "Maxin B. John" <maxin.john@gmail.com> writes:
>>>> From: "Maxin B. John" <maxin.john@intel.com>
>>>>
>>>> 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@intel.com>
>>>> ---
>>>>  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@redhat.com>
> 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@gmail.com>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-11 11:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-05 22:28 [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Maxin B. John
2016-02-05 22:28 ` [PATCH 2/3][mdadm] mdadm.h: bswap is already defined in uclibc Maxin B. John
2016-02-08 16:00   ` Jes Sorensen
2016-02-08 16:10     ` Maxin B. John
2016-02-10 19:20       ` Jes Sorensen
2016-02-11 11:26         ` Maxin B. John
2016-02-05 22:28 ` [PATCH 3/3][mdadm] Monitor.c: fix compiler error with x32 toolchain Maxin B. John
2016-02-06  1:17   ` Xiao Ni
2016-02-06  5:27     ` Maxin B. John
2016-02-08 15:59 ` [PATCH 1/3][mdadm] util.c: include poll.h instead of sys/poll.h Jes Sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.