From patchwork Thu Apr 8 20:16:37 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: 49764 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 826C5B7080 for ; Fri, 9 Apr 2010 06:54:29 +1000 (EST) Received: from localhost ([127.0.0.1]:35817 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nzyjf-0000Ik-Dx for incoming@patchwork.ozlabs.org; Thu, 08 Apr 2010 16:53:59 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nzy8D-0008L4-KH for qemu-devel@nongnu.org; Thu, 08 Apr 2010 16:15:18 -0400 Received: from [140.186.70.92] (port=44398 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nzy8B-0008JS-PE for qemu-devel@nongnu.org; Thu, 08 Apr 2010 16:15:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nzy88-0004EH-Mz for qemu-devel@nongnu.org; Thu, 08 Apr 2010 16:15:15 -0400 Received: from mail-qy0-f188.google.com ([209.85.221.188]:37069) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nzy88-0003y4-Jw for qemu-devel@nongnu.org; Thu, 08 Apr 2010 16:15:12 -0400 Received: by mail-qy0-f188.google.com with SMTP id 26so2709084qyk.19 for ; Thu, 08 Apr 2010 13:15:12 -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=PRHoyGMZkA5mGyEU62qlxLLcADYUNFbiO+PNtScsoi8=; b=dtHOUYhH95UrbDYFgRsKhEx+dgyVlaegLLk5JhZdw6LeLLgO4THzRIoexAQZrvbIv/ 1/zs2sr7HMldtcOJmRFGWZfXTukn8leaBBDYuHYJtgT0gQEN40e8WVnex7/4vP0eYaqU R/IO9XkyapU3TuUV+i99+hYmV2yUpr360zb6k= 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=oUv8itDX4h0OfQaRrSZOqbnQuWgpzGumfuhNHXHz8xz9KthjdJceX+53tzowcMqMih q6f3f2bld+VWmD1ciOIZ9vy9qP9/4Nfd/7lKgoWY+J+iadmb8R0QQc1D4Efdi7HUpuR2 dEcDsH9TVHmp3au2BeyANiRzZQOY2tcUsLG5w= Received: by 10.229.38.69 with SMTP id a5mr845484qce.15.1270757712447; Thu, 08 Apr 2010 13:15:12 -0700 (PDT) Received: from localhost.localdomain (quake.ic.unicamp.br [143.106.7.51]) by mx.google.com with ESMTPS id w30sm776636qce.4.2010.04.08.13.15.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 08 Apr 2010 13:15:11 -0700 (PDT) From: Miguel Di Ciurcio Filho To: qemu-devel@nongnu.org Date: Thu, 8 Apr 2010 17:16:37 -0300 Message-Id: <1270757799-31891-21-git-send-email-miguel.filho@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1270757799-31891-1-git-send-email-miguel.filho@gmail.com> References: <1270757799-31891-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 20/22] net: tap: replace qemu_format_nic_info_str by info_dict 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..8e0ad2d 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_to_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);