Skip to contentSkip to conversation

Misc refactoring to util codebase

GIT PULL Applied Daniel P. Berrange 2 participants 11 messages Oct 20, 2015 – Oct 21, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

The following changes since commit c14e42d7a4495ecbad7bf8b3d603272e3a8992a1:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging (2015-10-20 10:52:56 +0100)

are available in the git repository at:

https://github.com/berrange/qemu.git io-channel-3-pull

for you to fetch changes up to 88c5f205fa4c095db4c50eb7ad72816140206819:

util: pull Buffer code out of VNC module (2015-10-20 14:59:09 +0100)

----------------------------------------------------------------

Daniel P. Berrange (7):
sockets: add helpers for creating SocketAddress from a socket
sockets: move qapi_copy_SocketAddress into qemu-sockets.c
sockets: allow port to be NULL when listening on IP address
ui: convert VNC startup code to use SocketAddress
osdep: add qemu_fork() wrapper for safely handling signals
coroutine: move into libqemuutil.a library
util: pull Buffer code out of VNC module

 MAINTAINERS                                        |  13 ++
 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/qemu/buffer.h                              | 118 ++++++++++++
 include/{block => qemu}/coroutine.h                |   0
 include/{block => qemu}/coroutine_int.h            |   2 +-
 include/qemu/osdep.h                               |  16 ++
 include/qemu/sockets.h                             |  34 ++++
 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 +-
 qapi-schema.json                                   |   6 +-
 qemu-char.c                                        |  25 ---
 tests/test-coroutine.c                             |   4 +-
 tests/test-vmstate.c                               |   2 +-
 thread-pool.c                                      |   2 +-
 ui/vnc.c                                           | 203 +++++++++------------
 ui/vnc.h                                           |  16 +-
 util/Makefile.objs                                 |   4 +
 util/buffer.c                                      |  65 +++++++
 coroutine-gthread.c => util/coroutine-gthread.c    |   2 +-
 .../coroutine-sigaltstack.c                        |   2 +-
 coroutine-ucontext.c => util/coroutine-ucontext.c  |   2 +-
 coroutine-win32.c => util/coroutine-win32.c        |   2 +-
 util/oslib-posix.c                                 |  71 +++++++
 util/oslib-win32.c                                 |   9 +
 qemu-coroutine-io.c => util/qemu-coroutine-io.c    |   2 +-
 .../qemu-coroutine-lock.c                          |   4 +-
 .../qemu-coroutine-sleep.c                         |   2 +-
 qemu-coroutine.c => util/qemu-coroutine.c          |   4 +-
 util/qemu-sockets.c                                | 158 +++++++++++++++-
 47 files changed, 613 insertions(+), 199 deletions(-)
 create mode 100644 include/qemu/buffer.h
 rename include/{block => qemu}/coroutine.h (100%)
 rename include/{block => qemu}/coroutine_int.h (98%)
 create mode 100644 util/buffer.c
 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%)
Signature · 1 line
2.4.3
#1 lore raw

[Qemu-devel] [PULL 1/7] sockets: add helpers for creating SocketAddress from a socket

Add two helper methods that, given a socket file descriptor, can return a populated SocketAddress struct containing either the local or remote address information.

---
 include/qemu/sockets.h |  30 ++++++++++++++
 util/qemu-sockets.c    | 110 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 140 insertions(+)
include/qemu/sockets.h +30 -0
index c174b5c..3ea7cc9 100644
@@ -88,4 +88,34 @@ int socket_dgram(SocketAddress *remote, SocketAddress *local, Error **errp);
 int parse_host_port(struct sockaddr_in *saddr, const char *str);
 int socket_init(void);
 
+/**
+ * socket_local_address:
+ * @fd: the socket file handle
+ * @errp: pointer to uninitialized error object
+ *
+ * Get the string representation of the local socket
+ * address. A pointer to the allocated address information
+ * struct will be returned, which the caller is required to
+ * release with a call qapi_free_SocketAddress when no
+ * longer required.
+ *
+ * Returns: the socket address struct, or NULL on error
+ */
+SocketAddress *socket_local_address(int fd, Error **errp);
+
+/**
+ * socket_remote_address:
+ * @fd: the socket file handle
+ * @errp: pointer to uninitialized error object
+ *
+ * Get the string representation of the remote socket
+ * address. A pointer to the allocated address information
+ * struct will be returned, which the caller is required to
+ * release with a call qapi_free_SocketAddress when no
+ * longer required.
+ *
+ * Returns: the socket address struct, or NULL on error
+ */
+SocketAddress *socket_remote_address(int fd, Error **errp);
+
 #endif /* QEMU_SOCKET_H */
