On Tue, 2011-07-12 at 19:37 +0100, Ian Jackson wrote:
> This is a proposed internal API for other parts of libxl to use when
> dealing with events (both osevents and API events ie libxl_event).
>
> There will probably also be some helper functions for
> libxl_awaiting_*.
>
> THIS PATCH IS AN RFC AND SHOULD NOT BE APPLIED. It contains only the
> suggested changes to libxl_internal.h, and not any of the necessary
> implementation nor consequential changes.
Seems sane in the context of patch 2/3.
Ian.
> ---
> tools/libxl/libxl_internal.h | 52
> ++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 52 insertions(+), 0 deletions(-)
>
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 579188e..8eaf85a 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -165,6 +165,58 @@ _hidden char **libxl__xs_directory(libxl__gc *gc,
> xs_transaction_t t,
> char *path, unsigned int *nb);
> /* On error: returns NULL, sets errno (no logging) */
>
> +
> +/* Event handling functions provided by the libxl event core to the
> + * rest of libxl. Implemented in terms of _beforepoll/_afterpoll
> + * and/or the fd registration machinery, as provided by the
> + * application.
> + *
> + * Semantics are similar to those of the fd and timeout registration
> + * functions provided to libxl_osevent_register_hooks.
> + *
> + * Non-0 returns from libxl__ev_{modify,deregister} have already been
> + * logged by the core and should be returned unmodified to libxl's
> + * caller; NB that they may be valid libxl error codes but they may
> + * also be positive numbers supplied by the caller.
> + */
> +
> +typedef struct libxl__ev_fd libxl__ev_fd;
> +typedef void libxl__ev_fd_callback(libxl__gc *gc, libxl__ev_fd *ev,
> + int fd, short events, short revents,
> + void *for_callback);
> +
> +int libxl__ev_fd_register(libxl__gc*, libxl__ev_fd *ev_out,
> + int fd, short events,
> + libxl__ev_fd_callback*, void *for_callback);
> +int libxl__ev_fd_modify(libxl__gc*, libxl__ev_fd *ev,
> + short events);
> +void libxl__ev_fd_deregister(libxl__gc*, libxl__ev_fd *ev);
> +
> +typedef struct libxl__ev_time libxl__ev_time;
> +typedef void libxl__ev_time_callback(libxl__gc *gc, libxl__ev_fd *ev,
> + void *for_callback);
> +
> +int libxl__ev_time_register(libxl__gc*, libxl__ev_fd *ev_out,
> + int milliseconds,
> + libxl__ev_time_callback*, void *for_callback);
> +int libxl__ev_time_modify(libxl__gc*, libxl__ev_fd *ev,
> + int milliseconds);
> +void libxl__ev_time_deregister(libxl__gc*, libxl__ev_time *ev);
> +
> +
> +void libxl__event_occured(libxl__gc*, libxl_event *event);
> + /* Arranges to notify the application that the event has occurred.
> + * event should be suitable for passing to libxl_event_free. */
> +
> +void libxl__event_disaster(libxl__gc*, const char *msg, int errnoval,
> + libxl_event_type type /* may be 0 */);
> + /* See the "disaster" argument to libxl_event_register_callbacks.
> + * NB that this function may return and the caller isn't supposed to
> + * then crash, although it may fail (and henceforth leave things in
> + * a state where many or all calls fail).
> + */
> +
> +
> /* from xl_dom */
> _hidden int libxl__domain_is_hvm(libxl__gc *gc, uint32_t domid);
> _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|