2009/11/26 Daniel P. Berrange <berrange(a)redhat.com>:
With addition of events there will be alot of callbacks.
To avoid having to add many APIs to register callbacks,
provide them all at once in a big table
* src/qemu/qemu_driver.c: Pass in a callback table to QEMU
monitor code
* src/qemu/qemu_monitor.c, src/qemu/qemu_monitor.h Replace
the EOF and disk secret callbacks with a callback table
---
[...]
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0d9e315..7aa6ee5 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -59,21 +59,25 @@ struct _qemuMonitorMessage {
void *passwordOpaque;
};
-typedef void (*qemuMonitorEOFNotify)(qemuMonitorPtr mon,
- virDomainObjPtr vm,
- int withError);
-
-/* XXX we'd really like to avoid virCOnnectPtr here
- * It is required so the callback can find the active
- * secret driver. Need to change this to work like the
- * security drivers do, to avoid this
- */
-typedef int (*qemuMonitorDiskSecretLookup)(qemuMonitorPtr mon,
- virConnectPtr conn,
- virDomainObjPtr vm,
- const char *path,
- char **secret,
- size_t *secretLen);
+typedef struct _qemuMonitorCallbacks qemuMonitorCallbacks;
+typedef qemuMonitorCallbacks *qemuMonitorCallbacksPtr;
+struct _qemuMonitorCallbacks {
+ void (*eofNotify)(qemuMonitorPtr mon,
+ virDomainObjPtr vm,
+ int withError);
+ /* XXX we'd really like to avoid virCOnnectPtr here
s/virCOnnectPtr/virConnectPtr/
+ * It is required so the callback can find the active
+ * secret driver. Need to change this to work like the
+ * security drivers do, to avoid this
+ */
+ int (*diskSecretLookup)(qemuMonitorPtr mon,
+ virConnectPtr conn,
+ virDomainObjPtr vm,
+ const char *path,
+ char **secret,
+ size_t *secretLen);
+};
+
char *qemuMonitorEscapeArg(const char *in);
char *qemuMonitorEscapeShell(const char *in);
ACK.
Matthias