From patchwork Wed Mar 6 15:45:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 225540 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 416462C038D for ; Thu, 7 Mar 2013 02:48:38 +1100 (EST) Received: from localhost ([::1]:56825 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDGa4-0007yN-H3 for incoming@patchwork.ozlabs.org; Wed, 06 Mar 2013 10:48:36 -0500 Received: from eggs.gnu.org ([208.118.235.92]:44414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDGXW-0004Hf-07 for qemu-devel@nongnu.org; Wed, 06 Mar 2013 10:46:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDGXR-0007KT-Ky for qemu-devel@nongnu.org; Wed, 06 Mar 2013 10:45:57 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDGXR-0007KJ-89 for qemu-devel@nongnu.org; Wed, 06 Mar 2013 10:45:53 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r26Fjqpl024898 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 6 Mar 2013 10:45:52 -0500 Received: from localhost (dhcp-64-10.muc.redhat.com [10.32.64.10]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r26FjpUk006003; Wed, 6 Mar 2013 10:45:52 -0500 From: Stefan Hajnoczi To: Date: Wed, 6 Mar 2013 16:45:34 +0100 Message-Id: <1362584735-30911-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1362584735-30911-1-git-send-email-stefanha@redhat.com> References: <1362584735-30911-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Paolo Bonzini , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 4/5] main-loop: add qemu_get_aio_context() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It is very useful to get the main loop AioContext, which is a static variable in main-loop.c. I'm not sure whether qemu_get_aio_context() will be necessary in the future once devices focus on using their own AioContext instead of the main loop AioContext, but for now it allows us to refactor code to support multiple AioContext while actually passing the main loop AioContext. Signed-off-by: Stefan Hajnoczi Reviewed-by: Paolo Bonzini --- include/qemu/main-loop.h | 5 +++++ main-loop.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 0995288..6f0200a 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -82,6 +82,11 @@ int qemu_init_main_loop(void); int main_loop_wait(int nonblocking); /** + * qemu_get_aio_context: Return the main loop's AioContext + */ +AioContext *qemu_get_aio_context(void); + +/** * qemu_notify_event: Force processing of pending events. * * Similar to signaling a condition variable, qemu_notify_event forces diff --git a/main-loop.c b/main-loop.c index 8c9b58c..eb80ff3 100644 --- a/main-loop.c +++ b/main-loop.c @@ -109,6 +109,11 @@ static int qemu_signal_init(void) static AioContext *qemu_aio_context; +AioContext *qemu_get_aio_context(void) +{ + return qemu_aio_context; +} + void qemu_notify_event(void) { if (!qemu_aio_context) {