[libvirt] [PATCH] Fix compilation of legacy xen driver with Xen 4.2

In Xen 4.2, xs.h is deprecated in favor of xenstore.h. xs.h now contains #warning xs.h is deprecated use xenstore.h instead #include <xenstore.h> which fails compilation when warnings are treated as errors. Introduce a configure-time check for xenstore.h and if found, use it instead of xs.h. --- configure.ac | 2 ++ src/xen/block_stats.c | 6 +++++- src/xen/xs_internal.c | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 38d94d4..ae26de7 100644 --- a/configure.ac +++ b/configure.ac @@ -768,6 +768,8 @@ if test "$with_xen" != "no" ; then fi if test "$with_xen" != "no" ; then + dnl In Xen 4.2, xs.h is deprecated in favor of xenstore.h. + AC_CHECK_HEADERS([xenstore.h]) AC_CHECK_HEADERS([xen/xen.h xen/version.h xen/dom0_ops.h],,[ if test "$with_xen" = "yes"; then fail=1 diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c index f3b756a..5ab1ce4 100644 --- a/src/xen/block_stats.c +++ b/src/xen/block_stats.c @@ -32,7 +32,11 @@ # include <unistd.h> # include <regex.h> -# include <xs.h> +# if HAVE_XENSTORE_H +# include <xenstore.h> +# else +# include <xs.h> +# endif # include "virterror_internal.h" # include "datatypes.h" diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c index 12efa0c..a91d409 100644 --- a/src/xen/xs_internal.c +++ b/src/xen/xs_internal.c @@ -35,7 +35,11 @@ #include <xen/dom0_ops.h> #include <xen/version.h> -#include <xs.h> +#if HAVE_XENSTORE_H +# include <xenstore.h> +#else +# include <xs.h> +#endif #include "virterror_internal.h" #include "datatypes.h" -- 1.7.10.4

On 09/26/2012 03:49 PM, Jim Fehlig wrote:
In Xen 4.2, xs.h is deprecated in favor of xenstore.h. xs.h now contains
#warning xs.h is deprecated use xenstore.h instead #include <xenstore.h>
which fails compilation when warnings are treated as errors.
Introduce a configure-time check for xenstore.h and if found, use it instead of xs.h. --- configure.ac | 2 ++ src/xen/block_stats.c | 6 +++++- src/xen/xs_internal.c | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-)
ACK. -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Eric Blake wrote:
On 09/26/2012 03:49 PM, Jim Fehlig wrote:
In Xen 4.2, xs.h is deprecated in favor of xenstore.h. xs.h now contains
#warning xs.h is deprecated use xenstore.h instead #include <xenstore.h>
which fails compilation when warnings are treated as errors.
Introduce a configure-time check for xenstore.h and if found, use it instead of xs.h. --- configure.ac | 2 ++ src/xen/block_stats.c | 6 +++++- src/xen/xs_internal.c | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-)
ACK.
Thanks. I've pushed this and the fix for xen sysctl 9.
participants (2)
-
Eric Blake
-
Jim Fehlig