summaryrefslogtreecommitdiff
path: root/qemu-aio.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-24 14:57:41 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2012-10-30 09:30:53 +0100
commite3713e001fb7d4d82f6de82800c1463e758e4289 (patch)
tree6fda705e8c592e257d260fd37c6cbbac77d21f5a /qemu-aio.h
parentf42b22077bc63a482d7a8755b54e33475ab78541 (diff)
downloadqemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.gz
qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.bz2
qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.zip
aio: make AioContexts GSources
This lets AioContexts be used (optionally) with a glib main loop. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qemu-aio.h')
-rw-r--r--qemu-aio.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/qemu-aio.h b/qemu-aio.h
index ac248962fe..aedf66cfa1 100644
--- a/qemu-aio.h
+++ b/qemu-aio.h
@@ -44,6 +44,8 @@ typedef void QEMUBHFunc(void *opaque);
typedef void IOHandler(void *opaque);
typedef struct AioContext {
+ GSource source;
+
/* The list of registered AIO handlers */
QLIST_HEAD(, AioHandler) aio_handlers;
@@ -75,6 +77,22 @@ typedef int (AioFlushEventNotifierHandler)(EventNotifier *e);
AioContext *aio_context_new(void);
/**
+ * aio_context_ref:
+ * @ctx: The AioContext to operate on.
+ *
+ * Add a reference to an AioContext.
+ */
+void aio_context_ref(AioContext *ctx);
+
+/**
+ * aio_context_unref:
+ * @ctx: The AioContext to operate on.
+ *
+ * Drop a reference to an AioContext.
+ */
+void aio_context_unref(AioContext *ctx);
+
+/**
* aio_bh_new: Allocate a new bottom half structure.
*
* Bottom halves are lightweight callbacks whose invocation is guaranteed
@@ -188,6 +206,11 @@ void aio_set_event_notifier(AioContext *ctx,
EventNotifierHandler *io_read,
AioFlushEventNotifierHandler *io_flush);
+/* Return a GSource that lets the main loop poll the file descriptors attached
+ * to this AioContext.
+ */
+GSource *aio_get_g_source(AioContext *ctx);
+
/* Functions to operate on the main QEMU AioContext. */
void qemu_aio_flush(void);