[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH v4 05/10] net: tap/tap-win32: introduce info_dic
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] Re: [PATCH v4 05/10] net: tap/tap-win32: introduce info_dict |
Date: |
Thu, 27 May 2010 14:50:35 -0300 |
On Tue, 18 May 2010 14:07:44 -0300
Miguel Di Ciurcio Filho <address@hidden> wrote:
> Signed-off-by: Miguel Di Ciurcio Filho <address@hidden>
> ---
> net/tap-win32.c | 9 ++++++++-
> net/tap.c | 18 +++++++++++++++++-
> 2 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/net/tap-win32.c b/net/tap-win32.c
> index 74348da..54c6725 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>
> @@ -691,7 +693,12 @@ static int tap_win32_init(VLANState *vlan, const char
> *model,
> s = DO_UPCAST(TAPState, nc, nc);
>
> snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> - "tap: ifname=%s", ifname);
> + "tap: ifname=%s", ifname);
Did you change this by accident?
> +
> + nc->info_dict = qdict_new()
> +
> + qdict_put(nc->info_dict, "ifname", qstring_from_str(ifname));
> + qdict_put(nc->info_dict, "model", qstring_from_str("tap"));
So, this is the kind of thing that deserves attention when documenting,
we need to make it clear in the doc what's each format we support, ie.
xen, tap, vde, dump, slirp and socket.
>
> s->handle = handle;
>
> diff --git a/net/tap.c b/net/tap.c
> index 0147dab..d71f312 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 "qdict.h"
> +#include "qint.h"
>
> #include "net/tap-linux.h"
>
> @@ -448,17 +451,30 @@ 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");
> downscript = qemu_opt_get(opts, "downscript");
>
> snprintf(s->nc.info_str, sizeof(s->nc.info_str),
> - "ifname=%s,script=%s,downscript=%s",
> + "ifname=%s,script=%s,downscript=%s",
Another accidental change, I think.
> ifname, script, downscript);
>
> + obj = qobject_from_jsonf("{ 'model': 'tap', '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);
- [Qemu-devel] [PATCH v4 0/10] Introduce 'info netdevices' with QMP support, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 10/10] monitor/net: introduce 'info netdevices' with QMP support, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 09/10] net: socket: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 08/10] net: slirp: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 04/10] net: xen: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 07/10] net: dump: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 06/10] net: vde: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 05/10] net: tap/tap-win32: introduce info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] Re: [PATCH v4 05/10] net: tap/tap-win32: introduce info_dict,
Luiz Capitulino <=
- [Qemu-devel] [PATCH v4 03/10] net: various devices: add qemu_format_nic_info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 02/10] net: introduce qemu_nic_format_info_dict and VLANClientState->info_dict, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] [PATCH v4 01/10] QObject API: introduce qdict_to_qstring() function, Miguel Di Ciurcio Filho, 2010/05/18
- [Qemu-devel] Re: [PATCH v4 0/10] Introduce 'info netdevices' with QMP support, Luiz Capitulino, 2010/05/27