[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: Add init/dispose of for libxl__domain_build_state
commit e3f606ca1a05a6fee5516b687ac035638eba1c2a Author: Anthony PERARD <anthony.perard@xxxxxxxxxx> AuthorDate: Thu Nov 22 18:10:45 2018 +0000 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Fri Jan 11 14:57:52 2019 +0000 libxl: Add init/dispose of for libxl__domain_build_state These two new functions libxl__domain_build_state_{init,dispose} should be called every time a new libxl__domain_build_state comes to existance. There seems to be two of them, one with the domain creation machinery, and one in the stub_dm_spawn. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/libxl_create.c | 14 ++++++++++++-- tools/libxl/libxl_dm.c | 3 +++ tools/libxl/libxl_internal.h | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index 891175b15b..4ca25f56a6 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -761,6 +761,16 @@ static int store_libxl_entry(libxl__gc *gc, uint32_t domid, libxl_device_model_version_to_string(b_info->device_model_version)); } +void libxl__domain_build_state_init(libxl__domain_build_state *state) +{ +} + +void libxl__domain_build_state_dispose(libxl__domain_build_state *state) +{ + libxl__file_reference_unmap(&state->pv_kernel); + libxl__file_reference_unmap(&state->pv_ramdisk); +} + /*----- main domain creation -----*/ /* We have a linear control flow; only one event callback is @@ -823,6 +833,7 @@ static void initiate_domain_create(libxl__egc *egc, const int restore_fd = dcs->restore_fd; domid = dcs->domid_soft_reset; + libxl__domain_build_state_init(&dcs->build_state); if (d_config->c_info.ssid_label) { char *s = d_config->c_info.ssid_label; @@ -1595,8 +1606,7 @@ static void domcreate_complete(libxl__egc *egc, libxl_domain_config *const d_config = dcs->guest_config; libxl_domain_config *d_config_saved = &dcs->guest_config_saved; - libxl__file_reference_unmap(&dcs->build_state.pv_kernel); - libxl__file_reference_unmap(&dcs->build_state.pv_ramdisk); + libxl__domain_build_state_dispose(&dcs->build_state); if (!rc && d_config->b_info.exec_ssidref) rc = xc_flask_relabel_domain(CTX->xch, dcs->guest_domid, d_config->b_info.exec_ssidref); diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index be493cf9f2..200310083f 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -2045,6 +2045,8 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss) libxl__domain_build_state *const d_state = sdss->dm.build_state; libxl__domain_build_state *const stubdom_state = &sdss->dm_state; + libxl__domain_build_state_init(stubdom_state); + if (guest_config->b_info.device_model_version != LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) { ret = ERROR_INVAL; @@ -2373,6 +2375,7 @@ static void stubdom_xswait_cb(libxl__egc *egc, libxl__xswait_state *xswait, if (strcmp(p, "running")) return; out: + libxl__domain_build_state_dispose(&sdss->dm_state); libxl__xswait_stop(gc, xswait); sdss->callback(egc, &sdss->dm, rc); } diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4fdc626d9c..3d12748cbb 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1265,6 +1265,9 @@ typedef struct { uint32_t clock_frequency; } libxl__domain_build_state; +_hidden void libxl__domain_build_state_init(libxl__domain_build_state *s); +_hidden void libxl__domain_build_state_dispose(libxl__domain_build_state *s); + _hidden int libxl__build_pre(libxl__gc *gc, uint32_t domid, libxl_domain_config * const d_config, libxl__domain_build_state *state); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |