|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 04/13] libxl: idl: support new "c_only" type attribute
On Mon, 2011-11-28 at 16:59 +0000, Ian Jackson wrote:
> This provides for fields in libxl datatypes which are only present in
> the C version of structures. This is useful, for example, 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.
I think "internal" or "private" would be a better description than "c".
> Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> ---
> tools/libxl/gentest.py | 2 ++
> tools/libxl/libxltypes.py | 4 +++-
> 2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py
> index 05e77cc..9b2812e 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.c_only:
> + 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..dfca943 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.c_only = kwargs.setdefault('c_only', 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.c_only:
> self.json_fn = kwargs.setdefault('json_fn', self.typename +
> "_gen_json")
> else:
> self.json_fn = kwargs.setdefault('json_fn', None)
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |