From patchwork Tue Jul 17 14:17:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 171464 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 769DB2C00C2 for ; Wed, 18 Jul 2012 01:35:41 +1000 (EST) Received: from localhost ([::1]:38927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sr8aZ-0005HD-Bg for incoming@patchwork.ozlabs.org; Tue, 17 Jul 2012 10:17:23 -0400 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 Received: from lacos-laptop.usersys.redhat.com (vpn1-5-251.ams2.redhat.com [10.36.5.251]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q6HEG9KN022379; Tue, 17 Jul 2012 10:16:31 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org, lersek@redhat.com 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> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 15/18] convert net_init_vde() to NetClientOptions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list 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 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; }