|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH] libxl: handle errors from xc_sharing_* info functions
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;
}
? :-)
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |