All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Jackson <ian.jackson@eu.citrix.com>
To: xen-devel@lists.xensource.com
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Subject: [PATCH 3/3] RFC: libxl: internal API for event handling
Date: Tue, 12 Jul 2011 19:37:03 +0100	[thread overview]
Message-ID: <1310495823-27077-4-git-send-email-ian.jackson@eu.citrix.com> (raw)
In-Reply-To: <1310495823-27077-3-git-send-email-ian.jackson@eu.citrix.com>

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.
---
 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);
-- 
1.5.6.5

  reply	other threads:[~2011-07-12 18:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-12 18:37 [RFC 0/3] libxl event handling Ian Jackson
2011-07-12 18:37 ` [PATCH 1/3] RFC: libxl: API changes re domain type (and keyed union semantics) Ian Jackson
2011-07-12 18:37   ` [PATCH 2/3] RFC: libxl: API changes re event handling Ian Jackson
2011-07-12 18:37     ` Ian Jackson [this message]
2011-07-13 10:22       ` [PATCH 3/3] RFC: libxl: internal API for " Ian Campbell
2011-07-13 10:21     ` [PATCH 2/3] RFC: libxl: API changes re " Ian Campbell
2011-07-13 14:03       ` Ian Jackson
2011-07-13 16:08         ` Ian Campbell
2011-07-13 16:17           ` Ian Jackson
2011-07-13 16:33             ` Ian Campbell
2011-07-13 17:04               ` Ian Jackson
2011-07-13  9:19   ` [PATCH 1/3] RFC: libxl: API changes re domain type (and keyed union semantics) Ian Campbell
2011-07-15 12:45   ` Ian Campbell
2011-07-15 13:13     ` Ian Jackson
2011-07-18  9:06       ` [PATCH 0 of 6] libxl: IDL improvements Ian Campbell
2011-07-18  9:06         ` [PATCH 1 of 6] libxl: Give the HVM domain type the name "HVM" Ian Campbell
2011-07-18  9:06         ` [PATCH 2 of 6] libxl: replace libxl__domain_is_hvm with libxl__domain_type Ian Campbell
2011-07-18  9:06         ` [PATCH 3 of 6] libxl: specify HVM vs PV in build_info using libxl_domain_type enum Ian Campbell
2011-07-18  9:06         ` [PATCH 4 of 6] libxl: specify HVM vs PV in create_info " Ian Campbell
2011-07-18  9:06         ` [PATCH 5 of 6] libxl: use libxl_domain_type enum with libxl__domain_suspend_common Ian Campbell
2011-07-18  9:06         ` [PATCH 6 of 6] libxl: Keyed unions key off an enum instead of an arbitrary expression Ian Campbell
2011-07-18 13:57       ` [PATCH 0 of 6 V2] libxl: IDL improvements Ian Campbell
2011-07-18 13:57         ` [PATCH 1 of 6 V2] libxl: Give the HVM domain type the name "HVM" Ian Campbell
2011-07-18 14:56           ` Wei LIU
2011-07-18 15:20             ` Ian Jackson
2011-07-18 13:57         ` [PATCH 2 of 6 V2] libxl: replace libxl__domain_is_hvm with libxl__domain_type Ian Campbell
2011-07-18 13:57         ` [PATCH 3 of 6 V2] libxl: specify HVM vs PV in build_info using libxl_domain_type enum Ian Campbell
2011-07-18 13:57         ` [PATCH 4 of 6 V2] libxl: specify HVM vs PV in create_info " Ian Campbell
2011-07-18 13:57         ` [PATCH 5 of 6 V2] libxl: use libxl_domain_type enum with libxl__domain_suspend_common Ian Campbell
2011-07-18 13:57         ` [PATCH 6 of 6 V2] libxl: Keyed unions key off an enum instead of an arbitrary expression Ian Campbell
2011-07-18 16:11         ` [PATCH 0 of 6 V2] libxl: IDL improvements Ian Jackson

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=1310495823-27077-4-git-send-email-ian.jackson@eu.citrix.com \
    --to=ian.jackson@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.