[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v7 10/14] libxl: Add dmss_init/dispose for libxl__dm_spawn_state
These two functions, dmss_init and dmss_dispose, need to be called to initialise the private parts of a libxl__dm_spawn_state (dmss) as well as dispose of them before giving back control to a caller. There are 3 functions that can start using a dmss, the classic libxl__spawn_local_dm, the one for stubdom libxl__spawn_stub_dm and libxl__spawn_qdisk_backend. But there are only 2 exit path as libxl__spawn_qdisk_backend is using libxl__spawn_local_dm functions. These two new functions are empty but will be used shortly. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- Notes: v7: new patch tools/libxl/libxl_dm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index e511f9b527..371b742b7f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -1935,6 +1935,14 @@ retry_transaction: return 0; } +static void dmss_init(libxl__dm_spawn_state *dmss) +{ +} + +static void dmss_dispose(libxl__gc *gc, libxl__dm_spawn_state *dmss) +{ +} + static void spawn_stubdom_pvqemu_cb(libxl__egc *egc, libxl__dm_spawn_state *stubdom_dmss, int rc); @@ -1973,6 +1981,7 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) libxl__domain_build_state *const stubdom_state = &sdss->dm_state; libxl__domain_build_state_init(stubdom_state); + dmss_init(&sdss->dm); if (guest_config->b_info.device_model_version != LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) { @@ -2304,6 +2313,7 @@ static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, out: libxl__domain_build_state_dispose(&sdss->dm_state); libxl__xswait_stop(gc, xswait); + dmss_dispose(gc, &sdss->dm); sdss->callback(egc, &sdss->dm, rc); } @@ -2345,6 +2355,8 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss) const char *dm; int dm_state_fd = -1; + dmss_init(dmss); + if (libxl_defbool_val(b_info->device_model_stubdomain)) { abort(); } @@ -2550,6 +2562,7 @@ static void device_model_spawn_outcome(libxl__egc *egc, } out: + dmss_dispose(gc, dmss); dmss->callback(egc, dmss, rc); } @@ -2562,6 +2575,8 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) int logfile_w, null = -1, rc; uint32_t domid = dmss->guest_domid; + dmss_init(dmss); + /* Always use qemu-xen as device model */ dm = qemu_xen_path(gc); @@ -2626,6 +2641,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss) rc = 0; out: + dmss_dispose(gc, dmss); if (logfile_w >= 0) close(logfile_w); if (null >= 0) close(null); /* callback on error only, success goes via dmss->spawn.*_cb */ -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |