From patchwork Tue May 22 10:45:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laszlo Ersek X-Patchwork-Id: 160612 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 61ABFB6F9F for ; Tue, 22 May 2012 21:28:20 +1000 (EST) Received: from localhost ([::1]:43410 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmbI-000827-30 for incoming@patchwork.ozlabs.org; Tue, 22 May 2012 06:46:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmaW-0006a3-93 for qemu-devel@nongnu.org; Tue, 22 May 2012 06:45:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SWmaU-0007Sj-DU for qemu-devel@nongnu.org; Tue, 22 May 2012 06:45:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SWmaU-0007SA-3F for qemu-devel@nongnu.org; Tue, 22 May 2012 06:45:10 -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 q4MAj8Kp031830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 22 May 2012 06:45:08 -0400 Received: from lacos-laptop.usersys.redhat.com (dhcp-1-169.brq.redhat.com [10.34.1.169]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q4MAim8q030413; Tue, 22 May 2012 06:45:07 -0400 From: Laszlo Ersek To: qemu-devel@nongnu.org, lersek@redhat.com Date: Tue, 22 May 2012 12:45:54 +0200 Message-Id: <1337683555-13301-16-git-send-email-lersek@redhat.com> In-Reply-To: <1337683555-13301-1-git-send-email-lersek@redhat.com> References: <1337683555-13301-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 15/16] convert net_init_bridge() 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 Signed-off-by: Laszlo Ersek Reviewed-by: Paolo Bonzini --- net/tap.c | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/net/tap.c b/net/tap.c index 7501eba..fdaab2b 100644 --- a/net/tap.c +++ b/net/tap.c @@ -512,21 +512,22 @@ static int net_bridge_run_helper(const char *helper, const char *bridge) return -1; } -int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts, +int net_init_bridge(QemuOpts *old_opts, const NetClientOptions *opts, const char *name, VLANState *vlan) { + const NetdevBridgeOptions *bridge; + const char *helper, *br; + TAPState *s; int fd, vnet_hdr; - if (!qemu_opt_get(opts, "br")) { - qemu_opt_set(opts, "br", DEFAULT_BRIDGE_INTERFACE); - } - if (!qemu_opt_get(opts, "helper")) { - qemu_opt_set(opts, "helper", DEFAULT_BRIDGE_HELPER); - } + assert(opts->kind == NET_CLIENT_OPTIONS_KIND_BRIDGE); + bridge = opts->bridge; + + helper = bridge->has_helper ? bridge->helper : DEFAULT_BRIDGE_HELPER; + br = bridge->has_br ? bridge->br : DEFAULT_BRIDGE_INTERFACE; - fd = net_bridge_run_helper(qemu_opt_get(opts, "helper"), - qemu_opt_get(opts, "br")); + fd = net_bridge_run_helper(helper, br); if (fd == -1) { return -1; } @@ -541,8 +542,8 @@ int net_init_bridge(QemuOpts *opts, const NetClientOptions *new_opts, return -1; } - snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", - qemu_opt_get(opts, "helper"), qemu_opt_get(opts, "br")); + snprintf(s->nc.info_str, sizeof(s->nc.info_str), "helper=%s,br=%s", helper, + br); return 0; }