|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [Patch v3 3/4] tools/libxl: Fix libxl__device_nic_from_xs_be()
Andrew Cooper writes ("Re: [Xen-devel] [Patch v3 3/4] tools/libxl: Fix
libxl__device_nic_from_xs_be()"):
> On 26/11/13 15:08, Ian Jackson wrote:
> > From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
> > Date: Tue, 26 Nov 2013 12:08:09 +0000
> > Subject: [PATCH] libxl: Fix error handling in libxl__device_nic_from_xs_be
...
> > Introduce here a READ_BACKEND macro to make the code less repetitive.
I was thinking about READ_BACKEND and wondered whether we should have
something like this in libxl_internal.h:
/*
* const char *XSREADF_OR_RCOUT(libxl__gc*, const char *format, ...);
*
* Reads the xenstore key at sprintf(format, ...).
* On success returns the string (from the gc tgc), or NULL for ENOENT.
* On other errors, logs, sets rc, and does "goto out".
*
* Expects in its scope:
* libxl__gc *gc; // for the sprintf
* int rc; // trashed
* out: // used on error only; jumped to with rc set
*/
#define XSREADF_OR_RCOUT(tgc, format, ...) ({ \
const char *xsreadf_tmp; \
rc = libxl__xs_read_checked((tgc), XBT_NULL, \
GCSPRINTF((format), __VA_ARGS__), \
&xsreadf_tmp); \
if (rc) goto out; \
xsreadf_tmp; \
)}
We don't presently have anywhere in libxl_internal.h that assumes the
existence of "out" and "rc" in their scope.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |