From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35906) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeiqZ-0001dr-2H for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Seiq4-0003iz-CP for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27903) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Seiq4-0003iJ-3y for qemu-devel@nongnu.org; Wed, 13 Jun 2012 04:22:04 -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 q5D8M2Lo000655 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jun 2012 04:22:02 -0400 From: Laszlo Ersek Date: Wed, 13 Jun 2012 10:22:47 +0200 Message-Id: <1339575768-2557-17-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> Subject: [Qemu-devel] [PATCH v2 16/17] convert net_init_bridge() to NetClientOptions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, lersek@redhat.com Signed-off-by: Laszlo Ersek --- 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; } -- 1.7.1