[XEN,for-4.13,v3,4/7] libxl: Introduce libxl__ev_slowlock_dispose
diff mbox series

Message ID 20191118171309.1459302-5-anthony.perard@citrix.com
State New
Headers show
Series
  • Fix: libxl workaround, multiple connection to single QMP socket
Related show

Commit Message

Anthony PERARD Nov. 18, 2019, 5:13 p.m. UTC
Which allow to cancel the lock operation while it is in Active state.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
---

Notes:
    v2:
    - Renamed libxl__ev_qmplock_dispose to libxl__ev_slowlock_dispose
    - This new API was part of the patch "Introduce libxl__ev_qmplock" in v1.

 tools/libxl/libxl_internal.c | 6 ++++++
 tools/libxl/libxl_internal.h | 3 +++
 2 files changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index 9520ac36149e..b2084157e4cd 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -765,6 +765,12 @@  void libxl__ev_slowlock_unlock(libxl__gc *gc, libxl__ev_slowlock *lock)
     ev_slowlock_init_internal(lock, lock->userdata_userid);
 }
 
+void libxl__ev_slowlock_dispose(libxl__gc *gc, libxl__ev_slowlock *lock)
+{
+    libxl__ev_child_kill_deregister(lock->ao, &lock->child, SIGKILL);
+    libxl__ev_slowlock_unlock(gc, lock);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index a0f99252c39c..9b84dddd3b7d 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -393,6 +393,8 @@  struct libxl__ev_child {
  *  libxl__ev_slowlock_lock: Idle -> Active
  *    May call callback synchronously.
  *  libxl__ev_slowlock_unlock: LockAcquired/Idle -> Idle
+ *  libxl__ev_slowlock_dispose: Idle/Active/LockAcquired -> Idle
+ *    The callback will not be called anymore.
  *  callback:     When called: Active -> LockAcquired (on error: Idle)
  *    The callback is only called once.
  */
@@ -411,6 +413,7 @@  struct libxl__ev_slowlock {
 _hidden void libxl__ev_devlock_init(libxl__ev_slowlock *);
 _hidden void libxl__ev_slowlock_lock(libxl__egc *, libxl__ev_slowlock *);
 _hidden void libxl__ev_slowlock_unlock(libxl__gc *, libxl__ev_slowlock *);
+_hidden void libxl__ev_slowlock_dispose(libxl__gc *, libxl__ev_slowlock *);
 
 /*
  * QMP asynchronous calls