libxl: events: libxl__xswait* support @paths
authorIan Jackson <ian.jackson@eu.citrix.com>
Fri, 14 Mar 2014 17:38:38 +0000 (17:38 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 17 Mar 2014 15:53:59 +0000 (15:53 +0000)
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 <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v3: New patch in this version of the series.

tools/libxl/libxl_aoutils.c
tools/libxl/libxl_internal.h

index 477717bae7d2b582259a981fbe601c4a8d8243d6..1c9eb9e7c0897fa74fc5216ce4890601f0e9f8dc 100644 (file)
@@ -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);
 }
index a208be720e2b5c1cf57ad74c23ad0f2cb87e5e1e..a82a43d92006374ec12b95b447b949adb7db83a1 100644 (file)
@@ -1130,6 +1130,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);