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

Re: [Xen-devel] [PATCH 2/3] libxl_types.idl: use empty Struct for invalid domain type



On Thu, Apr 10, 2014 at 01:45:15PM +0100, Ian Campbell wrote:
> On Thu, 2014-04-10 at 13:43 +0100, Wei Liu wrote:
> > Using None makes gentypes.py generates a C function which generates
> > nothing. Eventually the generated JSON string is malformed.
> 
> I'd prefer to fix the generator to not do this rather than muddying the
> input description. How hard would it be?
> 

It certainly yields a patch much larger than this one-liner. The way to
fix generator is when parsing keyed-union we need to 1) get hold of the
key, 2) get its "invalid" value, 3) skip code generation if key points
to "invalid".

We don't have definition in IDL for "invalid" value yet, so we need to
add more code to get 2) working.

I only discovered this when I run testidl. There's no existing users of
the generation function in libxl, so I think this fix is quite safe.

Wei.

> Ian.
> 
> > 
> > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > ---
> >  tools/libxl/libxl_types.idl |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
> > index 612645c..25f879c 100644
> > --- a/tools/libxl/libxl_types.idl
> > +++ b/tools/libxl/libxl_types.idl
> > @@ -384,7 +384,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
> >                                        # Use host's E820 for PCI 
> > passthrough.
> >                                        ("e820_host", libxl_defbool),
> >                                        ])),
> > -                 ("invalid", None),
> > +                 ("invalid", Struct(None, [])),
> >                   ], keyvar_init_val = "LIBXL_DOMAIN_TYPE_INVALID")),
> >      ], dir=DIR_IN
> >  )
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.