util/qemu-sockets.c +110 -0

113 lines not on this page · raw message

Signature · 1 line
2.4.3
#2 lore raw

[Qemu-devel] [PULL 2/7] sockets: move qapi_copy_SocketAddress into qemu-sockets.c

In reply to Daniel P. Berrange

The qapi_copy_SocketAddress method is going to be useful in more places than just qemu-char.c, so move it into the qemu-sockets.c file to allow its reuse.

---
 include/qemu/sockets.h |  4 ++++
 qemu-char.c            | 25 -------------------------
 util/qemu-sockets.c    | 30 ++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 25 deletions(-)
include/qemu/sockets.h +4 -0
index 3ea7cc9..5a183c5 100644
@@ -118,4 +118,8 @@ SocketAddress *socket_local_address(int fd, Error **errp);
  */
 SocketAddress *socket_remote_address(int fd, Error **errp);
 
+
+void qapi_copy_SocketAddress(SocketAddress **p_dest,
+                             SocketAddress *src);
+
 #endif /* QEMU_SOCKET_H */
qemu-char.c +0 -25
index 13371c4..908e712 100644
@@ -92,31 +92,6 @@
 
 /***********************************************************/
 /* Socket address helpers */
-static void qapi_copy_SocketAddress(SocketAddress **p_dest,
-                                    SocketAddress *src)
-{
-    QmpOutputVisitor *qov;
-    QmpInputVisitor *qiv;
-    Visitor *ov, *iv;
-    QObject *obj;
-
-    *p_dest = NULL;
-
-    qov = qmp_output_visitor_new();
-    ov = qmp_output_get_visitor(qov);
-    visit_type_SocketAddress(ov, &src, NULL, &error_abort);
-    obj = qmp_output_get_qobject(qov);
-    qmp_output_visitor_cleanup(qov);
-    if (!obj) {
-        return;
-    }
-
-    qiv = qmp_input_visitor_new(obj);
-    iv = qmp_input_get_visitor(qiv);
-    visit_type_SocketAddress(iv, p_dest, NULL, &error_abort);
-    qmp_input_visitor_cleanup(qiv);
-    qobject_decref(obj);
-}
 
 static int SocketAddress_to_str(char *dest, int max_len,
                                 const char *prefix, SocketAddress *addr,
util/qemu-sockets.c +30 -0
index 24b7b73..3338452 100644
@@ -25,6 +25,9 @@
 #include "monitor/monitor.h"
 #include "qemu/sockets.h"
 #include "qemu/main-loop.h"
+#include "qapi/qmp-input-visitor.h"
+#include "qapi/qmp-output-visitor.h"
+#include "qapi-visit.h"
 
 #ifndef AI_ADDRCONFIG
 # define AI_ADDRCONFIG 0
@@ -1128,3 +1131,30 @@ SocketAddress *socket_remote_address(int fd, Error **errp)
 
     return socket_sockaddr_to_address(&ss, sslen, errp);
 }
+
+
+void qapi_copy_SocketAddress(SocketAddress **p_dest,
+                             SocketAddress *src)
+{
+    QmpOutputVisitor *qov;
+    QmpInputVisitor *qiv;
+    Visitor *ov, *iv;
+    QObject *obj;
+
+    *p_dest = NULL;
+
+    qov = qmp_output_visitor_new();
+    ov = qmp_output_get_visitor(qov);
+    visit_type_SocketAddress(ov, &src, NULL, &error_abort);
+    obj = qmp_output_get_qobject(qov);
+    qmp_output_visitor_cleanup(qov);
+    if (!obj) {
+        return;
+    }
+
+    qiv = qmp_input_visitor_new(obj);
+    iv = qmp_input_get_visitor(qiv);
+    visit_type_SocketAddress(iv, p_dest, NULL, &error_abort);
+    qmp_input_visitor_cleanup(qiv);
+    qobject_decref(obj);
+}
Signature · 1 line
2.4.3
#3 lore raw

[Qemu-devel] [PULL 5/7] osdep: add qemu_fork() wrapper for safely handling signals

In reply to Daniel P. Berrange

When using regular fork() the child process of course inherits all the parents' signal handlers. If the child then proceeds to close() any open file descriptors, it may break some of those registered signal handlers. The child generally does not want to ever run any of the signal handlers that the parent may have installed in the short time before it exec's. The parent may also have blocked various signals which the child process will want enabled.

This introduces a wrapper qemu_fork() that takes care to sanitize signal handling across fork. Before forking it blocks all signals in the parent thread. After fork returns, the parent unblocks the signals and carries on as usual. The child, however, resets all the signal handlers back to their defaults before it unblocks signals. The child process can now exec the binary in a "clean" signal environment.

