From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40772) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qkD-0002Wj-Nw for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:45:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V7qk7-0005hj-GE for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:44:57 -0400 Received: from mail6.webfaction.com ([74.55.86.74]:50408 helo=smtp.webfaction.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V7qk7-0005h8-86 for qemu-devel@nongnu.org; Fri, 09 Aug 2013 13:44:51 -0400 From: Charlie Shepherd Date: Fri, 9 Aug 2013 19:43:52 +0200 Message-Id: <1376070245-22557-2-git-send-email-charlie@ctshepherd.com> In-Reply-To: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com> References: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com> Subject: [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@gmail.com, gabriel@kerneis.info, Charlie Shepherd , pbonzini@redhat.com While it only really makes sense to call qemu_coroutine_self() in a coroutine context, some coroutine internals need to call it from functions not annotated as coroutine_fn, so add an annotated wrapper and rename the implementation versions to qemu_coroutine_self_int. Signed-off-by: Charlie Shepherd --- coroutine-gthread.c | 2 +- coroutine-sigaltstack.c | 2 +- coroutine-ucontext.c | 2 +- coroutine-win32.c | 2 +- include/block/coroutine_int.h | 1 + qemu-coroutine.c | 7 ++++++- 6 files changed, 11 insertions(+), 5 deletions(-) diff --git a/coroutine-gthread.c b/coroutine-gthread.c index d3e5b99..a913aeb 100644 --- a/coroutine-gthread.c +++ b/coroutine-gthread.c @@ -194,7 +194,7 @@ CoroutineAction qemu_coroutine_switch(Coroutine *from_, return from->action; } -Coroutine *qemu_coroutine_self(void) +Coroutine *qemu_coroutine_self_int(void) { CoroutineGThread *co = get_coroutine_key(); if (!co) { diff --git a/coroutine-sigaltstack.c b/coroutine-sigaltstack.c index 3de0bb3..0556539 100644 --- a/coroutine-sigaltstack.c +++ b/coroutine-sigaltstack.c @@ -277,7 +277,7 @@ CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_, return ret; } -Coroutine *qemu_coroutine_self(void) +Coroutine *qemu_coroutine_self_int(void) { CoroutineThreadState *s = coroutine_get_thread_state(); diff --git a/coroutine-ucontext.c b/coroutine-ucontext.c index 4bf2cde..27d1b79 100644 --- a/coroutine-ucontext.c +++ b/coroutine-ucontext.c @@ -210,7 +210,7 @@ CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_, return ret; } -Coroutine *qemu_coroutine_self(void) +Coroutine *qemu_coroutine_self_int(void) { CoroutineThreadState *s = coroutine_get_thread_state(); diff --git a/coroutine-win32.c b/coroutine-win32.c index edc1f72..3f1f79b 100644 --- a/coroutine-win32.c +++ b/coroutine-win32.c @@ -77,7 +77,7 @@ void qemu_coroutine_delete(Coroutine *co_) g_free(co); } -Coroutine *qemu_coroutine_self(void) +Coroutine *qemu_coroutine_self_int(void) { if (!current) { current = &leader.base; diff --git a/include/block/coroutine_int.h b/include/block/coroutine_int.h index f133d65..f6191ad 100644 --- a/include/block/coroutine_int.h +++ b/include/block/coroutine_int.h @@ -48,6 +48,7 @@ Coroutine *qemu_coroutine_new(void); void qemu_coroutine_delete(Coroutine *co); CoroutineAction qemu_coroutine_switch(Coroutine *from, Coroutine *to, CoroutineAction action); +Coroutine *qemu_coroutine_self_int(void); void coroutine_fn qemu_co_queue_run_restart(Coroutine *co); #endif diff --git a/qemu-coroutine.c b/qemu-coroutine.c index 423430d..b147f87 100644 --- a/qemu-coroutine.c +++ b/qemu-coroutine.c @@ -104,7 +104,7 @@ static void coroutine_swap(Coroutine *from, Coroutine *to) void qemu_coroutine_enter(Coroutine *co, void *opaque) { - Coroutine *self = qemu_coroutine_self(); + Coroutine *self = qemu_coroutine_self_int(); trace_qemu_coroutine_enter(self, co, opaque); @@ -133,3 +133,8 @@ void coroutine_fn qemu_coroutine_yield(void) self->caller = NULL; coroutine_swap(self, to); } + +coroutine_fn Coroutine *qemu_coroutine_self(void) +{ + return qemu_coroutine_self_int(); +} -- 1.8.3.2