From patchwork Mon Sep 24 08:52:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 186316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 0F6122C007D for ; Mon, 24 Sep 2012 18:50:54 +1000 (EST) Received: from localhost ([::1]:43704 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG4NQ-00032w-83 for incoming@patchwork.ozlabs.org; Mon, 24 Sep 2012 04:50:52 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53614) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG4NE-00032A-Tt for qemu-devel@nongnu.org; Mon, 24 Sep 2012 04:50:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TG4ND-0000r3-KW for qemu-devel@nongnu.org; Mon, 24 Sep 2012 04:50:40 -0400 Received: from e28smtp04.in.ibm.com ([122.248.162.4]:50460) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TG4ND-0000qF-0T for qemu-devel@nongnu.org; Mon, 24 Sep 2012 04:50:39 -0400 Received: from /spool/local by e28smtp04.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Sep 2012 14:20:35 +0530 Received: from d28relay05.in.ibm.com (9.184.220.62) by e28smtp04.in.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Sep 2012 14:20:32 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q8O8oVpf67043472 for ; Mon, 24 Sep 2012 14:20:32 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q8O8oVGt009503 for ; Mon, 24 Sep 2012 18:50:31 +1000 Received: from in.ibm.com ([9.79.202.140]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id q8O8oK2l008555 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Mon, 24 Sep 2012 18:50:26 +1000 Date: Mon, 24 Sep 2012 14:22:25 +0530 From: Bharata B Rao To: qemu-devel@nongnu.org Message-ID: <20120924085225.GD18470@in.ibm.com> References: <20120924085127.GC18470@in.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120924085127.GC18470@in.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) x-cbid: 12092408-5564-0000-0000-00000497490A X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 122.248.162.4 Cc: Kevin Wolf , Anthony Liguori , Anand Avati , Vijay Bellur , Stefan Hajnoczi , Harsh Bora , Amar Tumballi , Markus Armbruster , Blue Swirl , Avi Kivity , Paolo Bonzini Subject: [Qemu-devel] [PATCH v8 1/6] sockets: publish dummy_opts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org sockets: publish dummy_opts From: Paolo Bonzini This is needed so that we can set up a QemuOpts instance from QMP parameters. The way to go here is to and move qemu-sockets.c away from QemuOpts and use Laszlo's QemuOptsVisitor whenever *_opts functions are called now. This can be done later, however. This would also enable block backends like gluster to make use of inet_parse() for inet address parsing. Signed-off-by: Paolo Bonzini Signed-off-by: Bharata B Rao --- qemu-sockets.c | 14 +++++++------- qemu_socket.h | 2 ++ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/qemu-sockets.c b/qemu-sockets.c index 361d890..b292311 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -32,9 +32,9 @@ static const int on=1, off=0; /* used temporarely until all users are converted to QemuOpts */ -static QemuOptsList dummy_opts = { - .name = "dummy", - .head = QTAILQ_HEAD_INITIALIZER(dummy_opts.head), +QemuOptsList socket_opts = { + .name = "socket", + .head = QTAILQ_HEAD_INITIALIZER(socket_opts.head), .desc = { { .name = "path", @@ -469,7 +469,7 @@ int inet_listen(const char *str, char *ostr, int olen, char *optstr; int sock = -1; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create(&socket_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { sock = inet_listen_opts(opts, port_offset, errp); if (sock != -1 && ostr) { @@ -498,7 +498,7 @@ int inet_connect(const char *str, bool block, bool *in_progress, Error **errp) QemuOpts *opts; int sock = -1; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create(&socket_opts, NULL, 0, NULL); if (inet_parse(opts, str) == 0) { if (block) { qemu_opt_set(opts, "block", "on"); @@ -597,7 +597,7 @@ int unix_listen(const char *str, char *ostr, int olen) char *path, *optstr; int sock, len; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create(&socket_opts, NULL, 0, NULL); optstr = strchr(str, ','); if (optstr) { @@ -625,7 +625,7 @@ int unix_connect(const char *path) QemuOpts *opts; int sock; - opts = qemu_opts_create(&dummy_opts, NULL, 0, NULL); + opts = qemu_opts_create(&socket_opts, NULL, 0, NULL); qemu_opt_set(opts, "path", path); sock = unix_connect_opts(opts); qemu_opts_del(opts); diff --git a/qemu_socket.h b/qemu_socket.h index 30ae6af..c87ee57 100644 --- a/qemu_socket.h +++ b/qemu_socket.h @@ -30,6 +30,8 @@ int inet_aton(const char *cp, struct in_addr *ia); #include "error.h" #include "qerror.h" +extern QemuOptsList socket_opts; + /* misc helpers */ int qemu_socket(int domain, int type, int protocol); int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);