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

Re: [Xen-devel] [PATCH RFC 09/23] lz4: add support for OSes that don't have asm/unaligned.h



On Thu, 2014-04-24 at 11:19 +0200, Roger Pau Monnà wrote:
> On 24/04/14 10:28, Ian Campbell wrote:
> > On Wed, 2014-04-23 at 18:18 +0200, Roger Pau Monnà wrote:
> > 
> >>> In the scaffolding and not by modifying the imported code I pressume? In
> >>> which case, good thanks!
> >>
> >> While working around this issue, I've noticed that xen/common/lz4/defs.h
> >> has one branch for little endian and another one for big endian, but
> >> while compiling libxc, "__LITTLE_ENDIAN" is not defined and we fall into
> >> big endian, which seems wrong, because we don't have support for any big
> >> endian arch.
> >>
> >> Would it be OK to get rid of the big endian case, and only support
> >> little endian by default?
> > 
> > I think it would be better to #define __LITTLE_ENDIAN than to diverge
> > from the upstream of this file.
> 
> We have already diverged from upstream by adding those __LITTLE_ENDIAN 
> checks, the upstream file doesn't seem to contain them in any of the 
> versions:
> 
> http://lxr.free-electrons.com/source/lib/lz4/lz4defs.h

Ah, those blocks are part of our shimming to make things work (i.e.
trying and failing to do what I was suggesting).

Actually the two cases are pretty weird. they differ only in their use
of the unaligned macros for big endian -- which seems rather orthogonal
to the test for __LITTLE_ENDIAN.

> The following patch removes this cruft, but I'm unsure if we want to 
> keep this endianness differentiation:

I think this would be ok, if the alignedness really matters then that
should be what is tested for I think...


> 
> diff --git a/tools/libxc/xc_dom_decompress_lz4.c 
> b/tools/libxc/xc_dom_decompress_lz4.c
> index 08272fe..490ec56 100644
> --- a/tools/libxc/xc_dom_decompress_lz4.c
> +++ b/tools/libxc/xc_dom_decompress_lz4.c
> @@ -1,7 +1,6 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <inttypes.h>
> -#include <endian.h>
>  #include <stdint.h>
>  
>  #include "xg_private.h"
> diff --git a/xen/common/lz4/defs.h b/xen/common/lz4/defs.h
> index f46df08..d886a4e 100644
> --- a/xen/common/lz4/defs.h
> +++ b/xen/common/lz4/defs.h
> @@ -12,7 +12,6 @@
>  #include <asm/byteorder.h>
>  #endif
>  
> -#ifdef __LITTLE_ENDIAN
>  static inline u16 INIT get_unaligned_le16(const void *p)
>  {
>       return le16_to_cpup(p);
> @@ -22,19 +21,6 @@ static inline u32 INIT get_unaligned_le32(const void *p)
>  {
>       return le32_to_cpup(p);
>  }
> -#else
> -#include <asm/unaligned.h>
> -
> -static inline u16 INIT get_unaligned_le16(const void *p)
> -{
> -     return le16_to_cpu(__get_unaligned(p, 2));
> -}
> -
> -static inline u32 INIT get_unaligned_le32(void *p)
> -{
> -     return le32_to_cpu(__get_unaligned(p, 4));
> -}
> -#endif
>  
>  /*
>   * Detects 64 bits mode
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.