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

[Xen-changelog] [xen-unstable] Serialize string string maps.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1175795224 -3600
# Node ID a00c629f67be6e42468dc08b6e35904641462e8a
# Parent  67f4f21f76e9d36e91d194c8edc55f3623b87139
Serialize string string maps.

Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/libxen/src/xen_common.c |   45 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+)

diff -r 67f4f21f76e9 -r a00c629f67be tools/libxen/src/xen_common.c
--- a/tools/libxen/src/xen_common.c     Thu Apr 05 18:12:35 2007 +0100
+++ b/tools/libxen/src/xen_common.c     Thu Apr 05 18:47:04 2007 +0100
@@ -102,6 +102,9 @@ add_struct_value(const struct abstract_t
                           const char *),
                  const char *, xmlNode *);
 
+static xmlNode *
+add_container(xmlNode *parent, const char *name);
+
 static void
 call_raw(xen_session *, const char *, abstract_value [], int,
          const abstract_type *, void *);
@@ -1290,6 +1293,48 @@ make_body_add_type(enum abstract_typenam
     }
     break;
 
+    case MAP:
+    {
+        const struct struct_member *member = v->type->members;
+        arbitrary_map *map_val = v->u.struct_val;
+        xmlNode *param_node = add_param_struct(params_node);
+        for (size_t i = 0; i < map_val->size; i++) {
+            enum abstract_typename typename_key = member[0].type->typename;
+            enum abstract_typename typename_val = member[1].type->typename;
+            int offset_key = member[0].offset;
+            int offset_val = member[1].offset;
+            int struct_size = v->type->struct_size;
+
+            switch (typename_key) {
+            case STRING: {
+                char **addr = (void *)(map_val + 1) +
+                             (i * struct_size) +
+                             offset_key;
+                char *key = *addr;
+
+                switch (typename_val) {
+                case STRING: {
+                    char *val;
+                    addr = (void *)(map_val + 1) +
+                           (i * struct_size) +
+                           offset_val;
+                    val = *addr;
+                    add_struct_member(param_node, key, "string", val);
+                    break;
+                }
+                default:
+                    assert(false);
+                }
+                break;
+            }
+            default:
+                assert(false);
+            }
+        }
+    }
+    break;
+
+
     default:
         assert(false);
     }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.