From: Ian Campbell Subject: Re: [Patch v3 3/4] tools/libxl: Fix libxl__device_nic_from_xs_be() Date: Wed, 18 Dec 2013 11:11:44 +0000 Message-ID: <1387365104.27441.111.camel@kazak.uk.xensource.com> References: <52939C67.7020108@citrix.com> <1385412567-7717-1-git-send-email-andrew.cooper3@citrix.com> <21140.34516.685325.920576@mariner.uk.xensource.com> <5294892B.5030003@citrix.com> <21140.36721.61987.750679@mariner.uk.xensource.com> <5294A8F8.8090706@citrix.com> <21140.47494.337790.858352@mariner.uk.xensource.com> <5294BAFE.6070707@citrix.com> <21140.49335.578527.996113@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21140.49335.578527.996113@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Andrew Cooper , Roger Pau Monne , Xen-devel List-Id: xen-devel@lists.xenproject.org On Tue, 2013-11-26 at 15:39 +0000, Ian Jackson wrote: > 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 > > > 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: Irrespective of this I've applied your patch, since this discussion can only lead to a future, post-4.4, cleanup. > /* > * 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. Not sure how I feel about this. I suppose we are slowing getting more consistent about the use of rc as a libxl error code at least. Ian.