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

Re: [Xen-devel] [PATCH V4 09/24] libxl_json: introduce parser functions for builtin types



On Mon, 2014-05-12 at 17:43 +0100, Wei Liu wrote:
> On Tue, May 06, 2014 at 04:42:20PM +0100, Wei Liu wrote:
> [...]
> > +
> > +int libxl__uint64_parse_json(libxl__gc *gc, const libxl__json_object *o,
> > +                             void *p)
> > +{
> > +    if (!libxl__json_object_is_integer(o) &&
> > +        !libxl__json_object_is_number(o))
> > +        return ERROR_FAIL;
> > +
> > +    if (libxl__json_object_is_integer(o)) {
> > +        long long i = libxl__json_object_get_integer(o);
> > +
> > +        if (i < 0)
> > +            return ERROR_FAIL;
> > +
> 
> Just found out that current API will generate -1 for some fields (say,
> video_memkb), so we have to loosen this check.

Is -1 the flag for "default" in these cases?

I wonder -- should we omit fields which are set to default from the json
altogether rather than encode them as some specific value? (the actual
value is notionally somewhat libxl internal). This would be a case of
comparing them against their IDL init_val in the gen_json function I
think.

Thoughts?

Ian.


_______________________________________________
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®.