summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-03-25 23:26:56 +0100
committerGerd Hoffmann <kraxel@redhat.com>2010-05-19 11:22:06 +0200
commit4c67874a6db9f985a55e50ffcab0e68f36a8089e (patch)
tree24f28cb794b7c3c87d0e9d2d909e7d345bc22900 /server
parent91f747ea1dfb7b7984ac0783c2f2c867ae1c6c0a (diff)
downloadspice-4c67874a6db9f985a55e50ffcab0e68f36a8089e.tar.gz
spice-4c67874a6db9f985a55e50ffcab0e68f36a8089e.tar.xz
spice-4c67874a6db9f985a55e50ffcab0e68f36a8089e.zip
introduce new watch api
This patch adds a new file handle watch interface to libspice, featuring three callbacks: (1) watch_add() -- create a new file watch. (2) watch_update_mask() -- change event mask. spice frequently enables/disables write notification. (3) watch_remove() -- remove a file watch. libspice users must implement these functions to allow libspice monitoring file handles. The old interface (set_file_handlers) doesn't explicitly express the lifecycle of a watch. Also it maps 1:1 to a qemu-internal function. In case the way qemu implements file watches changes (someone sayed QemuIONotifier?) this will break horribly. Beside that it is very bad style. Follwing patches will switch over users one by one to the new interface and finally zap the old one.
Diffstat (limited to 'server')
-rw-r--r--server/vd_interface.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/vd_interface.h b/server/vd_interface.h
index 04be96cb..a370431a 100644
--- a/server/vd_interface.h
+++ b/server/vd_interface.h
@@ -68,6 +68,12 @@ typedef void (*vd_interface_change_notifier_t)(void *opaque, VDInterface *interf
VDInterfaceChangeType change);
typedef void (*timer_callback_t)(void *opaque);
+#define SPICE_WATCH_EVENT_READ (1 << 0)
+#define SPICE_WATCH_EVENT_WRITE (1 << 1)
+
+typedef struct SpiceWatch SpiceWatch;
+typedef void (*SpiceWatchFunc)(int fd, int event, void *opaque);
+
struct CoreInterface {
VDInterface base;
@@ -80,6 +86,11 @@ struct CoreInterface {
void (*on_read)(void *),
void (*on_write)(void *),
void *opaque);
+
+ SpiceWatch *(*watch_add)(int fd, int event_mask, SpiceWatchFunc func, void *opaque);
+ void (*watch_update_mask)(SpiceWatch *watch, int event_mask);
+ void (*watch_remove)(SpiceWatch *watch);
+
};
#define VD_INTERFACE_QXL "qxl"