aboutsummaryrefslogtreecommitdiff
path: root/async.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2015-10-30 12:06:28 +0800
committerStefan Hajnoczi <stefanha@redhat.com>2015-11-09 09:59:32 +0000
commit37fcee5d1154b7a03c13582e128bcc31ad43e954 (patch)
treef911442fcedb9116ad498daa0e9529eb936feb6f /async.c
parent5ceb9e39284b69d2e1b01da3cb1894ad4b2b4606 (diff)
downloadqemu-arm-37fcee5d1154b7a03c13582e128bcc31ad43e954.tar.gz
aio: Introduce aio_context_setup
This is the place to initialize platform specific bits of AioContext. Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1446177989-6702-3-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'async.c')
-rw-r--r--async.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/async.c b/async.c
index 9589e4bb7d..e106072a44 100644
--- a/async.c
+++ b/async.c
@@ -325,12 +325,18 @@ AioContext *aio_context_new(Error **errp)
{
int ret;
AioContext *ctx;
+ Error *local_err = NULL;
+
ctx = (AioContext *) g_source_new(&aio_source_funcs, sizeof(AioContext));
+ aio_context_setup(ctx, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ goto fail;
+ }
ret = event_notifier_init(&ctx->notifier, false);
if (ret < 0) {
- g_source_destroy(&ctx->source);
error_setg_errno(errp, -ret, "Failed to initialize event notifier");
- return NULL;
+ goto fail;
}
g_source_set_can_recurse(&ctx->source, true);
aio_set_event_notifier(ctx, &ctx->notifier,
@@ -345,6 +351,9 @@ AioContext *aio_context_new(Error **errp)
ctx->notify_dummy_bh = aio_bh_new(ctx, notify_dummy_bh, NULL);
return ctx;
+fail:
+ g_source_destroy(&ctx->source);
+ return NULL;
}
void aio_context_ref(AioContext *ctx)