From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli 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 Message-ID: <1337356154.16815.37.camel@Solace> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============5784835725534265528==" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: ian.jackson@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org --===============5784835725534265528== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-RONVedtSIkeCDFDlNdyY" --=-RONVedtSIkeCDFDlNdyY Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 2012-04-04 at 11:36 +0100, Ian Campbell wrote: > # HG changeset patch > # User Ian Campbell > # Date 1333535720 -3600 > # Node ID dc3241cf1ed1b8e5709cc71c9ec8a93b2374cbd5 > # Parent ac6f863df8f8c86dcc58df15f94333e6088e0bf4 > RFC: libxl: move definition of libxl_domain_config into the IDL >=20 > This requires adding a new Array type to the IDL. >=20 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 >=20 Tested-by: Dario Faggioli > 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 =3D > s +=3D libxl_C_type_dispose(f.type, fexpr, indent + " ", = nparent) > s +=3D " break;\n" > s +=3D "}\n" > + elif isinstance(ty, idl.Array): > + if parent is None: > + raise Exception("Array type must have a parent") > + s +=3D "{\n" > + s +=3D " int i;\n" > + s +=3D " for (i=3D0; i<%s; i++)\n" % (parent + ty.lenvar.name= ) > + s +=3D libxl_C_type_dispose(ty.elem_type, v+"[i]", > + indent + " ", parent) > + if ty.dispose_fn is not None: > + s +=3D " %s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, pare= nt is None)) > + s +=3D "}\n" > if ty.elem_type.dispose_fn is not None: s +=3D " int i;\n" s +=3D " for (i=3D0; i<%s; i++)\n" % (parent + ty.lenvar.nam= e) s +=3D 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=3D0; inum_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 =3D Builtin("char *", namespace =3D N > json_fn =3D "libxl__string_gen_json", > autogenerate_json =3D False) > =20 > +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=3Delem_type.rawname + " *", **kwarg= s) > Type.__init__(self, namespace=3Delem_type.namespace, typename=3Dele= m_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 --=20 <> (Raistlin Majere) ----------------------------------------------------------------- Dario Faggioli, Ph.D, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) --=-RONVedtSIkeCDFDlNdyY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEABECAAYFAk+2b3oACgkQk4XaBE3IOsQF1wCfSK972iBrlW2DxFeDH8RdLBe0 HxUAniTmtsmi60PADe64+LqQH8Kjimdi =LhgP -----END PGP SIGNATURE----- --=-RONVedtSIkeCDFDlNdyY-- --===============5784835725534265528== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --===============5784835725534265528==--