WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Fix marshalling to and from record_opts.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Fix marshalling to and from record_opts.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 02 Nov 2006 22:09:42 +0000
Delivery-date: Thu, 02 Nov 2006 21:43:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID 5cccc3ed0b1e1207d5cb33101f8c6fa93260350b
# Parent  de00775e39dafcf1fc34166417274a24b9c4ce17
Fix marshalling to and from record_opts.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/libxen/src/xen_common.c |   42 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 38 insertions(+), 4 deletions(-)

diff -r de00775e39da -r 5cccc3ed0b1e tools/libxen/src/xen_common.c
--- a/tools/libxen/src/xen_common.c     Sat Oct 28 11:54:05 2006 +0100
+++ b/tools/libxen/src/xen_common.c     Sat Oct 28 12:00:02 2006 +0100
@@ -1,5 +1,5 @@
 /*
-  Copyright (c) 2006 XenSource, Inc.
+ *  Copyright (c) 2006 XenSource, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -14,7 +14,7 @@
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
-*/
+ */
 
 #include <assert.h>
 #include <stdarg.h>
@@ -48,11 +48,17 @@ typedef struct
 
 typedef struct
 {
+    void *handle;
+} arbitrary_record;
+
+
+typedef struct
+{
     bool is_record;
     union
     {
         char *handle;
-        void *record;
+        arbitrary_record *record;
     } u;
 } arbitrary_record_opt;
 
@@ -449,6 +455,18 @@ static void destring(xen_session *s, xml
 }
 
 
+/**
+ * result_type : STRING => value : char **, the char * is yours.
+ * result_type : ENUM   => value : int *
+ * result_type : INT    => value : uint64_t *
+ * result_type : FLOAT  => value : double *
+ * result_type : BOOL   => value : bool *
+ * result_type : SET    => value : arbitrary_set **, the set is yours.
+ * result_type : MAP    => value : arbitrary_map **, the map is yours.
+ * result_type : OPT    => value : arbitrary_record_opt **,
+ *                                 the record is yours, the handle is filled.
+ * result_type : STRUCT => value : void **, the void * is yours.
+ */
 static void parse_into(xen_session *s, xmlNode *value_node,
                        const abstract_type *result_type, void *value,
                        int slot)
@@ -809,7 +827,7 @@ static size_t size_of_member(const abstr
         return sizeof(int);
 
     case REF:
-        return sizeof(arbitrary_record_opt);
+        return sizeof(arbitrary_record_opt *);
 
     default:
         assert(false);
@@ -1100,6 +1118,22 @@ add_struct_value(const struct abstract_t
     switch (type->typename)
     {
     case REF:
+    {
+        arbitrary_record_opt *val = *(arbitrary_record_opt **)value;
+        if (val != NULL)
+        {
+            if (val->is_record)
+            {
+                adder(node, key, "string", val->u.record->handle);
+            }
+            else
+            {
+                adder(node, key, "string", val->u.handle);
+            }
+        }
+    }
+    break;
+
     case STRING:
     {
         char *val = *(char **)value;

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Fix marshalling to and from record_opts., Xen patchbot-unstable <=