[libvirt] [PATCH 1/2] libxl: fix build with Xen4.3

Eric Blake eblake at redhat.com
Thu May 16 19:52:52 UTC 2013


On 05/16/2013 10:01 AM, Jim Fehlig wrote:
> Xen 4.3 fixes a mistake in the libxl event handler signature where the
> event owned by the application was defined as const.  Detect this and
> define the libvirt libxl event handler signature appropriately.
> ---
>  src/libxl/libxl_driver.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index b39e005..74e8331 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -700,7 +700,12 @@ libxlVmReap(libxlDriverPrivatePtr driver,
>   * Handle previously registered event notification from libxenlight
>   */
>  static void
> -libxlEventHandler(void *data ATTRIBUTE_UNUSED, const libxl_event *event)
> +libxlEventHandler(void *data ATTRIBUTE_UNUSED,
> +#ifdef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG
> +                  libxl_event *event)
> +#else
> +                  const libxl_event *event)
> +#endif

This works, but I'm not a fan of mid-() #ifdefs (it doesn't work if the
() itself is part of a macro call).  I'd much rather see:

#ifdef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG
# define VIR_LIBXL_EVENT_CONST /* empty */
#else
# define VIR_LIBXL_EVENT_CONST const
#endif

static void
libxlEventHandler(void *data ATTRIBUTE_UNUSED,
                  VIR_LIBXL_EVENT_CONST libxl_event *event)
{

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130516/da7cb122/attachment-0001.sig>


More information about the libvir-list mailing list