]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
coroutine: move into libqemuutil.a library
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 1 Sep 2015 13:48:02 +0000 (14:48 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Tue, 20 Oct 2015 13:59:04 +0000 (14:59 +0100)
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>
36 files changed:
MAINTAINERS
Makefile.objs
block.c
block/qcow2.h
block/vdi.c
block/write-threshold.c
blockjob.c
hw/9pfs/codir.c
hw/9pfs/cofile.c
hw/9pfs/cofs.c
hw/9pfs/coxattr.c
hw/9pfs/virtio-9p-coth.c
hw/9pfs/virtio-9p-coth.h
hw/9pfs/virtio-9p.h
include/block/block.h
include/block/block_int.h
include/qemu/coroutine.h [moved from include/block/coroutine.h with 100% similarity]
include/qemu/coroutine_int.h [moved from include/block/coroutine_int.h with 98% similarity]
migration/qemu-file-buf.c
migration/qemu-file-stdio.c
migration/qemu-file-unix.c
migration/qemu-file.c
migration/rdma.c
nbd.c
tests/test-coroutine.c
tests/test-vmstate.c
thread-pool.c
util/Makefile.objs
util/coroutine-gthread.c [moved from coroutine-gthread.c with 99% similarity]
util/coroutine-sigaltstack.c [moved from coroutine-sigaltstack.c with 99% similarity]
util/coroutine-ucontext.c [moved from coroutine-ucontext.c with 99% similarity]
util/coroutine-win32.c [moved from coroutine-win32.c with 98% similarity]
util/qemu-coroutine-io.c [moved from qemu-coroutine-io.c with 99% similarity]
util/qemu-coroutine-lock.c [moved from qemu-coroutine-lock.c with 98% similarity]
util/qemu-coroutine-sleep.c [moved from qemu-coroutine-sleep.c with 96% similarity]
util/qemu-coroutine.c [moved from qemu-coroutine.c with 98% similarity]

index 01fb6e26e2926c4bf04f2d42c5c0474d09a8de69..78e14fc1324d23ad0aed23a49fac5d80a4b4adab 100644 (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
index bc43e5c1dd06285632ae92f8226eadde0e050dbb..ecfe03c1953ac6a47fd16f2fab007aff0b562d6d 100644 (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/
 
 #######################################################################
diff --git a/block.c b/block.c
index 09f2a754f15e530f4ef47dccc65274b773f00cc0..6771c3a1a19fa1fe233665f8209fb2f0fbc4851c 100644 (file)
--- 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"
index 351226302f77b59baf5b2745648578e098110561..b8c500b9dcf879608144ae4b89c6ec6c7fc6b745 100644 (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
index 17626d4f4eaaa79fd08f8210b6f16832ae6658fe..17f435fad6b266ef5f814d0f973ed19da9e3ecb5 100644 (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>
index a53c1f5e651519b99dee77423bf649a3e799c76e..0fe38917c58e1793ea77acfaee44fb08edf35a5d 100644 (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"
index d87869c24a81bf0d3e6f2d4f5be8a28cb0206395..1da5491228a51344d410ec223e08c346efda1636 100644 (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"
index 65ad3298be9ce2e3b4a4f1ca1fd110cc74c8b02d..ec9cc7fb274a80849e86b2e7791ca9c1ec8bc8ac 100644 (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,
index 2efebf35710f4fd5dde18774b4bd54d11ec6bf3d..7cb55ee93a4f7c64ed8e4f36de6496a17d129cc2 100644 (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,
index 42ee614e27f0cef1cc3e15aa882fd459a38eacf5..e1953a9aa1803c32708a905e42b2e8fce153d897 100644 (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)
index 18ee08df0f5fc386a563526b86e44666938c5c14..55c0d231cb65a3f5ffa3a5a29cd90667c12559cb 100644 (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)
index 8185c533c013393e5ebc741de0d8e4b26b88c442..5057f8d220df73f55c51b39a914df1b408a5c1ed 100644 (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 */
index 4f51b250d1d44fa842b554ad8bf272165648cf5a..0fbe49a946156c1be85aaa2b913864154bc9d520 100644 (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>
 
index 2e7d488570832c335af6df07b899030ee8fb8a14..d7a4dc1e9ad73e733b6114aa27cd4b55d52472b7 100644 (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,
index 6d70eb42fe60b182e9eddc1a346e8b38d80ca762..84f05ad4083c066dd7aeb7a8335cd356a16ff6dc 100644 (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"
index c0e65138b1f1ac519c5f55ed3502b0257aefaa1a..a480f944cf0a729819bb2ccf08eb2816786a2e11 100644 (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"
similarity index 98%
rename from include/block/coroutine_int.h
rename to include/qemu/coroutine_int.h
index 9aa1aae5d56d058eba3594687e406d57b7105317..42d6838401509ed8c135daa40b446038f9cfe5f2 100644 (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,
index e3fd0859d6f1e5ed0c3e4358b3ad47e8a99ff0f7..49516b8643a35455a1f807dfe8c26110b6ca425f 100644 (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"
index 889ffb302cdb71720e18cae60e5460f48625272d..9bde9db5664220dd0b160259f8cd2d0975f2e17a 100644 (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 {
index bf7a0e4a2b850a7ea4e94fbb71cf322ff2837ddf..809bf070d73e2aa7c99d0ebb7673ab6383a07781 100644 (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"
 
index 49addf6d0682dcbc46af64bf176b8809c9c510d9..df49023ed8c884749538dbca2df5fba0908d2fb6 100644 (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"
index 7a7176f7c99a2a2c0ba2575618166dab2f9eaeef..553fbd7503cae257f0f6e9f33cd3e9740bc16df9 100644 (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>
diff --git a/nbd.c b/nbd.c
index 74859cbe09c0247addd24e87d387de7670667edb..fc34c449c8e49bcf567ea4fd1d03926b41c06722 100644 (file)
--- 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>
index b552d9f5e90d5ee0daf7999516369fa30ad77552..f5951cb1f1d3dd005a589b763770ed5ee0a6c01e 100644 (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
index 1d620e04fb4d6b7ce19491e3adb4a5a83f3c41f1..4d13bd09b327efcc0d2a20c5460e961aa9aa1d2f 100644 (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;
index ac909f498675325f689747b636300146bdb251f6..402c778b47ac07137c9ea631b79f254e9e3f8266 100644 (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"
index 114d6578c4b2fb7a26aacdc544d8f698dba396bc..d8d7e7a9193426bc0481ca223442eb1c122ce2e3 100644 (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
similarity index 99%
rename from coroutine-gthread.c
rename to util/coroutine-gthread.c
index 6bd6d6b22f744017c7b9212f80bf9af65f988726..0bcd77867d457a366bc1dc39108bebbde8db7f1a 100644 (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;
similarity index 99%
rename from coroutine-sigaltstack.c
rename to util/coroutine-sigaltstack.c
index 63519fffc7d78ddc168b8f39d2e2a306dd565801..39842a4a904deeff5fcbccaa5039261cc666ec90 100644 (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;
similarity index 99%
rename from coroutine-ucontext.c
rename to util/coroutine-ucontext.c
index 259fcb48a42ab7346afac0708cfc6506add58675..26cbebb7a71f3cb02852eccf89a064952fc18152 100644 (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>
similarity index 98%
rename from coroutine-win32.c
rename to util/coroutine-win32.c
index 17ace37deeb33a19d100f64e86c9ac780e4cd8bc..4f922c53af2cdc344773f80a71d14730e5652c90 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 #include "qemu-common.h"
-#include "block/coroutine_int.h"
+#include "qemu/coroutine_int.h"
 
 typedef struct
 {
similarity index 99%
rename from qemu-coroutine-io.c
rename to util/qemu-coroutine-io.c
index 28dc7351accb904b3caf204ee5032a69364dec87..e1eae7331e025b4cf9f8de40c84bfd40007f4f62 100644 (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"
 
similarity index 98%
rename from qemu-coroutine-lock.c
rename to util/qemu-coroutine-lock.c
index 6b4903334bdf1d6a591c388a3ebae9bfc1b9c87d..130ee19d178ce2e906eda161b079460c94a25caa 100644 (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"
 
similarity index 96%
rename from qemu-coroutine-sleep.c
rename to util/qemu-coroutine-sleep.c
index 9abb7fdf31a96118c6c2b822225fa3d7074cecc7..b35db56356dd90f05a89d57ab293b1db8a6156ac 100644 (file)
@@ -11,7 +11,7 @@
  *
  */
 
-#include "block/coroutine.h"
+#include "qemu/coroutine.h"
 #include "qemu/timer.h"
 #include "block/aio.h"
 
similarity index 98%
rename from qemu-coroutine.c
rename to util/qemu-coroutine.c
index c17a92b107e8e7064b8616a2f46553ba9bac614d..8953560223b4e5290e9701db83ab0c16ace292ac 100644 (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,