[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: fix build with glibc < 2.9
commit 23d72aaa0ccb206b0447b1efa9f1012f093162ee Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Jul 22 14:15:12 2015 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jul 22 14:15:12 2015 +0200 libxl: fix build with glibc < 2.9 htobe*() and be*toh() don't exist there. While replacing the 32-bit ones with hton() and ntoh() would be possible, there wouldn't be an obvious replacement for the 64-bit ones. Hence just take what current glibc (2.21) has (assuming __bswap_*() exists, which it does back to at least 2.4 according to my checking). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/libxl_osdeps.h | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/tools/libxl/libxl_osdeps.h b/tools/libxl/libxl_osdeps.h index b265df8..d9661c9 100644 --- a/tools/libxl/libxl_osdeps.h +++ b/tools/libxl/libxl_osdeps.h @@ -59,6 +59,42 @@ int asprintf(char **buffer, char *fmt, ...); int vasprintf(char **buffer, const char *fmt, va_list ap); #endif /*NEED_OWN_ASPRINTF*/ +#ifndef htobe32 /* glibc < 2.9 */ +# include <byteswap.h> + +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define htobe16(x) __bswap_16(x) +# define htole16(x) (x) +# define be16toh(x) __bswap_16(x) +# define le16toh(x) (x) + +# define htobe32(x) __bswap_32(x) +# define htole32(x) (x) +# define be32toh(x) __bswap_32(x) +# define le32toh(x) (x) + +# define htobe64(x) __bswap_64(x) +# define htole64(x) (x) +# define be64toh(x) __bswap_64(x) +# define le64toh(x) (x) +# else +# define htobe16(x) (x) +# define htole16(x) __bswap_16(x) +# define be16toh(x) (x) +# define le16toh(x) __bswap_16(x) + +# define htobe32(x) (x) +# define htole32(x) __bswap_32(x) +# define be32toh(x) (x) +# define le32toh(x) __bswap_32(x) + +# define htobe64(x) (x) +# define htole64(x) __bswap_64(x) +# define be64toh(x) (x) +# define le64toh(x) __bswap_64(x) +# endif +#endif + #endif /* -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |