coroutine: move into libqemuutil.a library
The coroutine files are currently referenced by the block-obj-y variable. The coroutine functionality though is already used by more than just the block code. eg migration code uses coroutine yield. In the future the I/O channel code will also use the coroutine yield functionality. Since the coroutine code is nicely self-contained it can be easily built as part of the libqemuutil.a library, making it widely available. The headers are also moved into include/qemu, instead of the include/block directory, since they are now part of the util codebase, and the impl was never in the block/ directory either. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
57cb38b383
commit
10817bf09d
@ -1193,6 +1193,13 @@ F: crypto/
|
||||
F: include/crypto/
|
||||
F: tests/test-crypto-*
|
||||
|
||||
Coroutines
|
||||
M: Stefan Hajnoczi <stefanha@redhat.com>
|
||||
M: Kevin Wolf <kwolf@redhat.com>
|
||||
F: util/*coroutine*
|
||||
F: include/qemu/coroutine*
|
||||
F: tests/test-coroutine.c
|
||||
|
||||
Usermode Emulation
|
||||
------------------
|
||||
Overall
|
||||
|
@ -15,10 +15,6 @@ block-obj-$(CONFIG_WIN32) += aio-win32.o
|
||||
block-obj-y += block/
|
||||
block-obj-y += qemu-io-cmds.o
|
||||
|
||||
block-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
|
||||
block-obj-y += qemu-coroutine-sleep.o
|
||||
block-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
|
||||
|
||||
block-obj-m = block/
|
||||
|
||||
#######################################################################
|
||||
|
2
block.c
2
block.c
@ -33,7 +33,7 @@
|
||||
#include "sysemu/block-backend.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/qapi.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qemu/timer.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define BLOCK_QCOW2_H
|
||||
|
||||
#include "crypto/cipher.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
//#define DEBUG_ALLOC
|
||||
//#define DEBUG_ALLOC2
|
||||
|
@ -53,7 +53,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qemu/module.h"
|
||||
#include "migration/migration.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
#if defined(CONFIG_UUID)
|
||||
#include <uuid/uuid.h>
|
||||
|
@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include "block/block_int.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/write-threshold.h"
|
||||
#include "qemu/notify.h"
|
||||
#include "qapi-event.h"
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include "block/block_int.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
#include "qapi/qmp/qjson.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qmp-commands.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi-event.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_readdir_r(V9fsPDU *pdu, V9fsFidState *fidp, struct dirent *dent,
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_st_gen(V9fsPDU *pdu, V9fsPath *path, mode_t st_mode,
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
static ssize_t __readlink(V9fsState *s, V9fsPath *path, V9fsString *buf)
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
int v9fs_co_llistxattr(V9fsPDU *pdu, V9fsPath *path, void *value, size_t size)
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "fsdev/qemu-fsdev.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p-coth.h"
|
||||
|
||||
/* v9fs glib thread pool */
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define _QEMU_VIRTIO_9P_COTH_H
|
||||
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "virtio-9p.h"
|
||||
#include <glib.h>
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "fsdev/file-op-9p.h"
|
||||
#include "fsdev/virtio-9p-marshal.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
enum {
|
||||
P9_TLERROR = 6,
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "block/aio.h"
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/option.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "block/accounting.h"
|
||||
#include "qapi/qmp/qobject.h"
|
||||
#include "qapi-types.h"
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include "block/block.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qapi-types.h"
|
||||
#include "qemu/hbitmap.h"
|
||||
|
@ -26,7 +26,7 @@
|
||||
#define QEMU_COROUTINE_INT_H
|
||||
|
||||
#include "qemu/queue.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
typedef enum {
|
||||
COROUTINE_YIELD = 1,
|
@ -29,7 +29,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/qemu-file-internal.h"
|
||||
|
@ -22,7 +22,7 @@
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "migration/qemu-file.h"
|
||||
|
||||
typedef struct QEMUFileStdio {
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/qemu-file-internal.h"
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/qemu-file.h"
|
||||
#include "migration/qemu-file-internal.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "qemu/bitmap.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
2
nbd.c
2
nbd.c
@ -19,7 +19,7 @@
|
||||
#include "block/nbd.h"
|
||||
#include "sysemu/block-backend.h"
|
||||
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
@ -12,8 +12,8 @@
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include "block/coroutine.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
/*
|
||||
* Check that qemu_in_coroutine() works
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include "qemu-common.h"
|
||||
#include "migration/migration.h"
|
||||
#include "migration/vmstate.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
|
||||
static char temp_file[] = "/tmp/vmst.test.XXXXXX";
|
||||
static int temp_fd;
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/osdep.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "trace.h"
|
||||
#include "block/thread-pool.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
@ -18,3 +18,6 @@ util-obj-y += getauxval.o
|
||||
util-obj-y += readline.o
|
||||
util-obj-y += rfifolock.o
|
||||
util-obj-y += rcu.o
|
||||
util-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
|
||||
util-obj-y += qemu-coroutine-sleep.o
|
||||
util-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
#include <glib.h>
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
typedef struct {
|
||||
Coroutine base;
|
@ -31,7 +31,7 @@
|
||||
#include <pthread.h>
|
||||
#include <signal.h>
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
typedef struct {
|
||||
Coroutine base;
|
@ -27,7 +27,7 @@
|
||||
#include <stdint.h>
|
||||
#include <ucontext.h>
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
#ifdef CONFIG_VALGRIND_H
|
||||
#include <valgrind/valgrind.h>
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
typedef struct
|
||||
{
|
@ -24,7 +24,7 @@
|
||||
*/
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/sockets.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/iov.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
@ -23,8 +23,8 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "trace.h"
|
||||
|
@ -11,7 +11,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "block/coroutine.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "block/aio.h"
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/atomic.h"
|
||||
#include "block/coroutine.h"
|
||||
#include "block/coroutine_int.h"
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/coroutine_int.h"
|
||||
|
||||
enum {
|
||||
POOL_BATCH_SIZE = 64,
|
Loading…
Reference in New Issue
Block a user