* [PATCH] libxl_create: Re-order callbacks of initiate_domain_create
@ 2018-12-12 14:53 Anthony PERARD
2019-01-02 14:15 ` Wei Liu
0 siblings, 1 reply; 2+ messages in thread
From: Anthony PERARD @ 2018-12-12 14:53 UTC (permalink / raw)
To: xen-devel; +Cc: Anthony PERARD, Wei Liu, Ian Jackson
Callbacks should be in the order that there are going to be executed.
This patch fix the initiate_domain_create callbacks, and also reorder
the callbacks prototytes. That way, it's easier to follow the flow.
This patch:
- move libxl__colo_restore_setup_done after domcreate_bootloader_done.
- move domcreate_attach_devices after domcreate_devmodel_started.
No functional change.
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
---
tools/libxl/libxl_create.c | 123 +++++++++++++++++++------------------
1 file changed, 63 insertions(+), 60 deletions(-)
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index fa573344bc..891175b15b 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -771,28 +771,31 @@ static int store_libxl_entry(libxl__gc *gc, uint32_t domid,
*/
/* Event callbacks, in this order: */
-static void domcreate_devmodel_started(libxl__egc *egc,
- libxl__dm_spawn_state *dmss,
- int rc);
static void domcreate_bootloader_console_available(libxl__egc *egc,
libxl__bootloader_state *bl);
-static void domcreate_bootloader_done(libxl__egc *egc,
- libxl__bootloader_state *bl,
- int rc);
-
-static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *aodevs,
- int ret);
-
static void domcreate_console_available(libxl__egc *egc,
libxl__domain_create_state *dcs);
+static void domcreate_bootloader_done(libxl__egc *egc,
+ libxl__bootloader_state *bl,
+ int rc);
+static void libxl__colo_restore_setup_done(libxl__egc *egc,
+ libxl__colo_restore_state *crs,
+ int rc);
static void domcreate_stream_done(libxl__egc *egc,
libxl__stream_read_state *srs,
int ret);
-
static void domcreate_rebuild_done(libxl__egc *egc,
libxl__domain_create_state *dcs,
int ret);
+static void domcreate_launch_dm(libxl__egc *egc, libxl__multidev *aodevs,
+ int ret);
+static void domcreate_devmodel_started(libxl__egc *egc,
+ libxl__dm_spawn_state *dmss,
+ int rc);
+static void domcreate_attach_devices(libxl__egc *egc,
+ libxl__multidev *multidev,
+ int ret);
/* Our own function to clean up and call the user's callback.
* The final call in the sequence. */
@@ -1031,23 +1034,6 @@ static void domcreate_console_available(libxl__egc *egc,
dcs->aop_console_how.for_event));
}
-static void libxl__colo_restore_setup_done(libxl__egc *egc,
- libxl__colo_restore_state *crs,
- int rc)
-{
- libxl__domain_create_state *dcs = CONTAINER_OF(crs, *dcs, crs);
-
- EGC_GC;
-
- if (rc) {
- LOGD(ERROR, dcs->guest_domid, "colo restore setup fails: %d", rc);
- domcreate_stream_done(egc, &dcs->srs, rc);
- return;
- }
-
- libxl__stream_read_start(egc, &dcs->srs);
-}
-
static void domcreate_bootloader_done(libxl__egc *egc,
libxl__bootloader_state *bl,
int rc)
@@ -1145,6 +1131,23 @@ static void domcreate_bootloader_done(libxl__egc *egc,
domcreate_stream_done(egc, &dcs->srs, rc);
}
+static void libxl__colo_restore_setup_done(libxl__egc *egc,
+ libxl__colo_restore_state *crs,
+ int rc)
+{
+ libxl__domain_create_state *dcs = CONTAINER_OF(crs, *dcs, crs);
+
+ EGC_GC;
+
+ if (rc) {
+ LOGD(ERROR, dcs->guest_domid, "colo restore setup fails: %d", rc);
+ domcreate_stream_done(egc, &dcs->srs, rc);
+ return;
+ }
+
+ libxl__stream_read_start(egc, &dcs->srs);
+}
+
void libxl__srm_callout_callback_restore_results(xen_pfn_t store_mfn,
xen_pfn_t console_mfn, void *user)
{
@@ -1509,6 +1512,38 @@ const struct libxl_device_type *device_type_tbl[] = {
NULL
};
+static void domcreate_devmodel_started(libxl__egc *egc,
+ libxl__dm_spawn_state *dmss,
+ int ret)
+{
+ libxl__domain_create_state *dcs = CONTAINER_OF(dmss, *dcs, sdss.dm);
+ STATE_AO_GC(dmss->spawn.ao);
+ int domid = dcs->guest_domid;
+
+ /* convenience aliases */
+ libxl_domain_config *const d_config = dcs->guest_config;
+
+ if (ret) {
+ LOGD(ERROR, domid, "device model did not start: %d", ret);
+ goto error_out;
+ }
+
+ if (dcs->sdss.dm.guest_domid) {
+ if (d_config->b_info.device_model_version
+ == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+ libxl__qmp_initializations(gc, domid, d_config);
+ }
+ }
+
+ dcs->device_type_idx = -1;
+ domcreate_attach_devices(egc, &dcs->multidev, 0);
+ return;
+
+error_out:
+ assert(ret);
+ domcreate_complete(egc, dcs, ret);
+}
+
static void domcreate_attach_devices(libxl__egc *egc,
libxl__multidev *multidev,
int ret)
@@ -1552,38 +1587,6 @@ static void domcreate_attach_devices(libxl__egc *egc,
domcreate_complete(egc, dcs, ret);
}
-static void domcreate_devmodel_started(libxl__egc *egc,
- libxl__dm_spawn_state *dmss,
- int ret)
-{
- libxl__domain_create_state *dcs = CONTAINER_OF(dmss, *dcs, sdss.dm);
- STATE_AO_GC(dmss->spawn.ao);
- int domid = dcs->guest_domid;
-
- /* convenience aliases */
- libxl_domain_config *const d_config = dcs->guest_config;
-
- if (ret) {
- LOGD(ERROR, domid, "device model did not start: %d", ret);
- goto error_out;
- }
-
- if (dcs->sdss.dm.guest_domid) {
- if (d_config->b_info.device_model_version
- == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
- libxl__qmp_initializations(gc, domid, d_config);
- }
- }
-
- dcs->device_type_idx = -1;
- domcreate_attach_devices(egc, &dcs->multidev, 0);
- return;
-
-error_out:
- assert(ret);
- domcreate_complete(egc, dcs, ret);
-}
-
static void domcreate_complete(libxl__egc *egc,
libxl__domain_create_state *dcs,
int rc)
--
Anthony PERARD
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libxl_create: Re-order callbacks of initiate_domain_create
2018-12-12 14:53 [PATCH] libxl_create: Re-order callbacks of initiate_domain_create Anthony PERARD
@ 2019-01-02 14:15 ` Wei Liu
0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2019-01-02 14:15 UTC (permalink / raw)
To: Anthony PERARD; +Cc: xen-devel, Ian Jackson, Wei Liu
On Wed, Dec 12, 2018 at 02:53:46PM +0000, Anthony PERARD wrote:
> Callbacks should be in the order that there are going to be executed.
> This patch fix the initiate_domain_create callbacks, and also reorder
> the callbacks prototytes. That way, it's easier to follow the flow.
Two typos here. I will fix them while committing.
>
> This patch:
> - move libxl__colo_restore_setup_done after domcreate_bootloader_done.
> - move domcreate_attach_devices after domcreate_devmodel_started.
>
> No functional change.
>
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-01-02 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-12 14:53 [PATCH] libxl_create: Re-order callbacks of initiate_domain_create Anthony PERARD
2019-01-02 14:15 ` Wei Liu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.