From patchwork Thu Apr 15 14:07:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Di Ciurcio Filho X-Patchwork-Id: 50272 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id DC79BB7D4A for ; Fri, 16 Apr 2010 01:26:31 +1000 (EST) Received: from localhost ([127.0.0.1]:56098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2Qwu-0007t6-Cf for incoming@patchwork.ozlabs.org; Thu, 15 Apr 2010 11:25:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O2Ptq-0003jk-LT for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:18:34 -0400 Received: from [140.186.70.92] (port=50519 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O2Pti-0003RM-5k for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:18:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O2PiZ-0007aD-Fh for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:06:56 -0400 Received: from mail-yw0-f198.google.com ([209.85.211.198]:33867) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O2PiZ-0007Op-CI for qemu-devel@nongnu.org; Thu, 15 Apr 2010 10:06:55 -0400 Received: by mail-yw0-f198.google.com with SMTP id 36so720141ywh.4 for ; Thu, 15 Apr 2010 07:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=EvH8O+k4NReBv54o66OTT6hKJxVfzq3Im7s4rQQpNNk=; b=xzW4AF2rp4uREtmmXY362iTCA0Tl6fVG4jcfWdLdplUkAvdI5ZHZ56pfobtWdArQTn bFyPYrK/Xh7lty+pP1gI080Q+Qm1DhdLeqcT/2WMqiM3WZo1Ub04h2fcQGgchvyhQAxd TX3PTEwnspx0dEoMG+NnxN4Sa1Ez8Pzy4xHa4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=uSQhL0OuEH3UzzqKWCLYJTcDzYOkUcQdtU+0RlUWeMt39ThHRcRHa1J2Uelg0OUH9o 5PDHgsWMYh1DOqSuopOQqI3O2mQ3OgKEPvHG1eFEp0/Er10dl7BwZDplWpU2vt4qk2wZ TnGf1WvWM51saz/XqfIAh4HZQmVscKmt864l4= Received: by 10.101.2.29 with SMTP id e29mr176785ani.212.1271340406675; Thu, 15 Apr 2010 07:06:46 -0700 (PDT) Received: from localhost.localdomain (quake.ic.unicamp.br [143.106.7.51]) by mx.google.com with ESMTPS id y2sm1240378ani.4.2010.04.15.07.06.44 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 15 Apr 2010 07:06:45 -0700 (PDT) From: Miguel Di Ciurcio Filho To: qemu-devel@nongnu.org Date: Thu, 15 Apr 2010 11:07:01 -0300 Message-Id: <1271340427-12579-7-git-send-email-miguel.filho@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1271340427-12579-1-git-send-email-miguel.filho@gmail.com> References: <1271340427-12579-1-git-send-email-miguel.filho@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH v3 06/12] net: tap/tap-win32: use info_dict instead of info_str X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Miguel Di Ciurcio Filho --- net/tap-win32.c | 9 ++++++--- net/tap.c | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/net/tap-win32.c b/net/tap-win32.c index 74348da..a54cd31 100644 --- a/net/tap-win32.c +++ b/net/tap-win32.c @@ -32,6 +32,8 @@ #include "net.h" #include "sysemu.h" #include "qemu-error.h" +#include "qdict.h" +#include "qstring.h" #include #include #include @@ -688,10 +690,11 @@ static int tap_win32_init(VLANState *vlan, const char *model, nc = qemu_new_net_client(&net_tap_win32_info, vlan, NULL, model, name); - s = DO_UPCAST(TAPState, nc, nc); + nc->info_dict = qdict_new(); - snprintf(s->nc.info_str, sizeof(s->nc.info_str), - "tap: ifname=%s", ifname); + qdict_put(nc->info_dict, "ifname", qstring_from_str(ifname)); + + s = DO_UPCAST(TAPState, nc, nc); s->handle = handle; diff --git a/net/tap.c b/net/tap.c index 303d69f..8ba7eed 100644 --- a/net/tap.c +++ b/net/tap.c @@ -39,6 +39,9 @@ #include "qemu-char.h" #include "qemu-common.h" #include "qemu-error.h" +#include "qdict.h" +#include "qint.h" +#include "qstring.h" #include "net/tap-linux.h" @@ -447,18 +450,23 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan } if (qemu_opt_get(opts, "fd")) { - snprintf(s->nc.info_str, sizeof(s->nc.info_str), "fd=%d", fd); + if (s->nc.info_dict == NULL) + s->nc.info_dict = qdict_new(); + + qdict_put(s->nc.info_dict, "fd", qint_from_int(fd)); } else { const char *ifname, *script, *downscript; + if (s->nc.info_dict == NULL) + s->nc.info_dict = qdict_new(); ifname = qemu_opt_get(opts, "ifname"); script = qemu_opt_get(opts, "script"); downscript = qemu_opt_get(opts, "downscript"); - snprintf(s->nc.info_str, sizeof(s->nc.info_str), - "ifname=%s,script=%s,downscript=%s", - ifname, script, downscript); - + qdict_put(s->nc.info_dict, "ifname", qstring_from_str(ifname)); + qdict_put(s->nc.info_dict, "script", qstring_from_str(script)); + qdict_put(s->nc.info_dict, "downscript", qstring_from_str(downscript)); + if (strcmp(downscript, "no") != 0) { snprintf(s->down_script, sizeof(s->down_script), "%s", downscript); snprintf(s->down_script_arg, sizeof(s->down_script_arg), "%s", ifname);