From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [Patch v3 3/4] tools/libxl: Fix libxl__device_nic_from_xs_be() Date: Mon, 9 Dec 2013 13:35:45 +0000 Message-ID: <52A5C731.10404@citrix.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: Roger Pau Monne , Ian Campbell , Xen-devel List-Id: xen-devel@lists.xenproject.org On 26/11/13 15:39, 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: > > /* > * 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. So what is happening with this? The fix in the parent email should be ok, and might be better this late in the development cycle. ~Andrew