Roger Pau Monne
2011-Dec-15 17:18 UTC
[PATCH] blktap2: use HAVE_BYTESWAP_H and _BYTESWAP_H for uclibc compatibility
# HG changeset patch # User Roger Pau Monne <roger.pau@entel.upc.edu> # Date 1323969492 -3600 # Node ID a01f1e2f654ea54bbf5d0a77b315b676cc494aa8 # Parent 0051e09f73efea06f2f28c0ece57194e286daedc blktap2: use HAVE_BYTESWAP_H and _BYTESWAP_H for uclibc compatibility uclibc defines _BYTESWAP_H instead of HAVE_BYTESWAP_H in byteswap.h: http://git.uclibc.org/uClibc/tree/include/byteswap.h Without this fix, blktap2 doesn''t compile under uclibc and throws the following error: gcc -O1 -fno-omit-frame-pointer -m64 -g -fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wdeclaration-after-statement -Wno-unused-but-set-variable -D__XEN_TOOLS__ -MMD -MF .block-qcow.o.d -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -fno-optimize-sibling-calls -Werror -g -O0 -Wno-unused -fno-strict-aliasing -I../include -I../drivers -I/root/xen-unstable/tools/blktap2/drivers/../../../tools/libxc -I/root/xen-unstable/tools/blktap2/drivers/../../../tools/include -I /root/xen-unstable/tools/blktap2/drivers/../../../tools/memshr -D_GNU_SOURCE -DUSE_NFS_LOCKS -fPIC -I /root/xen-unstable/tools/blktap2/drivers/../../../tools/libaio/src -c -o block-qcow.o block-qcow.c -I/usr/local/include In file included from block-qcow.c:37:0: bswap.h:23:0: error: "bswap_16" redefined [-Werror] /usr/include/byteswap.h:30:0: note: this is the location of the previous definition bswap.h:31:0: error: "bswap_32" redefined [-Werror] /usr/include/byteswap.h:33:0: note: this is the location of the previous definition bswap.h:41:0: error: "bswap_64" redefined [-Werror] /usr/include/byteswap.h:37:0: note: this is the location of the previous definition cc1: all warnings being treated as errors Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu> diff -r 0051e09f73ef -r a01f1e2f654e tools/blktap2/drivers/bswap.h --- a/tools/blktap2/drivers/bswap.h Thu Dec 15 10:00:09 2011 +0100 +++ b/tools/blktap2/drivers/bswap.h Thu Dec 15 18:18:12 2011 +0100 @@ -15,7 +15,7 @@ #define bswap_64(x) swap64(x) #else -#ifdef HAVE_BYTESWAP_H +#if defined(HAVE_BYTESWAP_H) || defined(_BYTESWAP_H) #include <byteswap.h> #else
Roger Pau Monné
2011-Dec-15 18:05 UTC
Re: [PATCH] blktap2: use HAVE_BYTESWAP_H and _BYTESWAP_H for uclibc compatibility
I''m having second thoughts about this patch, although it works, I''m not sure it''s the right way to do it. I don''t know why configure fails to set HAVE_BYTESWAP_H when using uclibc. Any thoughts?
Roger Pau Monné
2011-Dec-16 13:19 UTC
Re: [PATCH] blktap2: use HAVE_BYTESWAP_H and _BYTESWAP_H for uclibc compatibility
This patch is wrong, but I think blktap bswap.h is also wrong, because HAVE_BYTESWAP_H is defined by qemu, but blktap doesn''t include qemu config file, so HAVE_BYTESWAP_H is not defined in this header file (which doesn''t mean that byteswap.h is not present on the system). How should we fix this? Forget about including byteswap.h and always define the functions ourselves? Thanks, Roger.
Ian Campbell
2011-Dec-16 13:25 UTC
Re: [PATCH] blktap2: use HAVE_BYTESWAP_H and _BYTESWAP_H for uclibc compatibility
On Fri, 2011-12-16 at 13:19 +0000, Roger Pau Monné wrote:> This patch is wrong, but I think blktap bswap.h is also wrong, because > HAVE_BYTESWAP_H is defined by qemu, but blktap doesn't include qemu > config file, so HAVE_BYTESWAP_H is not defined in this header file > (which doesn't mean that byteswap.h is not present on the system). How > should we fix this? Forget about including byteswap.h and always > define the functions ourselves?If HAVE_BYTESWAP_H has never been defined up until now can't we just delete the include?> > Thanks, Roger. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel