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:
Daniel P. Berrange 2015-09-01 14:48:02 +01:00
parent 57cb38b383
commit 10817bf09d
36 changed files with 45 additions and 39 deletions

View File

@ -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

View File

@ -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/
#######################################################################

View File

@ -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"

View File

@ -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

View File

@ -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>

View File

@ -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"

View File

@ -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"

View File

@ -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,

View File

@ -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,

View File

@ -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)

View File

@ -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)

View File

@ -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 */

View File

@ -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>

View File

@ -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,

View File

@ -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"

View File

@ -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"

View File

@ -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,

View File

@ -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"

View File

@ -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 {

View File

@ -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"

View File

@ -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"

View File

@ -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
View File

@ -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>

View File

@ -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

View File

@ -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;

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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>

View File

@ -23,7 +23,7 @@
*/
#include "qemu-common.h"
#include "block/coroutine_int.h"
#include "qemu/coroutine_int.h"
typedef struct
{

View File

@ -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"

View File

@ -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"

View File

@ -11,7 +11,7 @@
*
*/
#include "block/coroutine.h"
#include "qemu/coroutine.h"
#include "qemu/timer.h"
#include "block/aio.h"

View File

@ -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,