[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH for-4.5 v21 02/14] libxl: multidev: Expose libxl__multidev_one_callback



From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>

Now a caller who wants to be able to do other work when the aodev
completes can put their own callback into the aodev, and make the
multidev machinery aware that the particular aodev is complete (from
the point of view that multidev should have) whenever it likes.

No functional change in this patch.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_device.c   |  8 +++-----
 tools/libxl/libxl_internal.h | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 3425446..1f6514c 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -479,15 +479,13 @@ void libxl__multidev_begin(libxl__ao *ao, libxl__multidev 
*multidev)
     multidev->preparation = libxl__multidev_prepare(multidev);
 }
 
-static void multidev_one_callback(libxl__egc *egc, libxl__ao_device *aodev);
-
 libxl__ao_device *libxl__multidev_prepare(libxl__multidev *multidev) {
     STATE_AO_GC(multidev->ao);
     libxl__ao_device *aodev;
 
     GCNEW(aodev);
     aodev->multidev = multidev;
-    aodev->callback = multidev_one_callback;
+    aodev->callback = libxl__multidev_one_callback;
     libxl__prepare_ao_device(ao, aodev);
 
     if (multidev->used >= multidev->allocd) {
@@ -499,7 +497,7 @@ libxl__ao_device *libxl__multidev_prepare(libxl__multidev 
*multidev) {
     return aodev;
 }
 
-static void multidev_one_callback(libxl__egc *egc, libxl__ao_device *aodev)
+void libxl__multidev_one_callback(libxl__egc *egc, libxl__ao_device *aodev)
 {
     STATE_AO_GC(aodev->ao);
     libxl__multidev *multidev = aodev->multidev;
@@ -523,7 +521,7 @@ void libxl__multidev_prepared(libxl__egc *egc,
                               libxl__multidev *multidev, int rc)
 {
     multidev->preparation->rc = rc;
-    multidev_one_callback(egc, multidev->preparation);
+    libxl__multidev_one_callback(egc, multidev->preparation);
 }
 
 
/******************************************************************************/
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 20aca4b..b19374e 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -2161,7 +2161,8 @@ struct libxl__ao_device {
  * Then zero or more times
  *    libxl__multidev_prepare
  *    libxl__initiate_device_{remove/addition}
- *       (or some other thing which will eventually call aodev->callback)
+ *       (or some other thing which will eventually call
+ *        aodev->callback or libxl__multidev_one_callback)
  * Finally, once
  *    libxl__multidev_prepared
  * which will result (perhaps reentrantly) in one call to
@@ -2176,6 +2177,16 @@ _hidden void libxl__multidev_begin(libxl__ao *ao, 
libxl__multidev*);
  * had ->callback set.  The user should not mess with aodev->callback. */
 _hidden libxl__ao_device *libxl__multidev_prepare(libxl__multidev*);
 
+/* Indicates to multidev that this one device has been processed.
+ * Normally the multidev user does not need to touch this function, as
+ * multidev_prepare will name it in aodev->callback.  However, if you
+ * want to do something more complicated you can set aodev->callback
+ * yourself to something else, so long as you eventually call
+ * libxl__multidev_one_callback.
+ */
+_hidden void libxl__multidev_one_callback(libxl__egc *egc,
+                                          libxl__ao_device *aodev);
+
 /* Notifies the multidev machinery that we have now finished preparing
  * and initiating devices.  multidev->callback may then be called as
  * soon as there are no prepared but not completed operations
-- 
1.9.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.