From: Ian Jackson Subject: Re: [PATCH 16/19] libxl: suspend: Abolish usleeps in domain suspend wait Date: Fri, 14 Mar 2014 17:41:20 +0000 Message-ID: <21283.16192.903777.170002@mariner.uk.xensource.com> References: <1393945016-1417-1-git-send-email-ian.jackson@eu.citrix.com> <1393945016-1417-17-git-send-email-ian.jackson@eu.citrix.com> <1394730989.16364.29.camel@kazak.uk.xensource.com> <21281.63755.904249.422991@mariner.uk.xensource.com> <1394791838.16364.82.camel@kazak.uk.xensource.com> <21283.15406.21986.273382@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <21283.15406.21986.273382@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 Campbell , xen-devel@lists.xensource.com, Lai Jiangshan , Shriram Rajagopalan , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Ian Jackson writes ("Re: [PATCH 16/19] libxl: suspend: Abolish usleeps in domain suspend wait"): > Reading xenstored_core.c suggests both read and write give EINVAL. So > making xswait work for it would indeed involve special-casing @ in > libxl. I looked at how this would seem in the API and it's very simple. See below. I think I should probably add this to my series and use it in the later patch. Ian. >From 41abced84e669449a926ca38a78194a2188c7cff Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 14 Mar 2014 17:38:38 +0000 Subject: [PATCH] libxl: events: libxl__xswait* support @paths Special-case paths starting with '@' in libxl__xswait. Attempting to read these from xenstore gives EINVAL. Callers waiting for (say) @releaseDomain will be checking for some condition which can be observed other than by looking at xenstore. Signed-off-by: Ian Jackson --- tools/libxl/libxl_aoutils.c | 8 ++++++-- tools/libxl/libxl_internal.h | 2 ++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_aoutils.c b/tools/libxl/libxl_aoutils.c index 477717b..1c9eb9e 100644 --- a/tools/libxl/libxl_aoutils.c +++ b/tools/libxl/libxl_aoutils.c @@ -69,8 +69,12 @@ void xswait_xswatch_callback(libxl__egc *egc, libxl__ev_xswatch *xsw, int rc; const char *data; - rc = libxl__xs_read_checked(gc, XBT_NULL, xswa->path, &data); - if (rc) { xswait_report_error(egc, xswa, rc); return; } + if (xswa->path[0] == '@') { + data = 0; + } else { + rc = libxl__xs_read_checked(gc, XBT_NULL, xswa->path, &data); + if (rc) { xswait_report_error(egc, xswa, rc); return; } + } xswa->callback(egc, xswa, 0, data); } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 644fcee..dc3d34c 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1110,6 +1110,8 @@ typedef struct libxl__xswait_state libxl__xswait_state; * This HAS been logged. * xswait will not continue (but calling libxl__xswait_stop is OK). * + * xswait.path may start with with '@', in which case no read is done + * and the callback will always get data==0. */ typedef void libxl__xswait_callback(libxl__egc *egc, libxl__xswait_state *xswa, int rc, const char *data); -- 1.7.10.4