From: "Daniel P. Berrange" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 6/7] coroutine: move into libqemuutil.a library
Date: Tue, 20 Oct 2015 16:34:01 +0100 [thread overview]
Message-ID: <1445355242-4397-7-git-send-email-berrange@redhat.com> (raw)
In-Reply-To: <1445355242-4397-1-git-send-email-berrange@redhat.com>
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>
---
MAINTAINERS | 7 +++++++
Makefile.objs | 4 ----
block.c | 2 +-
block/qcow2.h | 2 +-
block/vdi.c | 2 +-
block/write-threshold.c | 2 +-
blockjob.c | 2 +-
hw/9pfs/codir.c | 2 +-
hw/9pfs/cofile.c | 2 +-
hw/9pfs/cofs.c | 2 +-
hw/9pfs/coxattr.c | 2 +-
hw/9pfs/virtio-9p-coth.c | 2 +-
hw/9pfs/virtio-9p-coth.h | 2 +-
hw/9pfs/virtio-9p.h | 2 +-
include/block/block.h | 2 +-
include/block/block_int.h | 2 +-
include/{block => qemu}/coroutine.h | 0
include/{block => qemu}/coroutine_int.h | 2 +-
migration/qemu-file-buf.c | 2 +-
migration/qemu-file-stdio.c | 2 +-
migration/qemu-file-unix.c | 2 +-
migration/qemu-file.c | 2 +-
migration/rdma.c | 2 +-
nbd.c | 2 +-
tests/test-coroutine.c | 4 ++--
tests/test-vmstate.c | 2 +-
thread-pool.c | 2 +-
util/Makefile.objs | 3 +++
coroutine-gthread.c => util/coroutine-gthread.c | 2 +-
coroutine-sigaltstack.c => util/coroutine-sigaltstack.c | 2 +-
coroutine-ucontext.c => util/coroutine-ucontext.c | 2 +-
coroutine-win32.c => util/coroutine-win32.c | 2 +-
qemu-coroutine-io.c => util/qemu-coroutine-io.c | 2 +-
qemu-coroutine-lock.c => util/qemu-coroutine-lock.c | 4 ++--
qemu-coroutine-sleep.c => util/qemu-coroutine-sleep.c | 2 +-
qemu-coroutine.c => util/qemu-coroutine.c | 4 ++--
36 files changed, 45 insertions(+), 39 deletions(-)
rename include/{block => qemu}/coroutine.h (100%)
rename include/{block => qemu}/coroutine_int.h (98%)
rename coroutine-gthread.c => util/coroutine-gthread.c (99%)
rename coroutine-sigaltstack.c => util/coroutine-sigaltstack.c (99%)
rename coroutine-ucontext.c => util/coroutine-ucontext.c (99%)
rename coroutine-win32.c => util/coroutine-win32.c (98%)
rename qemu-coroutine-io.c => util/qemu-coroutine-io.c (99%)
rename qemu-coroutine-lock.c => util/qemu-coroutine-lock.c (98%)
rename qemu-coroutine-sleep.c => util/qemu-coroutine-sleep.c (96%)
rename qemu-coroutine.c => util/qemu-coroutine.c (98%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 01fb6e2..78e14fc 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -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
diff --git a/Makefile.objs b/Makefile.objs
index bc43e5c..ecfe03c 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -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/
#######################################################################
diff --git a/block.c b/block.c
index 09f2a75..6771c3a 100644
--- a/block.c
+++ b/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"
diff --git a/block/qcow2.h b/block/qcow2.h
index 3512263..b8c500b 100644
--- a/block/qcow2.h
+++ b/block/qcow2.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
diff --git a/block/vdi.c b/block/vdi.c
index 17626d4..17f435f 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -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>
diff --git a/block/write-threshold.c b/block/write-threshold.c
index a53c1f5..0fe3891 100644
--- a/block/write-threshold.c
+++ b/block/write-threshold.c
@@ -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"
diff --git a/blockjob.c b/blockjob.c
index d87869c..1da5491 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -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"
diff --git a/hw/9pfs/codir.c b/hw/9pfs/codir.c
index 65ad329..ec9cc7f 100644
--- a/hw/9pfs/codir.c
+++ b/hw/9pfs/codir.c
@@ -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,
diff --git a/hw/9pfs/cofile.c b/hw/9pfs/cofile.c
index 2efebf3..7cb55ee 100644
--- a/hw/9pfs/cofile.c
+++ b/hw/9pfs/cofile.c
@@ -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,
diff --git a/hw/9pfs/cofs.c b/hw/9pfs/cofs.c
index 42ee614..e1953a9 100644
--- a/hw/9pfs/cofs.c
+++ b/hw/9pfs/cofs.c
@@ -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)
diff --git a/hw/9pfs/coxattr.c b/hw/9pfs/coxattr.c
index 18ee08d..55c0d23 100644
--- a/hw/9pfs/coxattr.c
+++ b/hw/9pfs/coxattr.c
@@ -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)
diff --git a/hw/9pfs/virtio-9p-coth.c b/hw/9pfs/virtio-9p-coth.c
index 8185c53..5057f8d 100644
--- a/hw/9pfs/virtio-9p-coth.c
+++ b/hw/9pfs/virtio-9p-coth.c
@@ -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 */
diff --git a/hw/9pfs/virtio-9p-coth.h b/hw/9pfs/virtio-9p-coth.h
index 4f51b25..0fbe49a 100644
--- a/hw/9pfs/virtio-9p-coth.h
+++ b/hw/9pfs/virtio-9p-coth.h
@@ -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>
diff --git a/hw/9pfs/virtio-9p.h b/hw/9pfs/virtio-9p.h
index 2e7d488..d7a4dc1 100644
--- a/hw/9pfs/virtio-9p.h
+++ b/hw/9pfs/virtio-9p.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,
diff --git a/include/block/block.h b/include/block/block.h
index 6d70eb4..84f05ad 100644
--- a/include/block/block.h
+++ b/include/block/block.h
@@ -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"
diff --git a/include/block/block_int.h b/include/block/block_int.h
index c0e6513..a480f94 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.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"
diff --git a/include/block/coroutine.h b/include/qemu/coroutine.h
similarity index 100%
rename from include/block/coroutine.h
rename to include/qemu/coroutine.h
diff --git a/include/block/coroutine_int.h b/include/qemu/coroutine_int.h
similarity index 98%
rename from include/block/coroutine_int.h
rename to include/qemu/coroutine_int.h
index 9aa1aae..42d6838 100644
--- a/include/block/coroutine_int.h
+++ b/include/qemu/coroutine_int.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,
diff --git a/migration/qemu-file-buf.c b/migration/qemu-file-buf.c
index e3fd085..49516b8 100644
--- a/migration/qemu-file-buf.c
+++ b/migration/qemu-file-buf.c
@@ -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"
diff --git a/migration/qemu-file-stdio.c b/migration/qemu-file-stdio.c
index 889ffb3..9bde9db 100644
--- a/migration/qemu-file-stdio.c
+++ b/migration/qemu-file-stdio.c
@@ -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 {
diff --git a/migration/qemu-file-unix.c b/migration/qemu-file-unix.c
index bf7a0e4..809bf07 100644
--- a/migration/qemu-file-unix.c
+++ b/migration/qemu-file-unix.c
@@ -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"
diff --git a/migration/qemu-file.c b/migration/qemu-file.c
index 49addf6..df49023 100644
--- a/migration/qemu-file.c
+++ b/migration/qemu-file.c
@@ -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"
diff --git a/migration/rdma.c b/migration/rdma.c
index 7a7176f..553fbd7 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -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>
diff --git a/nbd.c b/nbd.c
index 74859cb..fc34c44 100644
--- a/nbd.c
+++ b/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>
diff --git a/tests/test-coroutine.c b/tests/test-coroutine.c
index b552d9f..f5951cb 100644
--- a/tests/test-coroutine.c
+++ b/tests/test-coroutine.c
@@ -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
diff --git a/tests/test-vmstate.c b/tests/test-vmstate.c
index 1d620e0..4d13bd0 100644
--- a/tests/test-vmstate.c
+++ b/tests/test-vmstate.c
@@ -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;
diff --git a/thread-pool.c b/thread-pool.c
index ac909f4..402c778 100644
--- a/thread-pool.c
+++ b/thread-pool.c
@@ -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"
diff --git a/util/Makefile.objs b/util/Makefile.objs
index 114d657..d8d7e7a 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -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
diff --git a/coroutine-gthread.c b/util/coroutine-gthread.c
similarity index 99%
rename from coroutine-gthread.c
rename to util/coroutine-gthread.c
index 6bd6d6b..0bcd778 100644
--- a/coroutine-gthread.c
+++ b/util/coroutine-gthread.c
@@ -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;
diff --git a/coroutine-sigaltstack.c b/util/coroutine-sigaltstack.c
similarity index 99%
rename from coroutine-sigaltstack.c
rename to util/coroutine-sigaltstack.c
index 63519ff..39842a4 100644
--- a/coroutine-sigaltstack.c
+++ b/util/coroutine-sigaltstack.c
@@ -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;
diff --git a/coroutine-ucontext.c b/util/coroutine-ucontext.c
similarity index 99%
rename from coroutine-ucontext.c
rename to util/coroutine-ucontext.c
index 259fcb4..26cbebb 100644
--- a/coroutine-ucontext.c
+++ b/util/coroutine-ucontext.c
@@ -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>
diff --git a/coroutine-win32.c b/util/coroutine-win32.c
similarity index 98%
rename from coroutine-win32.c
rename to util/coroutine-win32.c
index 17ace37..4f922c5 100644
--- a/coroutine-win32.c
+++ b/util/coroutine-win32.c
@@ -23,7 +23,7 @@
*/
#include "qemu-common.h"
-#include "block/coroutine_int.h"
+#include "qemu/coroutine_int.h"
typedef struct
{
diff --git a/qemu-coroutine-io.c b/util/qemu-coroutine-io.c
similarity index 99%
rename from qemu-coroutine-io.c
rename to util/qemu-coroutine-io.c
index 28dc735..e1eae73 100644
--- a/qemu-coroutine-io.c
+++ b/util/qemu-coroutine-io.c
@@ -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"
diff --git a/qemu-coroutine-lock.c b/util/qemu-coroutine-lock.c
similarity index 98%
rename from qemu-coroutine-lock.c
rename to util/qemu-coroutine-lock.c
index 6b49033..130ee19 100644
--- a/qemu-coroutine-lock.c
+++ b/util/qemu-coroutine-lock.c
@@ -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"
diff --git a/qemu-coroutine-sleep.c b/util/qemu-coroutine-sleep.c
similarity index 96%
rename from qemu-coroutine-sleep.c
rename to util/qemu-coroutine-sleep.c
index 9abb7fd..b35db56 100644
--- a/qemu-coroutine-sleep.c
+++ b/util/qemu-coroutine-sleep.c
@@ -11,7 +11,7 @@
*
*/
-#include "block/coroutine.h"
+#include "qemu/coroutine.h"
#include "qemu/timer.h"
#include "block/aio.h"
diff --git a/qemu-coroutine.c b/util/qemu-coroutine.c
similarity index 98%
rename from qemu-coroutine.c
rename to util/qemu-coroutine.c
index c17a92b..8953560 100644
--- a/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -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,
--
2.4.3
next prev parent reply other threads:[~2015-10-20 15:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-20 15:33 [Qemu-devel] [PULL 0/7] Misc refactoring to util codebase Daniel P. Berrange
2015-10-20 15:33 ` [Qemu-devel] [PULL 1/7] sockets: add helpers for creating SocketAddress from a socket Daniel P. Berrange
2015-10-20 15:33 ` [Qemu-devel] [PULL 2/7] sockets: move qapi_copy_SocketAddress into qemu-sockets.c Daniel P. Berrange
2015-10-20 15:33 ` [Qemu-devel] [PULL 3/7] sockets: allow port to be NULL when listening on IP address Daniel P. Berrange
2015-10-20 15:33 ` [Qemu-devel] [PULL 4/7] ui: convert VNC startup code to use SocketAddress Daniel P. Berrange
2015-10-20 15:34 ` [Qemu-devel] [PULL 5/7] osdep: add qemu_fork() wrapper for safely handling signals Daniel P. Berrange
2015-10-20 15:34 ` Daniel P. Berrange [this message]
2015-10-20 15:34 ` [Qemu-devel] [PULL 7/7] util: pull Buffer code out of VNC module Daniel P. Berrange
2015-10-20 15:38 ` [Qemu-devel] [PULL 0/7] Misc refactoring to util codebase Peter Maydell
2015-10-20 15:38 ` Daniel P. Berrange
2015-10-21 12:27 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445355242-4397-7-git-send-email-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.