qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH 4/8] net: tap/tap-win32: introduce info_dict


From: Luiz Capitulino
Subject: [Qemu-devel] Re: [PATCH 4/8] net: tap/tap-win32: introduce info_dict
Date: Wed, 16 Jun 2010 14:41:01 -0300

On Thu, 10 Jun 2010 18:37:01 -0300
Miguel Di Ciurcio Filho <address@hidden> wrote:

> Signed-off-by: Miguel Di Ciurcio Filho <address@hidden>
> ---
>  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 via email to

[Prev in Thread] Current Thread [Next in Thread]