[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 04/15] libxl: idl: support new "private" type attribute
On Mon, 2011-12-05 at 18:10 +0000, Ian Jackson wrote: > 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> iff you remove the stray print sys.stderr in the last hunk. Ian. > --- > tools/libxl/gentest.py | 2 ++ > tools/libxl/libxltypes.py | 4 +++- > tools/python/genwrap.py | 7 +++++++ > 3 files changed, 12 insertions(+), 1 deletions(-) > > diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py > index 05e77cc..ac7a400 100644 > --- a/tools/libxl/gentest.py > +++ b/tools/libxl/gentest.py > @@ -56,6 +56,8 @@ def gen_rand_init(ty, v, indent = " ", parent = None): > 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 --git a/tools/libxl/libxltypes.py b/tools/libxl/libxltypes.py > index 55056c2..450de88 100644 > --- a/tools/libxl/libxltypes.py > +++ b/tools/libxl/libxltypes.py > @@ -33,6 +33,8 @@ class Type(object): > 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 @@ class Type(object): > > 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 --git a/tools/python/genwrap.py b/tools/python/genwrap.py > index d0c193d..ecbec11 100644 > --- a/tools/python/genwrap.py > +++ b/tools/python/genwrap.py > @@ -129,6 +129,8 @@ static PyObject *Py%(rawname)s_new(PyTypeObject *type, > PyObject *args, PyObject > > 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,14 @@ _hidden int genwrap__ll_set(PyObject *v, long long *val, > long long mask); > > """ % 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: > + print >>sys.stderr, `a`, `ty`, `a.type`, `a.type.__dict__` > + if a.type.private: > + continue > if ty.marshal_out(): > f.write(py_attrib_get(ty,a)) > if ty.marshal_in(): _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |