From patchwork Wed Jun 13 08:22:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 164607 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 D67C3100848 for ; Wed, 13 Jun 2012 19:59:30 +1000 (EST) Received: from localhost ([::1]:58646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeirP-0003Bi-Of for incoming@patchwork.ozlabs.org; Wed, 13 Jun 2012 04:23:27 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeiqV-0001dU-6G for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Seiq2-0003hp-1w for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14911) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Seiq1-0003hU-Pl for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:01 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5D8M0BS024286 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jun 2012 04:22:00 -0400 Received: from lacos-laptop.usersys.redhat.com (vpn1-5-237.ams2.redhat.com [10.36.5.237]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5D8Lfms031699; Wed, 13 Jun 2012 04:21:59 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org, lersek@redhat.com Date: Wed, 13 Jun 2012 10:22:45 +0200 Message-Id: <1339575768-2557-15-git-send-email-lersek@redhat.com> In-Reply-To: <1339575768-2557-1-git-send-email-lersek@redhat.com> References: <1339575768-2557-1-git-send-email-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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 v2 14/17] 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; }