qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Capitulino <lcapitulino@redhat.com>
To: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Cc: avi@redhat.com, qemu-devel@nongnu.org, armbru@redhat.com
Subject: [Qemu-devel] Re: [PATCH 4/8] net: tap/tap-win32: introduce info_dict
Date: Wed, 16 Jun 2010 14:41:01 -0300	[thread overview]
Message-ID: <20100616144101.3ee343d4@redhat.com> (raw)
In-Reply-To: <1276205825-1922-5-git-send-email-miguel.filho@gmail.com>

On Thu, 10 Jun 2010 18:37:01 -0300
Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:

> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
> ---
>  net/tap-win32.c |    6 ++++++
>  net/tap.c       |   20 ++++++++++++++++++++
>  2 files changed, 26 insertions(+), 0 deletions(-)
> 
> diff --git a/net/tap-win32.c b/net/tap-win32.c
> index 74348da..3833592 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 <stdio.h>
>  #include <windows.h>
>  #include <winioctl.h>
> @@ -693,6 +695,10 @@ static int tap_win32_init(VLANState *vlan, const char *model,
>      snprintf(s->nc.info_str, sizeof(s->nc.info_str),
>               "tap: ifname=%s", ifname);
>  
> +    nc->info_dict = qdict_new()
> +
> +    qdict_put(nc->info_dict, "ifname", qstring_from_str(ifname));
> +
>      s->handle = handle;
>  
>      qemu_add_wait_object(s->handle->tap_semaphore, tap_win32_send, s);
> diff --git a/net/tap.c b/net/tap.c
> index 0147dab..30ed3da 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 "qjson.h"
> +#include "qint.h"
> +#include "qbool.h"
>  
>  #include "net/tap-linux.h"
>  
> @@ -448,8 +451,13 @@ 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);
> +        assert(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;
> +        QObject *obj;
>  
>          ifname     = qemu_opt_get(opts, "ifname");
>          script     = qemu_opt_get(opts, "script");
> @@ -459,10 +467,19 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan
>                   "ifname=%s,script=%s,downscript=%s",
>                   ifname, script, downscript);
>  
> +        obj = qobject_from_jsonf("{ 'ifname': %s, \
> +            'script': %s,'downscript': %s }",
> +            ifname, script, downscript);
> +
> +        assert(s->nc.info_dict == NULL);
> +        s->nc.info_dict = qobject_to_qdict(obj);
> +
>          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);
>          }
> +
> +

 New lines?

>      }
>  
>      if (qemu_opt_get_bool(opts, "vhost", !!qemu_opt_get(opts, "vhostfd"))) {
> @@ -481,6 +498,9 @@ int net_init_tap(QemuOpts *opts, Monitor *mon, const char *name, VLANState *vlan
>              error_report("vhost-net requested but could not be initialized");
>              return -1;
>          }
> +        qdict_put(s->nc.info_dict, "vhost", qbool_from_int(1));
> +        qdict_put(s->nc.info_dict, "vhostfd", qint_from_int(vhostfd));
> +
>      } else if (qemu_opt_get(opts, "vhostfd")) {
>          error_report("vhostfd= is not valid without vhost");
>          return -1;

  reply	other threads:[~2010-06-16 17:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-10 21:36 [Qemu-devel] [PATCH 0/8] QMP: Introduce query-netdev Miguel Di Ciurcio Filho
2010-06-10 21:36 ` [Qemu-devel] [PATCH 1/8] QObject API: introduce qdict_to_qstring() function Miguel Di Ciurcio Filho
2010-06-10 21:36 ` [Qemu-devel] [PATCH 2/8] QMP: Introduce the documentation for query-netdev and info netdev Miguel Di Ciurcio Filho
2010-06-11 11:37   ` Markus Armbruster
2010-06-11 11:47     ` Miguel Di Ciurcio Filho
2010-06-16 17:39   ` [Qemu-devel] " Luiz Capitulino
2010-06-16 21:55     ` Miguel Di Ciurcio Filho
2010-06-10 21:37 ` [Qemu-devel] [PATCH 3/8] net: Introduce VLANClientState->info_dict Miguel Di Ciurcio Filho
2010-06-16 17:40   ` [Qemu-devel] " Luiz Capitulino
2010-06-10 21:37 ` [Qemu-devel] [PATCH 4/8] net: tap/tap-win32: introduce info_dict Miguel Di Ciurcio Filho
2010-06-16 17:41   ` Luiz Capitulino [this message]
2010-06-10 21:37 ` [Qemu-devel] [PATCH 5/8] net: vde: " Miguel Di Ciurcio Filho
2010-06-10 21:37 ` [Qemu-devel] [PATCH 6/8] net: socket: " Miguel Di Ciurcio Filho
2010-06-10 21:37 ` [Qemu-devel] [PATCH 7/8] net: slirp: " Miguel Di Ciurcio Filho
2010-06-10 21:37 ` [Qemu-devel] [PATCH 8/8] monitor/net: introduce 'info netdev' with QMP support Miguel Di Ciurcio Filho
2010-06-16 17:44 ` [Qemu-devel] Re: [PATCH 0/8] QMP: Introduce query-netdev Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100616144101.3ee343d4@redhat.com \
    --to=lcapitulino@redhat.com \
    --cc=armbru@redhat.com \
    --cc=avi@redhat.com \
    --cc=miguel.filho@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).