---
 include/qemu/osdep.h | 16 ++++++++++++
 util/oslib-posix.c   | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 util/oslib-win32.c   |  9 +++++++
 3 files changed, 96 insertions(+)
include/qemu/osdep.h +16 -0
index ef21efb..b568424 100644
@@ -69,6 +69,8 @@
 #include "sysemu/os-posix.h"
 #endif
 
+#include "qapi/error.h"
+
 #if defined(CONFIG_SOLARIS) && CONFIG_SOLARIS_VERSION < 10
 /* [u]int_fast*_t not in <sys/int_types.h> */
 typedef unsigned char           uint_fast8_t;
@@ -286,4 +288,18 @@ void os_mem_prealloc(int fd, char *area, size_t sz);
 
 int qemu_read_password(char *buf, int buf_size);
 
+/**
+ * qemu_fork:
+ *
+ * A version of fork that avoids signal handler race
+ * conditions that can lead to child process getting
+ * signals that are otherwise only expected by the
+ * parent. It also resets all signal handlers to the
+ * default settings.
+ *
+ * Returns 0 to child process, pid number to parent
+ * or -1 on failure.
+ */
+pid_t qemu_fork(Error **errp);
+
 #endif
util/oslib-posix.c +71 -0

74 lines not on this page · raw message

util/oslib-win32.c +9 -0
index 08f5a9c..09f9e98 100644
@@ -496,3 +496,12 @@ int qemu_read_password(char *buf, int buf_size)
     buf[i] = '\0';
     return 0;
 }
+
+
+pid_t qemu_fork(Error **errp)
+{
+    errno = ENOSYS;
+    error_setg_errno(errp, errno,
+                     "cannot fork child process");
+    return -1;
+}
Signature · 1 line
2.4.3
#4 lore raw

[Qemu-devel] [PULL 4/7] ui: convert VNC startup code to use SocketAddress

In reply to Daniel P. Berrange

The VNC code is currently using QemuOpts to configure the sockets connections / listeners it needs. Convert it to use SocketAddress to bring it in line with modern QAPI based code elsewhere in QEMU.

---
 ui/vnc.c | 160 +++++++++++++++++++++++++++++++++++----------------------------
 1 file changed, 90 insertions(+), 70 deletions(-)
ui/vnc.c +90 -70
index d73966a..1fa0550 100644
@@ -3506,18 +3506,14 @@ void vnc_display_open(const char *id, Error **errp)
 {
     VncDisplay *vs = vnc_display_find(id);
     QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id);
-    QemuOpts *sopts, *wsopts;
+    SocketAddress *saddr = NULL, *wsaddr = NULL;
     const char *share, *device_id;
     QemuConsole *con;
     bool password = false;
     bool reverse = false;
     const char *vnc;
-    const char *has_to;
     char *h;
-    bool has_ipv4 = false;
-    bool has_ipv6 = false;
     const char *credid;
-    const char *websocket;
     bool sasl = false;
 #ifdef CONFIG_VNC_SASL
     int saslErr;
@@ -3539,44 +3535,83 @@ void vnc_display_open(const char *id, Error **errp)
         return;
     }
 
