|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v8 10/17] 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>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
Notes:
v8:
Acked
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 b9921eb885..4000f47545 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -2061,6 +2061,14 @@ static int libxl__write_stub_dmargs(libxl__gc *gc,
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);
@@ -2099,6 +2107,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) {
@@ -2430,6 +2439,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);
}
@@ -2471,6 +2481,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();
}
@@ -2690,6 +2702,7 @@ static void device_model_spawn_outcome(libxl__egc *egc,
}
out:
+ dmss_dispose(gc, dmss);
dmss->callback(egc, dmss, rc);
}
@@ -2702,6 +2715,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);
@@ -2766,6 +2781,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 |