Patchwork [v4,06/10] net: vde: introduce info_dict

login
register
mail settings
Submitter Miguel Di Ciurcio Filho
Date May 18, 2010, 5:07 p.m.
Message ID <1274202469-9332-7-git-send-email-miguel.filho@gmail.com>
Download mbox | patch
Permalink /patch/52897/
State New
Headers show

Comments

Miguel Di Ciurcio Filho - May 18, 2010, 5:07 p.m.
Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
---
 net/vde.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
Luiz Capitulino - May 27, 2010, 5:51 p.m.
On Tue, 18 May 2010 14:07:45 -0300
Miguel Di Ciurcio Filho <miguel.filho@gmail.com> wrote:

> Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
> ---
>  net/vde.c |   11 ++++++++++-
>  1 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/net/vde.c b/net/vde.c
> index 0b46fa6..6a3d0ba 100644
> --- a/net/vde.c
> +++ b/net/vde.c
> @@ -31,6 +31,9 @@
>  #include "qemu-char.h"
>  #include "qemu-common.h"
>  #include "qemu-option.h"
> +#include "qdict.h"
> +#include "qstring.h"
> +#include "qint.h"
>  #include "sysemu.h"
>  
>  typedef struct VDEState {
> @@ -100,7 +103,13 @@ static int net_vde_init(VLANState *vlan, const char *model,
>      nc = qemu_new_net_client(&net_vde_info, vlan, NULL, model, name);
>  
>      snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d",
> -             sock, vde_datafd(vde));
> +                sock, vde_datafd(vde));

 This change is not needed.

> +
> +
> +    nc->info_dict = qdict_new();
> +    qdict_put(nc->info_dict, "sock", qstring_from_str(sock));
> +    qdict_put(nc->info_dict, "model", qstring_from_str("vde"));
> +    qdict_put(nc->info_dict, "fd", qint_from_int(vde_datafd(vde)));
>  
>      s = DO_UPCAST(VDEState, nc, nc);
>

Patch

diff --git a/net/vde.c b/net/vde.c
index 0b46fa6..6a3d0ba 100644
--- a/net/vde.c
+++ b/net/vde.c
@@ -31,6 +31,9 @@ 
 #include "qemu-char.h"
 #include "qemu-common.h"
 #include "qemu-option.h"
+#include "qdict.h"
+#include "qstring.h"
+#include "qint.h"
 #include "sysemu.h"
 
 typedef struct VDEState {
@@ -100,7 +103,13 @@  static int net_vde_init(VLANState *vlan, const char *model,
     nc = qemu_new_net_client(&net_vde_info, vlan, NULL, model, name);
 
     snprintf(nc->info_str, sizeof(nc->info_str), "sock=%s,fd=%d",
-             sock, vde_datafd(vde));
+                sock, vde_datafd(vde));
+
+
+    nc->info_dict = qdict_new();
+    qdict_put(nc->info_dict, "sock", qstring_from_str(sock));
+    qdict_put(nc->info_dict, "model", qstring_from_str("vde"));
+    qdict_put(nc->info_dict, "fd", qint_from_int(vde_datafd(vde)));
 
     s = DO_UPCAST(VDEState, nc, nc);