-    sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
-    wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort);
-
     h = strrchr(vnc, ':');
     if (h) {
-        char *host;
         size_t hlen = h - vnc;
 
-        if (vnc[0] == '[' && vnc[hlen - 1] == ']') {
-            host = g_strndup(vnc + 1, hlen - 2);
+        const char *websocket = qemu_opt_get(opts, "websocket");
+        int to = qemu_opt_get_number(opts, "to", 0);
+        bool has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
+        bool has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
+
+        saddr = g_new0(SocketAddress, 1);
+        if (websocket) {
+            if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) {
+                error_setg(errp,
+                           "SHA1 hash support is required for websockets");
+                goto fail;
+            }
+
+            wsaddr = g_new0(SocketAddress, 1);
+            vs->ws_enabled = true;
+        }
+
+        if (strncmp(vnc, "unix:", 5) == 0) {
+            saddr->kind = SOCKET_ADDRESS_KIND_UNIX;
+            saddr->q_unix = g_new0(UnixSocketAddress, 1);
+            saddr->q_unix->path = g_strdup(vnc + 5);
+
+            if (vs->ws_enabled) {
+                error_setg(errp, "UNIX sockets not supported with websock");
+                goto fail;
+            }
         } else {
-            host = g_strndup(vnc, hlen);
+            unsigned long long baseport;
+            saddr->kind = SOCKET_ADDRESS_KIND_INET;
+            saddr->inet = g_new0(InetSocketAddress, 1);
+            if (vnc[0] == '[' && vnc[hlen - 1] == ']') {
+                saddr->inet->host = g_strndup(vnc + 1, hlen - 2);
+            } else {
+                saddr->inet->host = g_strndup(vnc, hlen);
+            }
+            if (parse_uint_full(h + 1, &baseport, 10) < 0) {
+                error_setg(errp, "can't convert to a number: %s", h + 1);
+                goto fail;
+            }
+            if (baseport > 65535 ||
+                baseport + 5900 > 65535) {
+                error_setg(errp, "port %s out of range", h + 1);
+                goto fail;
+            }
+            saddr->inet->port = g_strdup_printf(
+                "%d", (int)baseport + 5900);
+
+            if (to) {
+                saddr->inet->has_to = true;
+                saddr->inet->to = to;
+            }
+            saddr->inet->ipv4 = saddr->inet->has_ipv4 = has_ipv4;
+            saddr->inet->ipv6 = saddr->inet->has_ipv6 = has_ipv6;
+
+            if (vs->ws_enabled) {
+                wsaddr->kind = SOCKET_ADDRESS_KIND_INET;
+                wsaddr->inet = g_new0(InetSocketAddress, 1);
+                wsaddr->inet->host = g_strdup(saddr->inet->host);
+                wsaddr->inet->port = g_strdup(websocket);
+
+                if (to) {
+                    wsaddr->inet->has_to = true;
+                    wsaddr->inet->to = to;
+                }
+                wsaddr->inet->ipv4 = wsaddr->inet->has_ipv4 = has_ipv4;
+                wsaddr->inet->ipv6 = wsaddr->inet->has_ipv6 = has_ipv6;
+            }
         }
-        qemu_opt_set(sopts, "host", host, &error_abort);
-        qemu_opt_set(wsopts, "host", host, &error_abort);
-        qemu_opt_set(sopts, "port", h+1, &error_abort);
-        g_free(host);
     } else {
         error_setg(errp, "no vnc port specified");
         goto fail;
     }
 
-    has_to = qemu_opt_get(opts, "to");
-    has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false);
-    has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false);
-    if (has_to) {
-        qemu_opt_set(sopts, "to", has_to, &error_abort);
-        qemu_opt_set(wsopts, "to", has_to, &error_abort);
-    }
-    if (has_ipv4) {
-        qemu_opt_set(sopts, "ipv4", "on", &error_abort);
-        qemu_opt_set(wsopts, "ipv4", "on", &error_abort);
-    }
-    if (has_ipv6) {
-        qemu_opt_set(sopts, "ipv6", "on", &error_abort);
-        qemu_opt_set(wsopts, "ipv6", "on", &error_abort);
-    }
-
     password = qemu_opt_get_bool(opts, "password", false);
     if (password) {
         if (fips_get_state()) {
@@ -3682,16 +3717,6 @@ void vnc_display_open(const char *id, Error **errp)
     }
     vs->connections_limit = qemu_opt_get_number(opts, "connections", 32);
 
-    websocket = qemu_opt_get(opts, "websocket");
-    if (websocket) {
-        vs->ws_enabled = true;
-        qemu_opt_set(wsopts, "port", websocket, &error_abort);
-        if (!qcrypto_hash_supports(QCRYPTO_HASH_ALG_SHA1)) {
-            error_setg(errp, "SHA1 hash support is required for websockets");
-            goto fail;
-        }
-    }
-
 #ifdef CONFIG_VNC_JPEG
     vs->lossy = qemu_opt_get_bool(opts, "lossy", false);
 #endif
@@ -3725,7 +3750,7 @@ void vnc_display_open(const char *id, Error **errp)
     }
 #endif
 
