qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 10/12] qemu-sockets: move block from QemuOpts to arg


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 10/12] qemu-sockets: move block from QemuOpts to arguments
Date: Wed, 19 Sep 2012 16:31:13 +0200

This option is not accessible from anywhere in the command-line, so it
need not be a QemuOpt.  Make it a separate argument, which will be the
same convention used by socket_connect.

Signed-off-by: Paolo Bonzini <address@hidden>
---
 qemu-char.c    |  2 +-
 qemu-sockets.c | 12 ++----------
 qemu_socket.h  |  2 +-
 3 file modificati, 4 inserzioni(+), 12 rimozioni(-)

diff --git a/qemu-char.c b/qemu-char.c
index b886f3b..b33bdaa 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2459,7 +2459,7 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts 
*opts)
         if (is_listen) {
             fd = inet_listen_opts(opts, 0, NULL);
         } else {
-            fd = inet_connect_opts(opts, NULL, NULL);
+            fd = inet_connect_opts(opts, false, NULL, NULL);
         }
     }
     if (fd < 0) {
diff --git a/qemu-sockets.c b/qemu-sockets.c
index c213cc8..8a7c5d4 100644
--- a/qemu-sockets.c
+++ b/qemu-sockets.c
@@ -54,9 +54,6 @@ static QemuOptsList dummy_opts = {
         },{
             .name = "ipv6",
             .type = QEMU_OPT_BOOL,
-        },{
-            .name = "block",
-            .type = QEMU_OPT_BOOL,
         },
         { /* end if list */ }
     },
@@ -209,7 +206,7 @@ listen:
     return slisten;
 }
 
-int inet_connect_opts(QemuOpts *opts, bool *in_progress, Error **errp)
+int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress, Error 
**errp)
 {
     struct addrinfo ai,*res,*e;
     const char *addr;
@@ -217,7 +214,6 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress, 
Error **errp)
     char uaddr[INET6_ADDRSTRLEN+1];
     char uport[33];
     int sock,rc;
-    bool block;
 
     memset(&ai,0, sizeof(ai));
     ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
@@ -230,7 +226,6 @@ int inet_connect_opts(QemuOpts *opts, bool *in_progress, 
Error **errp)
 
     addr = qemu_opt_get(opts, "host");
     port = qemu_opt_get(opts, "port");
-    block = qemu_opt_get_bool(opts, "block", 0);
     if (addr == NULL || port == NULL) {
         fprintf(stderr, "inet_connect: host and/or port not specified\n");
         error_set(errp, QERR_SOCKET_CREATE_FAILED);
@@ -536,10 +531,7 @@ int inet_connect(const char *str, bool block, bool 
*in_progress, Error **errp)
         opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL);
         inet_addr_to_opts(opts, addr);
         qapi_free_IPSocketAddress(addr);
-        if (block) {
-            qemu_opt_set(opts, "block", "on");
-        }
-        sock = inet_connect_opts(opts, in_progress, errp);
+        sock = inet_connect_opts(opts, block, in_progress, errp);
         qemu_opts_del(opts);
     }
     return sock;
diff --git a/qemu_socket.h b/qemu_socket.h
index 6e06982..ad9e342 100644
--- a/qemu_socket.h
+++ b/qemu_socket.h
@@ -42,7 +42,7 @@ int send_all(int fd, const void *buf, int len1);
 int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp);
 int inet_listen(const char *str, char *ostr, int olen,
                 int socktype, int port_offset, Error **errp);
-int inet_connect_opts(QemuOpts *opts, bool *in_progress, Error **errp);
+int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress, Error 
**errp);
 int inet_connect(const char *str, bool block, bool *in_progress, Error **errp);
 int inet_dgram_opts(QemuOpts *opts);
 const char *inet_strfamily(int family);
-- 
1.7.12





reply via email to

[Prev in Thread] Current Thread [Next in Thread]