From: Dario Faggioli <raistlin@linux.it>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org
Subject: Re: [PATCH 2 of 2] RFC: libxl: move definition of libxl_domain_config into the IDL
Date: Fri, 18 May 2012 17:49:14 +0200 [thread overview]
Message-ID: <1337356154.16815.37.camel@Solace> (raw)
In-Reply-To: <dc3241cf1ed1b8e5709c.1333535781@cosworth.uk.xensource.com>
[-- Attachment #1.1: Type: text/plain, Size: 3452 bytes --]
On Wed, 2012-04-04 at 11:36 +0100, Ian Campbell wrote:
> # HG changeset patch
> # User Ian Campbell <ian.campbell@citrix.com>
> # Date 1333535720 -3600
> # Node ID dc3241cf1ed1b8e5709cc71c9ec8a93b2374cbd5
> # Parent ac6f863df8f8c86dcc58df15f94333e6088e0bf4
> RFC: libxl: move definition of libxl_domain_config into the IDL
>
> This requires adding a new Array type to the IDL.
>
I've finally decided to take node distances into account for my NUMA
series for 4.2, so I'm trying to use this patch for it (just the IDL
array part, I'm leaving libxl_domain_config out... although that can of
course be included as well if we want).
Therefore, I'll include this very own patch as a part of my series
(almost ready, will post next week) with the following proposed
modifications:
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
>
Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
> diff -r ac6f863df8f8 -r dc3241cf1ed1 tools/libxl/gentypes.py
> --- a/tools/libxl/gentypes.py Wed Apr 04 10:51:11 2012 +0100
> +++ b/tools/libxl/gentypes.py Wed Apr 04 11:35:20 2012 +0100
>
> ...
>
> @@ -66,6 +70,17 @@ def libxl_C_type_dispose(ty, v, indent =
> s += libxl_C_type_dispose(f.type, fexpr, indent + " ", nparent)
> s += " break;\n"
> s += "}\n"
> + elif isinstance(ty, idl.Array):
> + if parent is None:
> + raise Exception("Array type must have a parent")
> + s += "{\n"
> + s += " int i;\n"
> + s += " for (i=0; i<%s; i++)\n" % (parent + ty.lenvar.name)
> + s += libxl_C_type_dispose(ty.elem_type, v+"[i]",
> + indent + " ", parent)
> + if ty.dispose_fn is not None:
> + s += " %s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, parent is None))
> + s += "}\n"
>
if ty.elem_type.dispose_fn is not None:
s += " int i;\n"
s += " for (i=0; i<%s; i++)\n" % (parent + ty.lenvar.name)
s += libxl_C_type_dispose(ty.elem_type, v+"[i]",
Otherwise I get something like the below, when creating an array of,
say, uint32_t-s:
int i;
for (i=0; i<p->num_dists; i++)
free(p->dists);
Instead of just the free() part, which is what I need in this case.
> diff -r ac6f863df8f8 -r dc3241cf1ed1 tools/libxl/idl.py
> --- a/tools/libxl/idl.py Wed Apr 04 10:51:11 2012 +0100
> +++ b/tools/libxl/idl.py Wed Apr 04 11:35:20 2012 +0100
> @@ -251,6 +251,17 @@ string = Builtin("char *", namespace = N
> json_fn = "libxl__string_gen_json",
> autogenerate_json = False)
>
> +class Array(Type):
> + """An array of the same type"""
> + def __init__(self, elem_type, lenvar_name, **kwargs):
> + kwargs.setdefault('dispose_fn', 'free')
> + Type.__init__(self, typename=elem_type.rawname + " *", **kwargs)
>
Type.__init__(self, namespace=elem_type.namespace, typename=elem_type.rawname + " *", **kwargs)
As suggested by you (IanC) on IRC, to avoid getting stuff like
`libxl_uint32_t' and alike.
Does that make sense?
Regards,
Dario
--
<<This happens because I choose it to happen!>> (Raistlin Majere)
-----------------------------------------------------------------
Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli
Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK)
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2012-05-18 15:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-04 10:36 [PATCH 0 of 2] libxl: add libxl_domain_config_init Ian Campbell
2012-04-04 10:36 ` [PATCH 1 of 2] libxl: provide libxl_domain_config_init Ian Campbell
2012-04-24 17:58 ` Ian Jackson
2012-04-25 8:57 ` Ian Campbell
2012-04-25 10:36 ` Ian Jackson
2012-04-04 10:36 ` [PATCH 2 of 2] RFC: libxl: move definition of libxl_domain_config into the IDL Ian Campbell
2012-04-24 17:57 ` Ian Jackson
2012-04-25 8:11 ` Ian Campbell
2012-04-25 10:25 ` Ian Jackson
2012-04-25 10:28 ` Ian Campbell
2012-05-18 15:49 ` Dario Faggioli [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1337356154.16815.37.camel@Solace \
--to=raistlin@linux.it \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.