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

Re: [Xen-devel] [PATCH] libxl: handle errors from xc_sharing_* info functions



On Wed, 2012-09-05 at 15:46 +0100, Ian Jackson wrote:
> Ian Campbell writes ("[PATCH] libxl: handle errors from xc_sharing_* info 
> functions"):
> > I don't have a 32 bit system handy, so tested on x86_64 with a libxc
> > hacked to return -ENOSYS and -EINVAL.
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
> 
> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> 
> > -    physinfo->sharing_freed_pages = xc_sharing_freed_pages(ctx->xch);
> > -    physinfo->sharing_used_frames = xc_sharing_used_frames(ctx->xch);
> > +    l = xc_sharing_freed_pages(ctx->xch);
> > +    if ( l < 0 && l != -ENOSYS ) {
> > +        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, l,
> > +                            "getting sharing freed pages");
> > +        return ERROR_FAIL;
> > +    }
> > +    physinfo->sharing_freed_pages = (l == -ENOSYS) ? 0 : l;
> 
> Although you do like doing this the convoluted way.  What would have
> been wrong with
>    if (l == -ENOSYS) {
>        l = 0;
>    } else if (l < 0) {
>        LOG...
>        return ERROR_FAIL;
>    }
> ? :-)

Nothing, just in a particular frame of mind I guess.

I'll respin with this approach, it's less mad.



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