From: Jim Fehlig <jfehlig@suse.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: Ian.Jackson@citrix.com, George.Dunlap@citix.com,
Rob Hoes <Rob.Hoes@citrix.com>,
xen-devel@lists.xen.org
Subject: Re: [PATCH] libxl: unconst the event argument to the event_occurs hook.
Date: Fri, 26 Apr 2013 15:22:57 -0600 [thread overview]
Message-ID: <517AF031.4070004@suse.com> (raw)
In-Reply-To: <1366976544-3428-1-git-send-email-ian.campbell@citrix.com>
Ian Campbell wrote:
> The event is supposed to become owned, and therefore freed, by the application
> and the const prevents this.
>
> Unfortunately there is no way to remove the const without breaking existing
> callers. The best we can do is use the LIBXL_API_VERSION provisions to remove
> the const for callers who wish only to support the 4.3 API and newer.
>
> Callers who wish to support 4.2 will need to live with casting away the const.
>
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Ian.Jackson@citrix.com
> Cc: George.Dunlap@citix.com
> Cc: Jim Fehlig <jfehlig@suse.com>
> Cc: Rob Hoes <Rob.Hoes@citrix.com>
> ---
> tools/libxl/libxl.h | 14 ++++++++++++--
> tools/libxl/libxl_event.h | 6 +++++-
> 2 files changed, 17 insertions(+), 3 deletions(-)
>
> diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
> index 25efa76..ef96bce 100644
> --- a/tools/libxl/libxl.h
> +++ b/tools/libxl/libxl.h
> @@ -273,9 +273,9 @@
> #include <libxl_uuid.h>
> #include <_libxl_list.h>
>
> -/* API compatibility. Only 0x040200 is supported at this time. */
> +/* API compatibility. */
> #ifdef LIBXL_API_VERSION
> -#if LIBXL_API_VERSION != 0x040200
> +#if LIBXL_API_VERSION != 0x040200 && LIBXL_API_VERSION != 0x040300
> #error Unknown LIBXL_API_VERSION
> #endif
> #endif
>
Should this hunk be in a separate patch? It seems to be introducing a
new API version :).
> @@ -308,6 +308,16 @@
> */
> #define LIBXL_HAVE_DEVICE_BACKEND_DOMNAME 1
>
> +/*
> + * LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG
> + *
> + * This argument was erroneously "const" in the 4.2 release despite
> + * the requirement for the callback to free the event.
> + */
> +#if LIBXL_API_VERSION != 0x040200
> +#define LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG 1
> +#endif
> +
> /* Functions annotated with LIBXL_EXTERNAL_CALLERS_ONLY may not be
> * called from within libxl itself. Callers outside libxl, who
> * do not #include libxl_internal.h, are fine. */
> diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h
> index 51f2721..27a65dc 100644
> --- a/tools/libxl/libxl_event.h
> +++ b/tools/libxl/libxl_event.h
> @@ -64,7 +64,11 @@ void libxl_event_free(libxl_ctx *ctx, libxl_event *event);
>
> typedef struct libxl_event_hooks {
> uint64_t event_occurs_mask;
> - void (*event_occurs)(void *user, const libxl_event *event);
> + void (*event_occurs)(void *user,
> +#ifndef LIBXL_HAVE_NONCONST_EVENT_OCCURS_EVENT_ARG
> + const
> +#endif
> + libxl_event *event);
> void (*disaster)(void *user, libxl_event_type type,
> const char *msg, int errnoval);
> } libxl_event_hooks;
>
Otherwise,
Reviewed-by: Jim Fehlig <jfehlig@suse.com>
next prev parent reply other threads:[~2013-04-26 21:22 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-26 11:42 [PATCH] libxl: unconst the event argument to the event_occurs hook Ian Campbell
2013-04-26 21:22 ` Jim Fehlig [this message]
2013-04-29 8:16 ` Ian Campbell
2013-04-30 4:24 ` Jim Fehlig
2013-04-30 9:43 ` Ian Campbell
2013-04-30 22:47 ` Jim Fehlig
2013-04-29 8:20 ` Ian Campbell
2013-05-01 10:48 ` [PATCH] libxl: unconst the event argument to the event_occurs hook. [and 1 more messages] Ian Jackson
2013-05-01 12:33 ` Ian Campbell
2013-04-29 10:04 ` [PATCH] libxl: unconst the event argument to the event_occurs hook George Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=517AF031.4070004@suse.com \
--to=jfehlig@suse.com \
--cc=George.Dunlap@citix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Rob.Hoes@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.