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

[Xen-devel] [PATCH v3 5/7] libxl: add disk specific remove functions



Add a specific macro to generate libxl_device_disk_{remove/destroy}
functions that passes the hotplug_version field down to the aodev
struct.

Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxx>
---
 tools/libxl/libxl.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 32e2696..f9502a8 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3535,7 +3535,7 @@ out:
  * libxl_device_vfb_remove
  * libxl_device_vfb_destroy
  */
-#define DEFINE_DEVICE_REMOVE(type, removedestroy, f)                    \
+#define DEFINE_GENERIC_REMOVE(type, removedestroy, f, extra)            \
     int libxl_device_##type##_##removedestroy(libxl_ctx *ctx,           \
         uint32_t domid, libxl_device_##type *type,                      \
         const libxl_asyncop_how *ao_how)                                \
@@ -3555,6 +3555,7 @@ out:
         aodev->dev = device;                                            \
         aodev->callback = device_addrm_aocomplete;                      \
         aodev->force = f;                                               \
+        extra;                                                          \
         libxl__initiate_device_remove(egc, aodev);                      \
                                                                         \
     out:                                                                \
@@ -3562,11 +3563,21 @@ out:
         return AO_INPROGRESS;                                           \
     }
 
+/* Specific for disk devices, that have to set aodev->hotplug_version */
+#define DEFINE_DISK_REMOVE(type, removedestroy, f)                      \
+    DEFINE_GENERIC_REMOVE(type, removedestroy, f, {                     \
+        aodev->hotplug.version = type->hotplug_version;                 \
+        LOG(DEBUG, "hotplug version: %d", aodev->hotplug.version);      \
+    })
+
+#define DEFINE_DEVICE_REMOVE(type, removedestroy, f)                    \
+    DEFINE_GENERIC_REMOVE(type, removedestroy, f, )
+
 /* Define all remove/destroy functions and undef the macro */
 
 /* disk */
-DEFINE_DEVICE_REMOVE(disk, remove, 0)
-DEFINE_DEVICE_REMOVE(disk, destroy, 1)
+DEFINE_DISK_REMOVE(disk, remove, 0)
+DEFINE_DISK_REMOVE(disk, destroy, 1)
 
 /* nic */
 DEFINE_DEVICE_REMOVE(nic, remove, 0)
@@ -3585,7 +3596,9 @@ DEFINE_DEVICE_REMOVE(vfb, destroy, 1)
 DEFINE_DEVICE_REMOVE(vtpm, remove, 0)
 DEFINE_DEVICE_REMOVE(vtpm, destroy, 1)
 
+#undef DEFINE_DISK_REMOVE
 #undef DEFINE_DEVICE_REMOVE
+#undef DEFINE_GENERIC_REMOVE
 
 
/******************************************************************************/
 
-- 
1.7.7.5 (Apple Git-26)


_______________________________________________
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®.