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

[Xen-changelog] [xen-unstable] libxl: idl: support new "private" type attribute



# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1323712118 0
# Node ID b4365e2c25958162500c37e01eb06da4d0df5427
# Parent  3b62011ab51fede8795e4e8de643fad48d3d3567
libxl: idl: support new "private" type attribute

This provides for fields in libxl datatypes which are only present in
the C version of structures and are used only by libxl itself.  This
is useful when a libxl datatype wants to contain fields which are used
by libxl internally and which are only present in the structure to
avoid additional memory allocation inconvenience.

Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 3b62011ab51f -r b4365e2c2595 tools/libxl/gentest.py
--- a/tools/libxl/gentest.py    Mon Dec 12 17:48:38 2011 +0000
+++ b/tools/libxl/gentest.py    Mon Dec 12 17:48:38 2011 +0000
@@ -56,6 +56,8 @@
         s += "%s = rand() %% 2;\n" % v
     elif ty.typename in ["char *"]:
         s += "%s = rand_str();\n" % v
+    elif ty.private:
+        pass
     elif ty.typename in handcoded:
         raise Exception("Gen for handcoded %s" % ty.typename)
     else:
diff -r 3b62011ab51f -r b4365e2c2595 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py Mon Dec 12 17:48:38 2011 +0000
+++ b/tools/libxl/libxltypes.py Mon Dec 12 17:48:38 2011 +0000
@@ -33,6 +33,8 @@
         if self.passby not in [PASS_BY_VALUE, PASS_BY_REFERENCE]:
             raise ValueError
 
+        self.private = kwargs.setdefault('private', False)
+
         if typename is None: # Anonymous type
             self.typename = None
             self.rawname = None
@@ -50,7 +52,7 @@
 
         self.autogenerate_dispose_fn = 
kwargs.setdefault('autogenerate_dispose_fn', True)
 
-        if self.typename is not None:
+        if self.typename is not None and not self.private:
             self.json_fn = kwargs.setdefault('json_fn', self.typename + 
"_gen_json")
         else:
             self.json_fn = kwargs.setdefault('json_fn', None)
diff -r 3b62011ab51f -r b4365e2c2595 tools/python/genwrap.py
--- a/tools/python/genwrap.py   Mon Dec 12 17:48:38 2011 +0000
+++ b/tools/python/genwrap.py   Mon Dec 12 17:48:38 2011 +0000
@@ -129,6 +129,8 @@
 
     l.append('static PyGetSetDef Py%s_getset[] = {'%ty.rawname)
     for f in ty.fields:
+        if f.type.private:
+            continue
         l.append('    { .name = "%s", '%f.name)
         if ty.marshal_out():
             l.append('      .get = (getter)py_%s_%s_get, '%(ty.rawname, 
f.name))
@@ -295,9 +297,13 @@
 
 """ % tuple((' '.join(sys.argv),) + (os.path.split(decls)[-1:]),))
     for ty in types:
+        if ty.private:
+            continue
         if isinstance(ty, libxltypes.Aggregate):
             f.write('/* Attribute get/set functions for %s */\n'%ty.typename)
             for a in ty.fields:
+                if a.type.private:
+                    continue
                 if ty.marshal_out():
                     f.write(py_attrib_get(ty,a))
                 if ty.marshal_in():

_______________________________________________
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®.