From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43193) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr8Zs-00049b-4d for qemu-devel@nongnu.org; Tue, 17 Jul 2012 10:16:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sr8Zm-0008BL-2g for qemu-devel@nongnu.org; Tue, 17 Jul 2012 10:16:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:25442) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr8Zl-0008B9-Ol for qemu-devel@nongnu.org; Tue, 17 Jul 2012 10:16:33 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6HEGW1c019330 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Jul 2012 10:16:33 -0400 From: Laszlo Ersek Date: Tue, 17 Jul 2012 16:17:18 +0200 Message-Id: <1342534641-22450-16-git-send-email-lersek@redhat.com> In-Reply-To: <1342534641-22450-1-git-send-email-lersek@redhat.com> References: <1342534641-22450-1-git-send-email-lersek@redhat.com> Subject: [Qemu-devel] [PATCH v3 15/18] convert net_init_vde() to NetClientOptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, lersek@redhat.com v1->v2: - NetdevVdeOptions::port and ::mode are of type uint16. Remove superfluous range checks. Signed-off-by: Laszlo Ersek --- net/vde.c | 17 +++++++---------- 1 files changed, 7 insertions(+), 10 deletions(-) diff --git a/net/vde.c b/net/vde.c index 8e60f68..703888c 100644 --- a/net/vde.c +++ b/net/vde.c @@ -110,20 +110,17 @@ static int net_vde_init(VLANState *vlan, const char *model, return 0; } -int net_init_vde(QemuOpts *opts, const NetClientOptions *new_opts, +int net_init_vde(QemuOpts *old_opts, const NetClientOptions *opts, const char *name, VLANState *vlan) { - const char *sock; - const char *group; - int port, mode; + const NetdevVdeOptions *vde; - sock = qemu_opt_get(opts, "sock"); - group = qemu_opt_get(opts, "group"); + assert(opts->kind == NET_CLIENT_OPTIONS_KIND_VDE); + vde = opts->vde; - port = qemu_opt_get_number(opts, "port", 0); - mode = qemu_opt_get_number(opts, "mode", 0700); - - if (net_vde_init(vlan, "vde", name, sock, port, group, mode) == -1) { + /* missing optional values have been initialized to "all bits zero" */ + if (net_vde_init(vlan, "vde", name, vde->sock, vde->port, vde->group, + vde->has_mode ? vde->mode : 0700) == -1) { return -1; } -- 1.7.1