Patchwork [v4,08/10] net: slirp: introduce info_dict

login
register
mail settings
Submitter Miguel Di Ciurcio Filho
Date May 18, 2010, 5:07 p.m.
Message ID <1274202469-9332-9-git-send-email-miguel.filho@gmail.com>
Download mbox | patch
Permalink /patch/52895/
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/slirp.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/net/slirp.c b/net/slirp.c
index b41c60a..a6e25ff 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -32,6 +32,9 @@ 
 #include "monitor.h"
 #include "sysemu.h"
 #include "qemu_socket.h"
+#include "qdict.h"
+#include "qbool.h"
+#include "qstring.h"
 #include "slirp/libslirp.h"
 
 static int get_str_sep(char *buf, int buf_size, const char **pp, int sep)
@@ -241,7 +244,12 @@  static int net_slirp_init(VLANState *vlan, const char *model,
     nc = qemu_new_net_client(&net_slirp_info, vlan, NULL, model, name);
 
     snprintf(nc->info_str, sizeof(nc->info_str),
-             "net=%s, restricted=%c", inet_ntoa(net), restricted ? 'y' : 'n');
+            "net=%s, restricted=%c", inet_ntoa(net), restricted ? 'y' : 'n');
+
+    nc->info_dict = qdict_new();
+    qdict_put(nc->info_dict, "net", qstring_from_str(inet_ntoa(net)));
+    qdict_put(nc->info_dict, "model", qstring_from_str("slirp"));
+    qdict_put(nc->info_dict, "restricted", qbool_from_int(restricted));
 
     s = DO_UPCAST(SlirpState, nc, nc);