2011-04-24 03:40:22 +02:00
|
|
|
/*
|
2015-11-18 18:57:30 +01:00
|
|
|
* 9p backend
|
2011-04-24 03:40:22 +02:00
|
|
|
*
|
|
|
|
* Copyright IBM, Corp. 2010
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
|
|
|
|
* Venkateswararao Jujjuri(JV) <jvrao@linux.vnet.ibm.com>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-01-26 19:17:10 +01:00
|
|
|
#include "qemu/osdep.h"
|
2015-11-27 12:43:06 +01:00
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "block/thread-pool.h"
|
2015-09-01 15:48:02 +02:00
|
|
|
#include "qemu/coroutine.h"
|
2015-11-27 12:43:06 +01:00
|
|
|
#include "qemu/main-loop.h"
|
2015-11-18 18:57:30 +01:00
|
|
|
#include "coth.h"
|
2011-04-24 03:40:22 +02:00
|
|
|
|
2015-11-27 12:43:06 +01:00
|
|
|
/* Called from QEMU I/O thread. */
|
|
|
|
static void coroutine_enter_cb(void *opaque, int ret)
|
2011-04-24 03:40:22 +02:00
|
|
|
{
|
|
|
|
Coroutine *co = opaque;
|
2015-11-27 12:43:06 +01:00
|
|
|
qemu_coroutine_enter(co, NULL);
|
2011-04-24 03:40:22 +02:00
|
|
|
}
|
|
|
|
|
2015-11-27 12:43:06 +01:00
|
|
|
/* Called from worker thread. */
|
|
|
|
static int coroutine_enter_func(void *arg)
|
2011-04-24 03:40:22 +02:00
|
|
|
{
|
2015-11-27 12:43:06 +01:00
|
|
|
Coroutine *co = arg;
|
2011-04-24 03:40:22 +02:00
|
|
|
qemu_coroutine_enter(co, NULL);
|
2015-11-27 12:43:06 +01:00
|
|
|
return 0;
|
2011-04-24 03:40:22 +02:00
|
|
|
}
|
|
|
|
|
2015-11-27 12:43:06 +01:00
|
|
|
void co_run_in_worker_bh(void *opaque)
|
2011-04-24 03:40:22 +02:00
|
|
|
{
|
2015-11-27 12:43:06 +01:00
|
|
|
Coroutine *co = opaque;
|
2015-12-23 10:56:58 +01:00
|
|
|
thread_pool_submit_aio(aio_get_thread_pool(qemu_get_aio_context()),
|
2015-11-27 12:43:06 +01:00
|
|
|
coroutine_enter_func, co, coroutine_enter_cb, co);
|
2011-04-24 03:40:22 +02:00
|
|
|
}
|