diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-09-24 14:57:41 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-30 09:30:53 +0100 |
commit | e3713e001fb7d4d82f6de82800c1463e758e4289 (patch) | |
tree | 6fda705e8c592e257d260fd37c6cbbac77d21f5a /qemu-aio.h | |
parent | f42b22077bc63a482d7a8755b54e33475ab78541 (diff) | |
download | qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.zip qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.gz qemu-e3713e001fb7d4d82f6de82800c1463e758e4289.tar.bz2 |
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.h | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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); |