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;
}
* 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) \
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 */
* 2. dynamically add/remove qemu chardevs via qmp messages. */
#undef DEFINE_DEVICE_REMOVE
+#undef DEFINE_DEVICE_REMOVE_CUSTOM
+#undef DEFINE_DEVICE_REMOVE_EXT
/******************************************************************************/
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) {
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);
}
}
}
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;
(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,
!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;
}