Since we virEventRegisterDefaultImpl is now a public API, callers need
a way to invoke the default registered Handle and Timeout functions. We
already have general functions for these internally, so promote
them to the public API.
Signed-off-by: Cole Robinson <crobinso(a)redhat.com>
---
daemon/libvirtd.c | 1 -
daemon/mdns.c | 1 -
python/generator.py | 8 ++++
src/conf/domain_event.c | 1 -
src/conf/domain_event.h | 1 -
src/fdstream.c | 1 -
src/libvirt_private.syms | 9 ----
src/libvirt_public.syms | 6 +++
src/libxl/libxl_driver.c | 1 -
src/lxc/lxc_driver.c | 1 -
src/network/bridge_driver.c | 1 -
src/node_device/node_device_hal.c | 1 -
src/node_device/node_device_udev.c | 1 -
src/openvz/openvz_driver.c | 1 -
src/qemu/qemu_domain.c | 1 -
src/qemu/qemu_driver.c | 1 -
src/qemu/qemu_monitor.c | 1 -
src/remote/remote_driver.c | 1 -
src/test/test_driver.c | 1 -
src/uml/uml_driver.c | 1 -
src/util/event.c | 56 +++++++++++++++++++++++++++
src/util/event.h | 73 ------------------------------------
src/util/util.c | 1 -
src/vbox/vbox_tmpl.c | 1 -
src/xen/xen_inotify.c | 1 -
src/xen/xs_internal.c | 1 -
tools/console.c | 1 -
27 files changed, 70 insertions(+), 104 deletions(-)
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index bcaa37b..5f291ec 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -62,7 +62,6 @@
#include "uuid.h"
#include "remote_driver.h"
#include "conf.h"
-#include "event.h"
#include "event_poll.h"
#include "memory.h"
#include "stream.h"
diff --git a/daemon/mdns.c b/daemon/mdns.c
index 03695fd..ca4a433 100644
--- a/daemon/mdns.c
+++ b/daemon/mdns.c
@@ -39,7 +39,6 @@
#include "libvirtd.h"
#include "mdns.h"
-#include "event.h"
#include "event_poll.h"
#include "memory.h"
diff --git a/python/generator.py b/python/generator.py
index b73dc57..745828b 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -396,6 +396,14 @@ skip_function = (
'virStreamRecv', # overridden in libvirt-override-virStream.py
'virStreamSend', # overridden in libvirt-override-virStream.py
+ # XXX: Skip for now, some work needed to handle Timeout/Handle callbacks
+ 'virEventAddHandle',
+ 'virEventRemoveHandle',
+ 'virEventUpdateHandle',
+ 'virEventAddTimeout',
+ 'virEventRemoveTimeout',
+ 'virEventUpdateTimeout',
+
# 'Ref' functions have no use for bindings users.
"virConnectRef",
"virDomainRef",
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index a1f1b0f..785e9e4 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -24,7 +24,6 @@
#include <config.h>
#include "domain_event.h"
-#include "event.h"
#include "logging.h"
#include "datatypes.h"
#include "memory.h"
diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
index a80868b..ea481b3 100644
--- a/src/conf/domain_event.h
+++ b/src/conf/domain_event.h
@@ -25,7 +25,6 @@
#ifndef __DOMAIN_EVENT_H__
# define __DOMAIN_EVENT_H__
-# include "event.h"
# include "domain_conf.h"
typedef struct _virDomainEventCallback virDomainEventCallback;
diff --git a/src/fdstream.c b/src/fdstream.c
index e19694f..c1ad787 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -38,7 +38,6 @@
#include "datatypes.h"
#include "logging.h"
#include "memory.h"
-#include "event.h"
#include "util.h"
#include "files.h"
#include "configmake.h"
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 5202da3..e12fc04 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -452,15 +452,6 @@ ebtablesContextNew;
ebtablesRemoveForwardAllowIn;
-# event.h
-virEventAddHandle;
-virEventAddTimeout;
-virEventRemoveHandle;
-virEventRemoveTimeout;
-virEventUpdateHandle;
-virEventUpdateTimeout;
-
-
# event_poll.h
virEventPollToNativeEvents;
virEventPollFromNativeEvents;
diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms
index f7a6df6..67c7a82 100644
--- a/src/libvirt_public.syms
+++ b/src/libvirt_public.syms
@@ -458,6 +458,12 @@ LIBVIRT_0.9.3 {
virDomainGetBlockPullInfo;
virDomainPinVcpuFlags;
virDomainSendKey;
+ virEventAddHandle;
+ virEventAddTimeout;
+ virEventRemoveHandle;
+ virEventRemoveTimeout;
+ virEventUpdateHandle;
+ virEventUpdateTimeout;
virNodeGetCPUStats;
virNodeGetMemoryStats;
} LIBVIRT_0.9.2;
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 86ed850..5a5951f 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -38,7 +38,6 @@
#include "datatypes.h"
#include "files.h"
#include "memory.h"
-#include "event.h"
#include "uuid.h"
#include "command.h"
#include "libxl_driver.h"
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 3b0d2a6..d0f7158 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -45,7 +45,6 @@
#include "util.h"
#include "bridge.h"
#include "veth.h"
-#include "event.h"
#include "nodeinfo.h"
#include "uuid.h"
#include "stats_linux.h"
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 5e4b4d9..4b94959 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -48,7 +48,6 @@
#include "bridge_driver.h"
#include "network_conf.h"
#include "driver.h"
-#include "event.h"
#include "buf.h"
#include "util.h"
#include "command.h"
diff --git a/src/node_device/node_device_hal.c b/src/node_device/node_device_hal.c
index a90e777..27fedc9 100644
--- a/src/node_device/node_device_hal.c
+++ b/src/node_device/node_device_hal.c
@@ -32,7 +32,6 @@
#include "virterror_internal.h"
#include "driver.h"
#include "datatypes.h"
-#include "event.h"
#include "memory.h"
#include "uuid.h"
#include "logging.h"
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 8b9694e..2d4e078 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -37,7 +37,6 @@
#include "uuid.h"
#include "util.h"
#include "buf.h"
-#include "event.h"
#define VIR_FROM_THIS VIR_FROM_NODEDEV
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 645e426..c13f346 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -49,7 +49,6 @@
#include "virterror_internal.h"
#include "datatypes.h"
#include "openvz_driver.h"
-#include "event.h"
#include "buf.h"
#include "util.h"
#include "openvz_conf.h"
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 5f18ad3..f123c92 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -30,7 +30,6 @@
#include "logging.h"
#include "virterror_internal.h"
#include "c-ctype.h"
-#include "event.h"
#include "cpu/cpu.h"
#include "ignore-value.h"
#include "uuid.h"
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 853c84c..6c739e4 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -62,7 +62,6 @@
#include "virterror_internal.h"
#include "logging.h"
#include "datatypes.h"
-#include "event.h"
#include "buf.h"
#include "util.h"
#include "nodeinfo.h"
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 1428921..89a3f64 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -32,7 +32,6 @@
#include "qemu_monitor_text.h"
#include "qemu_monitor_json.h"
#include "qemu_conf.h"
-#include "event.h"
#include "virterror_internal.h"
#include "memory.h"
#include "logging.h"
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index f4b43e0..3a88aea 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -80,7 +80,6 @@
#include "qemu_protocol.h"
#include "memory.h"
#include "util.h"
-#include "event.h"
#include "ignore-value.h"
#include "files.h"
#include "command.h"
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index f522143..6c8b9cf 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -44,7 +44,6 @@
#include "interface_conf.h"
#include "domain_conf.h"
#include "domain_event.h"
-#include "event.h"
#include "storage_conf.h"
#include "node_device_conf.h"
#include "xml.h"
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 1d26422..e557fe8 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -47,7 +47,6 @@
#include "uml_driver.h"
#include "uml_conf.h"
-#include "event.h"
#include "buf.h"
#include "util.h"
#include "nodeinfo.h"
diff --git a/src/util/event.c b/src/util/event.c
index 11f025b..4108221 100644
--- a/src/util/event.c
+++ b/src/util/event.c
@@ -37,6 +37,16 @@ static virEventAddTimeoutFunc addTimeoutImpl = NULL;
static virEventUpdateTimeoutFunc updateTimeoutImpl = NULL;
static virEventRemoveTimeoutFunc removeTimeoutImpl = NULL;
+/**
+ * virEventAddHandle: register a callback for monitoring file handle events
+ *
+ * @fd: file handle to monitor for events
+ * @events: bitset of events to watch from virEventHandleType constants
+ * @cb: callback to invoke when an event occurs
+ * @opaque: user data to pass to callback
+ *
+ * returns -1 if the file handle cannot be registered, 0 upon success
+ */
int virEventAddHandle(int fd,
int events,
virEventHandleCallback cb,
@@ -48,10 +58,25 @@ int virEventAddHandle(int fd,
return addHandleImpl(fd, events, cb, opaque, ff);
}
+/**
+ * virEventUpdateHandle: change event set for a monitored file handle
+ *
+ * @watch: watch whose file handle to update
+ * @events: bitset of events to watch from virEventHandleType constants
+ *
+ * Will not fail if fd exists
+ */
void virEventUpdateHandle(int watch, int events) {
updateHandleImpl(watch, events);
}
+/**
+ * virEventRemoveHandle: unregister a callback from a file handle
+ *
+ * @watch: watch whose file handle to remove
+ *
+ * returns -1 if the file handle was not registered, 0 upon success
+ */
int virEventRemoveHandle(int watch) {
if (!removeHandleImpl)
return -1;
@@ -59,6 +84,19 @@ int virEventRemoveHandle(int watch) {
return removeHandleImpl(watch);
}
+/**
+ * virEventAddTimeout: register a callback for a timer event
+ *
+ * @frequency: time between events in milliseconds
+ * @cb: callback to invoke when an event occurs
+ * @opaque: user data to pass to callback
+ *
+ * Setting frequency to -1 will disable the timer. Setting the frequency
+ * to zero will cause it to fire on every event loop iteration.
+ *
+ * returns -1 if the timer cannot be registered, a positive
+ * integer timer id upon success
+ */
int virEventAddTimeout(int timeout,
virEventTimeoutCallback cb,
void *opaque,
@@ -69,10 +107,28 @@ int virEventAddTimeout(int timeout,
return addTimeoutImpl(timeout, cb, opaque, ff);
}
+/**
+ * virEventUpdateTimeoutImpl: change frequency for a timer
+ *
+ * @timer: timer id to change
+ * @frequency: time between events in milliseconds
+ *
+ * Setting frequency to -1 will disable the timer. Setting the frequency
+ * to zero will cause it to fire on every event loop iteration.
+ *
+ * Will not fail if timer exists
+ */
void virEventUpdateTimeout(int timer, int timeout) {
updateTimeoutImpl(timer, timeout);
}
+/**
+ * virEventRemoveTimeout: unregister a callback for a timer
+ *
+ * @timer: the timer id to remove
+ *
+ * returns -1 if the timer was not registered, 0 upon success
+ */
int virEventRemoveTimeout(int timer) {
if (!removeTimeoutImpl)
return -1;
diff --git a/src/util/event.h b/src/util/event.h
index 68b06c6..2fef314 100644
--- a/src/util/event.h
+++ b/src/util/event.h
@@ -24,78 +24,5 @@
#ifndef __VIR_EVENT_H__
# define __VIR_EVENT_H__
# include "internal.h"
-/**
- * virEventAddHandle: register a callback for monitoring file handle events
- *
- * @fd: file handle to monitor for events
- * @events: bitset of events to watch from virEventHandleType constants
- * @cb: callback to invoke when an event occurs
- * @opaque: user data to pass to callback
- *
- * returns -1 if the file handle cannot be registered, 0 upon success
- */
-int virEventAddHandle(int fd, int events,
- virEventHandleCallback cb,
- void *opaque,
- virFreeCallback ff);
-
-/**
- * virEventUpdateHandle: change event set for a monitored file handle
- *
- * @watch: watch whose file handle to update
- * @events: bitset of events to watch from virEventHandleType constants
- *
- * Will not fail if fd exists
- */
-void virEventUpdateHandle(int watch, int events);
-
-/**
- * virEventRemoveHandle: unregister a callback from a file handle
- *
- * @watch: watch whose file handle to remove
- *
- * returns -1 if the file handle was not registered, 0 upon success
- */
-int virEventRemoveHandle(int watch);
-
-/**
- * virEventAddTimeout: register a callback for a timer event
- *
- * @frequency: time between events in milliseconds
- * @cb: callback to invoke when an event occurs
- * @opaque: user data to pass to callback
- *
- * Setting frequency to -1 will disable the timer. Setting the frequency
- * to zero will cause it to fire on every event loop iteration.
- *
- * returns -1 if the timer cannot be registered, a positive
- * integer timer id upon success
- */
-int virEventAddTimeout(int frequency,
- virEventTimeoutCallback cb,
- void *opaque,
- virFreeCallback ff);
-
-/**
- * virEventUpdateTimeoutImpl: change frequency for a timer
- *
- * @timer: timer id to change
- * @frequency: time between events in milliseconds
- *
- * Setting frequency to -1 will disable the timer. Setting the frequency
- * to zero will cause it to fire on every event loop iteration.
- *
- * Will not fail if timer exists
- */
-void virEventUpdateTimeout(int timer, int frequency);
-
-/**
- * virEventRemoveTimeout: unregister a callback for a timer
- *
- * @timer: the timer id to remove
- *
- * returns -1 if the timer was not registered, 0 upon success
- */
-int virEventRemoveTimeout(int timer);
#endif /* __VIR_EVENT_H__ */
diff --git a/src/util/util.c b/src/util/util.c
index df4dfac..9d29fec 100644
--- a/src/util/util.c
+++ b/src/util/util.c
@@ -68,7 +68,6 @@
#include "dirname.h"
#include "virterror_internal.h"
#include "logging.h"
-#include "event.h"
#include "buf.h"
#include "util.h"
#include "memory.h"
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index f2233a5..7fd1200 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -49,7 +49,6 @@
#include "storage_conf.h"
#include "storage_file.h"
#include "uuid.h"
-#include "event.h"
#include "memory.h"
#include "nodeinfo.h"
#include "logging.h"
diff --git a/src/xen/xen_inotify.c b/src/xen/xen_inotify.c
index 71bb6be..24b4376 100644
--- a/src/xen/xen_inotify.c
+++ b/src/xen/xen_inotify.c
@@ -31,7 +31,6 @@
#include "datatypes.h"
#include "driver.h"
#include "memory.h"
-#include "event.h"
#include "xen_driver.h"
#include "conf.h"
#include "domain_conf.h"
diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
index b684d3d..04bf93a 100644
--- a/src/xen/xs_internal.c
+++ b/src/xen/xs_internal.c
@@ -29,7 +29,6 @@
#include "datatypes.h"
#include "driver.h"
#include "memory.h"
-#include "event.h"
#include "logging.h"
#include "uuid.h"
#include "xen_driver.h"
diff --git a/tools/console.c b/tools/console.c
index 0428239..7ca95a3 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -43,7 +43,6 @@
# include "memory.h"
# include "virterror_internal.h"
-# include "event.h"
/* ie Ctrl-] as per telnet */
# define CTRL_CLOSE_BRACKET '\35'
--
1.7.4.4