@@ -3199,7 +3199,7 @@ void libxl__device_disk_local_initiate_detach(libxl__egc *egc,
aodev->dev = device;
aodev->callback = local_device_detach_cb;
aodev->force = 0;
- libxl__initiate_device_remove(egc, aodev);
+ libxl__initiate_device_generic_remove(egc, aodev);
return;
}
@@ -4168,7 +4168,7 @@ out:
* libxl_device_vfb_remove
* libxl_device_vfb_destroy
*/
-#define DEFINE_DEVICE_REMOVE(type, removedestroy, f) \
+#define DEFINE_DEVICE_REMOVE_EXT(type, remtype, removedestroy, f) \
int libxl_device_##type##_##removedestroy(libxl_ctx *ctx, \
uint32_t domid, libxl_device_##type *type, \
const libxl_asyncop_how *ao_how) \
@@ -4188,13 +4188,19 @@ out:
aodev->dev = device; \
aodev->callback = device_addrm_aocomplete; \
aodev->force = f; \
- libxl__initiate_device_remove(egc, aodev); \
+ libxl__initiate_device_##remtype##_remove(egc, aodev); \
\
out: \
- if (rc) return AO_CREATE_FAIL(rc); \
+ if (rc) return AO_CREATE_FAIL(rc); \
return AO_INPROGRESS; \
}
+#define DEFINE_DEVICE_REMOVE(type, removedestroy, f) \
+ DEFINE_DEVICE_REMOVE_EXT(type, generic, removedestroy, f)
+
+#define DEFINE_DEVICE_REMOVE_CUSTOM(type, removedestroy, f) \
+ DEFINE_DEVICE_REMOVE_EXT(type, type, removedestroy, f)
+
/* Define all remove/destroy functions and undef the macro */
/* disk */
@@ -4223,6 +4229,8 @@ DEFINE_DEVICE_REMOVE(vtpm, destroy, 1)
* 2. dynamically add/remove qemu chardevs via qmp messages. */
#undef DEFINE_DEVICE_REMOVE
+#undef DEFINE_DEVICE_REMOVE_CUSTOM
+#undef DEFINE_DEVICE_REMOVE_EXT
/******************************************************************************/
@@ -4427,7 +4435,7 @@ static int remove_device(libxl__egc *egc, libxl__ao *ao,
aodev->dev = dev;
aodev->action = LIBXL__DEVICE_ACTION_REMOVE;
aodev->callback = device_complete;
- libxl__initiate_device_remove(egc, aodev);
+ libxl__initiate_device_generic_remove(egc, aodev);
break;
case LIBXL__DEVICE_KIND_QDISK:
if (--dguest->num_qdisks == 0) {
@@ -676,7 +676,7 @@ void libxl__devices_destroy(libxl__egc *egc, libxl__devices_remove_state *drs)
aodev->action = LIBXL__DEVICE_ACTION_REMOVE;
aodev->dev = dev;
aodev->force = drs->force;
- libxl__initiate_device_remove(egc, aodev);
+ libxl__initiate_device_generic_remove(egc, aodev);
}
}
}
@@ -775,8 +775,8 @@ out:
return;
}
-void libxl__initiate_device_remove(libxl__egc *egc,
- libxl__ao_device *aodev)
+void libxl__initiate_device_generic_remove(libxl__egc *egc,
+ libxl__ao_device *aodev)
{
STATE_AO_GC(aodev->ao);
xs_transaction_t t = 0;
@@ -806,7 +806,7 @@ void libxl__initiate_device_remove(libxl__egc *egc,
(info.paused || info.dying || info.shutdown)) {
/*
* TODO: 4.2 Bodge due to QEMU, see comment on top of
- * libxl__initiate_device_remove in libxl_internal.h
+ * libxl__initiate_device_generic_remove in libxl_internal.h
*/
rc = libxl__ev_time_register_rel(ao, &aodev->timeout,
device_qemu_timeout,
@@ -942,7 +942,7 @@ static void device_backend_callback(libxl__egc *egc, libxl__ev_devstate *ds,
!aodev->force) {
LOG(DEBUG, "Timeout reached, initiating forced remove");
aodev->force = 1;
- libxl__initiate_device_remove(egc, aodev);
+ libxl__initiate_device_generic_remove(egc, aodev);
return;
}
@@ -2616,8 +2616,8 @@ _hidden void libxl__wait_device_connection(libxl__egc*,
*
* Once finished, aodev->callback will be executed.
*/
-_hidden void libxl__initiate_device_remove(libxl__egc *egc,
- libxl__ao_device *aodev);
+_hidden void libxl__initiate_device_generic_remove(libxl__egc *egc,
+ libxl__ao_device *aodev);
/*
* libxl__get_hotplug_script_info returns the args and env that should