-    if (vnc_display_setup_auth(vs, password, sasl, websocket, errp) < 0) {
+    if (vnc_display_setup_auth(vs, password, sasl, vs->ws_enabled, errp) < 0) {
         goto fail;
     }
 
@@ -3770,37 +3795,31 @@ void vnc_display_open(const char *id, Error **errp)
         int csock;
         vs->lsock = -1;
         vs->lwebsock = -1;
-        if (strncmp(vnc, "unix:", 5) == 0) {
-            csock = unix_connect(vnc+5, errp);
-        } else {
-            csock = inet_connect(vnc, errp);
+        if (vs->ws_enabled) {
+            error_setg(errp, "Cannot use websockets in reverse mode");
+            goto fail;
         }
+        csock = socket_connect(saddr, errp, NULL, NULL);
         if (csock < 0) {
             goto fail;
         }
+        vs->is_unix = saddr->kind == SOCKET_ADDRESS_KIND_UNIX;
         vnc_connect(vs, csock, false, false);
     } else {
         /* listen for connects */
-        if (strncmp(vnc, "unix:", 5) == 0) {
-            vs->lsock = unix_listen(vnc+5, NULL, 0, errp);
-            if (vs->lsock < 0) {
-                goto fail;
-            }
-            vs->is_unix = true;
-        } else {
-            vs->lsock = inet_listen_opts(sopts, 5900, errp);
-            if (vs->lsock < 0) {
-                goto fail;
-            }
-            if (vs->ws_enabled) {
-                vs->lwebsock = inet_listen_opts(wsopts, 0, errp);
-                if (vs->lwebsock < 0) {
-                    if (vs->lsock != -1) {
-                        close(vs->lsock);
-                        vs->lsock = -1;
-                    }
-                    goto fail;
+        vs->lsock = socket_listen(saddr, errp);
+        if (vs->lsock < 0) {
+            goto fail;
+        }
+        vs->is_unix = saddr->kind == SOCKET_ADDRESS_KIND_UNIX;
+        if (vs->ws_enabled) {
+            vs->lwebsock = socket_listen(wsaddr, errp);
+            if (vs->lwebsock < 0) {
+                if (vs->lsock != -1) {
+                    close(vs->lsock);
+                    vs->lsock = -1;
                 }
+                goto fail;
             }
         }
         vs->enabled = true;
@@ -3810,13 +3829,14 @@ void vnc_display_open(const char *id, Error **errp)
                                 NULL, vs);
         }
     }
-    qemu_opts_del(sopts);
-    qemu_opts_del(wsopts);
+
+    qapi_free_SocketAddress(saddr);
+    qapi_free_SocketAddress(wsaddr);
     return;
 
 fail:
-    qemu_opts_del(sopts);
-    qemu_opts_del(wsopts);
+    qapi_free_SocketAddress(saddr);
+    qapi_free_SocketAddress(wsaddr);
     vs->enabled = false;
     vs->ws_enabled = false;
 }
Signature · 1 line
2.4.3
#5 lore raw

[Qemu-devel] [PULL 3/7] sockets: allow port to be NULL when listening on IP address

In reply to Daniel P. Berrange

If the port in the SocketAddress struct is NULL, it can allow the kernel to automatically select a free port. This is useful in particular in unit tests to avoid a race trying to find a free port to run a test case on.

---
 qapi-schema.json    |  6 ++++--
 util/qemu-sockets.c | 18 +++++++++++++-----
 2 files changed, 17 insertions(+), 7 deletions(-)
qapi-schema.json +4 -2
index 702b7b5..f60be29 100644
@@ -2614,7 +2614,9 @@
 #
 # @host: host part of the address
 #
-# @port: port part of the address, or lowest port if @to is present
+# @port: port part of the address, or lowest port if @to is present.
+#        Kernel selects a free port if omitted for listener addresses.
+#        #optional
 #
 # @to: highest port to try
 #
@@ -2629,7 +2631,7 @@
 { 'struct': 'InetSocketAddress',
   'data': {
     'host': 'str',
-    'port': 'str',
+    '*port': 'str',
     '*to': 'uint16',
     '*ipv4': 'bool',
     '*ipv6': 'bool' } }
util/qemu-sockets.c +13 -5
index 3338452..9142917 100644
@@ -128,12 +128,15 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
     ai.ai_family = PF_UNSPEC;
     ai.ai_socktype = SOCK_STREAM;
 
-    if ((qemu_opt_get(opts, "host") == NULL) ||
-        (qemu_opt_get(opts, "port") == NULL)) {
-        error_setg(errp, "host and/or port not specified");
+    if ((qemu_opt_get(opts, "host") == NULL)) {
+        error_setg(errp, "host not specified");
         return -1;
     }
-    pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port"));
+    if (qemu_opt_get(opts, "port") != NULL) {
+        pstrcpy(port, sizeof(port), qemu_opt_get(opts, "port"));
+    } else {
+        port[0] = '\0';
+    }
     addr = qemu_opt_get(opts, "host");
 
     to = qemu_opt_get_number(opts, "to", 0);
@@ -145,6 +148,10 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
     /* lookup */
     if (port_offset) {
         unsigned long long baseport;
+        if (strlen(port) == 0) {
+            error_setg(errp, "port not specified");
+            return -1;
+        }
         if (parse_uint_full(port, &baseport, 10) < 0) {
             error_setg(errp, "can't convert to a number: %s", port);
             return -1;
@@ -156,7 +163,8 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
         }
         snprintf(port, sizeof(port), "%d", (int)baseport + port_offset);
     }
-    rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
+    rc = getaddrinfo(strlen(addr) ? addr : NULL,
+                     strlen(port) ? port : NULL, &ai, &res);
     if (rc != 0) {
         error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
                    gai_strerror(rc));
Signature · 1 line
2.4.3
#6 lore raw

[Qemu-devel] [PULL 6/7] coroutine: move into libqemuutil.a library

In reply to Daniel P. Berrange

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.

---
 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%)
MAINTAINERS +7 -0
index 01fb6e2..78e14fc 100644
@@ -1193,6 +1193,13 @@ F: crypto/
 F: include/crypto/
 F: tests/test-crypto-*
 
+Coroutines
+M: Stefan Hajnoczi <[email protected]>
+M: Kevin Wolf <[email protected]>
+F: util/*coroutine*
+F: include/qemu/coroutine*
+F: tests/test-coroutine.c
+
 Usermode Emulation
 ------------------
 Overall
Makefile.objs +0 -4
index bc43e5c..ecfe03c 100644
@@ -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/
 
 #######################################################################
block.c +1 -1
index 09f2a75..6771c3a 100644
@@ -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"
block/qcow2.h +1 -1
index 3512263..b8c500b 100644
@@ -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
block/vdi.c +1 -1
index 17626d4..17f435f 100644
@@ -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>
block/write-threshold.c +1 -1
index a53c1f5..0fe3891 100644
@@ -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"
blockjob.c +1 -1
index d87869c..1da5491 100644
@@ -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"
hw/9pfs/codir.c +1 -1
index 65ad329..ec9cc7f 100644
@@ -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,
hw/9pfs/cofile.c +1 -1
index 2efebf3..7cb55ee 100644
@@ -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,
hw/9pfs/cofs.c +1 -1
index 42ee614..e1953a9 100644
@@ -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)
hw/9pfs/coxattr.c +1 -1
index 18ee08d..55c0d23 100644
@@ -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)
hw/9pfs/virtio-9p-coth.c +1 -1
index 8185c53..5057f8d 100644
@@ -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 */
hw/9pfs/virtio-9p-coth.h +1 -1
index 4f51b25..0fbe49a 100644
@@ -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>
 
hw/9pfs/virtio-9p.h +1 -1
index 2e7d488..d7a4dc1 100644
@@ -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,
include/block/block.h +1 -1
index 6d70eb4..84f05ad 100644
@@ -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"
include/block/block_int.h +1 -1
index c0e6513..a480f94 100644
@@ -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"
include/qemu/coroutine.h renamed from include/block/coroutine.h +0 -0
similarity index 100%
rename from include/block/coroutine.h
rename to include/qemu/coroutine.h
include/qemu/coroutine_int.h renamed from include/block/coroutine_int.h +1 -1
similarity index 98%
rename from include/block/coroutine_int.h
rename to include/qemu/coroutine_int.h
index 9aa1aae..42d6838 100644
@@ -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,
migration/qemu-file-buf.c +1 -1
index e3fd085..49516b8 100644
@@ -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"
migration/qemu-file-stdio.c +1 -1
index 889ffb3..9bde9db 100644
@@ -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 {
migration/qemu-file-unix.c +1 -1
index bf7a0e4..809bf07 100644
@@ -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"
 
migration/qemu-file.c +1 -1
index 49addf6..df49023 100644
@@ -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"
migration/rdma.c +1 -1
index 7a7176f..553fbd7 100644
@@ -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>
nbd.c +1 -1
index 74859cb..fc34c44 100644
@@ -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>
tests/test-coroutine.c +2 -2
index b552d9f..f5951cb 100644
@@ -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
tests/test-vmstate.c +1 -1
index 1d620e0..4d13bd0 100644
@@ -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;
thread-pool.c +1 -1
index ac909f4..402c778 100644
@@ -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"
util/Makefile.objs +3 -0
index 114d657..d8d7e7a 100644
@@ -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
util/coroutine-gthread.c renamed from coroutine-gthread.c +1 -1
similarity index 99%
rename from coroutine-gthread.c
rename to util/coroutine-gthread.c
index 6bd6d6b..0bcd778 100644
@@ -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;
util/coroutine-sigaltstack.c renamed from coroutine-sigaltstack.c +1 -1
similarity index 99%
rename from coroutine-sigaltstack.c
rename to util/coroutine-sigaltstack.c
index 63519ff..39842a4 100644
@@ -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;
util/coroutine-ucontext.c renamed from coroutine-ucontext.c +1 -1
similarity index 99%
rename from coroutine-ucontext.c
rename to util/coroutine-ucontext.c
index 259fcb4..26cbebb 100644
@@ -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>
util/coroutine-win32.c renamed from coroutine-win32.c +1 -1
similarity index 98%
rename from coroutine-win32.c
rename to util/coroutine-win32.c
index 17ace37..4f922c5 100644
@@ -23,7 +23,7 @@
  */
 
 #include "qemu-common.h"
-#include "block/coroutine_int.h"
+#include "qemu/coroutine_int.h"
 
 typedef struct
 {
util/qemu-coroutine-io.c renamed from qemu-coroutine-io.c +1 -1
similarity index 99%
rename from qemu-coroutine-io.c
rename to util/qemu-coroutine-io.c
index 28dc735..e1eae73 100644
@@ -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"
 
util/qemu-coroutine-lock.c renamed from qemu-coroutine-lock.c +2 -2
similarity index 98%
rename from qemu-coroutine-lock.c
rename to util/qemu-coroutine-lock.c
index 6b49033..130ee19 100644
@@ -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"
 
util/qemu-coroutine-sleep.c renamed from qemu-coroutine-sleep.c +1 -1
similarity index 96%
rename from qemu-coroutine-sleep.c
rename to util/qemu-coroutine-sleep.c
index 9abb7fd..b35db56 100644
@@ -11,7 +11,7 @@
  *
  */
 
-#include "block/coroutine.h"
+#include "qemu/coroutine.h"
 #include "qemu/timer.h"
 #include "block/aio.h"
 
util/qemu-coroutine.c renamed from qemu-coroutine.c +2 -2
similarity index 98%
rename from qemu-coroutine.c
rename to util/qemu-coroutine.c
index c17a92b..8953560 100644
@@ -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,
Signature · 1 line
2.4.3
#7 lore raw

[Qemu-devel] [PULL 7/7] util: pull Buffer code out of VNC module

In reply to Daniel P. Berrange

The Buffer code in the VNC server is useful for the IO channel code, so pull it out into a shared module, QIOBuffer.

---
 MAINTAINERS           |   6 +++
 include/qemu/buffer.h | 118 ++++++++++++++++++++++++++++++++++++++++++++++++++
 ui/vnc.c              |  43 ------------------
 ui/vnc.h              |  16 +------
 util/Makefile.objs    |   1 +
 util/buffer.c         |  65 +++++++++++++++++++++++++++
 6 files changed, 191 insertions(+), 58 deletions(-)
 create mode 100644 include/qemu/buffer.h
 create mode 100644 util/buffer.c
MAINTAINERS +6 -0
index 78e14fc..3144113 100644
@@ -1200,6 +1200,12 @@ F: util/*coroutine*
 F: include/qemu/coroutine*
 F: tests/test-coroutine.c
 
+Buffers
+M: Daniel P. Berrange <[email protected]>
+S: Odd fixes
+F: util/buffer.c
+F: include/qemu/buffer.h
+
 Usermode Emulation
 ------------------
 Overall
include/qemu/buffer.h new file +118 -0

118 lines not on this page · raw message

ui/vnc.c +0 -43

49 lines not on this page · raw message

ui/vnc.h +1 -15
index 4dd769c..2863f58 100644
@@ -34,6 +34,7 @@
 #include "audio/audio.h"
 #include "qemu/bitmap.h"
 #include "crypto/tlssession.h"
+#include "qemu/buffer.h"
 #include <zlib.h>
 #include <stdbool.h>
 
@@ -56,13 +57,6 @@
  *
  *****************************************************************************/
 
-typedef struct Buffer
-{
-    size_t capacity;
-    size_t offset;
-    uint8_t *buffer;
-} Buffer;
-
 typedef struct VncState VncState;
 typedef struct VncJob VncJob;
 typedef struct VncRect VncRect;
@@ -535,14 +529,6 @@ ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, int last_errno);
 void start_client_init(VncState *vs);
 void start_auth_vnc(VncState *vs);
 
-/* Buffer management */
-void buffer_reserve(Buffer *buffer, size_t len);
-void buffer_reset(Buffer *buffer);
-void buffer_free(Buffer *buffer);
-void buffer_append(Buffer *buffer, const void *data, size_t len);
-void buffer_advance(Buffer *buf, size_t len);
-uint8_t *buffer_end(Buffer *buffer);
-
 
 /* Misc helpers */
 
util/Makefile.objs +1 -0
index d8d7e7a..1363d1f 100644
@@ -21,3 +21,4 @@ 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
+util-obj-y += buffer.o
util/buffer.c new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.4.3
#8 lore raw
In reply to Daniel P. Berrange
Quoted 7 lines · Daniel P. Berrange

The following changes since commit c14e42d7a4495ecbad7bf8b3d603272e3a8992a1:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging (2015-10-20 10:52:56 +0100)

are available in the git repository at:

https://github.com/berrange/qemu.git io-channel-3-pull

Sorry, that should be referring to the signed tag rather than the branch name:

https://github.com/berrange/qemu.git tags/io-channel-3-for-upstream

Quoted 68 lines

for you to fetch changes up to 88c5f205fa4c095db4c50eb7ad72816140206819:

util: pull Buffer code out of VNC module (2015-10-20 14:59:09 +0100)

----------------------------------------------------------------

Daniel P. Berrange (7):
sockets: add helpers for creating SocketAddress from a socket
sockets: move qapi_copy_SocketAddress into qemu-sockets.c
sockets: allow port to be NULL when listening on IP address
ui: convert VNC startup code to use SocketAddress
osdep: add qemu_fork() wrapper for safely handling signals
coroutine: move into libqemuutil.a library
util: pull Buffer code out of VNC module

 MAINTAINERS                                        |  13 ++
 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/qemu/buffer.h                              | 118 ++++++++++++
 include/{block => qemu}/coroutine.h                |   0
 include/{block => qemu}/coroutine_int.h            |   2 +-
 include/qemu/osdep.h                               |  16 ++
 include/qemu/sockets.h                             |  34 ++++
 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 +-
 qapi-schema.json                                   |   6 +-
 qemu-char.c                                        |  25 ---
 tests/test-coroutine.c                             |   4 +-
 tests/test-vmstate.c                               |   2 +-
 thread-pool.c                                      |   2 +-
 ui/vnc.c                                           | 203 +++++++++------------
 ui/vnc.h                                           |  16 +-
 util/Makefile.objs                                 |   4 +
 util/buffer.c                                      |  65 +++++++
 coroutine-gthread.c => util/coroutine-gthread.c    |   2 +-
 .../coroutine-sigaltstack.c                        |   2 +-
 coroutine-ucontext.c => util/coroutine-ucontext.c  |   2 +-
 coroutine-win32.c => util/coroutine-win32.c        |   2 +-
 util/oslib-posix.c                                 |  71 +++++++
 util/oslib-win32.c                                 |   9 +
 qemu-coroutine-io.c => util/qemu-coroutine-io.c    |   2 +-
 .../qemu-coroutine-lock.c                          |   4 +-
 .../qemu-coroutine-sleep.c                         |   2 +-
 qemu-coroutine.c => util/qemu-coroutine.c          |   4 +-
 util/qemu-sockets.c                                | 158 +++++++++++++++-
 47 files changed, 613 insertions(+), 199 deletions(-)
 create mode 100644 include/qemu/buffer.h
 rename include/{block => qemu}/coroutine.h (100%)
 rename include/{block => qemu}/coroutine_int.h (98%)
 create mode 100644 util/buffer.c
Quoted 8 lines
 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%)

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#10 lore raw
In reply to Daniel P. Berrange
Quoted 7 lines · Daniel P. Berrange

The following changes since commit c14e42d7a4495ecbad7bf8b3d603272e3a8992a1:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging (2015-10-20 10:52:56 +0100)

are available in the git repository at:

https://github.com/berrange/qemu.git io-channel-3-pull

Hi. This appears to be a branch, not a tag; I'm only taking pulls for signed tags these days.

thanks
-- PMM

#9 lore raw
In reply to Daniel P. Berrange
Quoted 5 lines · Daniel P. Berrange
Quoted 4 lines · Daniel P. Berrange

The following changes since commit c14e42d7a4495ecbad7bf8b3d603272e3a8992a1:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20151020-1' into staging (2015-10-20 10:52:56 +0100)

Quoted 24 lines
Quoted 3 lines

are available in the git repository at:

https://github.com/berrange/qemu.git io-channel-3-pull

Sorry, that should be referring to the signed tag rather than the branch name:

https://github.com/berrange/qemu.git tags/io-channel-3-for-upstream

Quoted 15 lines

for you to fetch changes up to 88c5f205fa4c095db4c50eb7ad72816140206819:

util: pull Buffer code out of VNC module (2015-10-20 14:59:09 +0100)

----------------------------------------------------------------

Daniel P. Berrange (7):
sockets: add helpers for creating SocketAddress from a socket
sockets: move qapi_copy_SocketAddress into qemu-sockets.c
sockets: allow port to be NULL when listening on IP address
ui: convert VNC startup code to use SocketAddress
osdep: add qemu_fork() wrapper for safely handling signals
coroutine: move into libqemuutil.a library
util: pull Buffer code out of VNC module

Applied, thanks.

-- PMM