On 12/31/2010 01:04 PM, Greg Walton wrote:
> This is a  patch dealing with byte order defines I came up with while
> trying to get corosync to work on arm with little endian arch.
> 
> As near as I can tell, _BYTE_ORDER  (with a single leading underscore)
> is undefined in any normal case... same with single underscore endian
> defines.In a test program I messed with, if _BYTE_ORDER and
> _LITTLE_ENDIAN are both undefined, then
> 
> #ifdef _BYTE_ORDER == _BIG_ENDIAN
> 
> evaluates to true... which is no good if you are actually on a little
> endian machine and the double underscore prefix __BYTE_ORDER is equal to
> __LITTLE_ENDIAN
> 
> I first ran into this in totemip.c as suggested by a helpful IRC'er
> whose name I can't remember(thanks!) but I also see the same
> "undefined==undefined" symptom in crypto.c
> 
> I think the crypto.c patch needs more work to handle the case where
> either BYTE_ORDER or __BYTE_ORDER are undefined along with the
> corresponding double or single underscore ENDIAN defines. On my debian
> arm build, they are both defined so things seem to work out ok.
> 
> diff --git a/exec/totemip.c b/exec/totemip.c
> index d6bb34a..cdff21f 100644
> --- a/exec/totemip.c
> +++ b/exec/totemip.c
> @@ -472,7 +472,7 @@ int totemip_iface_check(struct totem_ip_address
> *bindnet,
>                       if (bindnet->family == AF_INET && bindnet->nodeid == 0) 
> {
>                               unsigned int nodeid = 0;
>                               memcpy (&nodeid, boundto->addr, sizeof (int));
> -#if _BYTE_ORDER == _BIG_ENDIAN
> +#if __BYTE_ORDER == __BIG_ENDIAN
>                               nodeid = swab32 (nodeid);
>  #endif

This patch looks correct

Please submit with a git signature and we will run through our test suite.

To do this,

git commit -s
(this will commit the change to your local repo and sign it)
git send-email [email protected]
--smtp-server=(your smtp server) -1

>                               /*
> diff --git a/exec/crypto.c b/exec/crypto.c
> index 1564ee8..fa1b447 100644
> --- a/exec/crypto.c
> +++ b/exec/crypto.c
> @@ -36,9 +36,9 @@ typedef uint64_t ulong64;
>  #define ENDIAN_LITTLE
>  #elif __BYTE_ORDER == __BIG_ENDIAN
>  #define ENDIAN_BIG
> -#elif _BYTE_ORDER == _LITTLE_ENDIAN
> +#elif BYTE_ORDER == LITTLE_ENDIAN
>  #define ENDIAN_LITTLE
> -#elif _BYTE_ORDER == _BIG_ENDIAN
> +#elif BYTE_ORDER == BIG_ENDIAN
>  #define ENDIAN_BIG
>  #else
>  #error "cannot detect byte order"
> 

For this part of the patch, we should only use __BYTE_ORDER and
__BIG_ENDIAN and ignore _BYTE_ORDER.  I don't believe any platform uses
_BYTE_ORDER and it is likely an oversight that has been in the code base
for 10 years.  Can you submit a new separate patch with that change with
a signature?

Thanks for the work!
-steve



> 
> _______________________________________________
> Openais mailing list
> [email protected]
> https://lists.linux-foundation.org/mailman/listinfo/openais

_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to