[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] libxl: Add dmss_init/dispose for libxl__dm_spawn_state



commit 785fb75168b5fd51aa2213f113995b73052f434e
Author:     Anthony PERARD <anthony.perard@xxxxxxxxxx>
AuthorDate: Thu Nov 22 12:09:37 2018 +0000
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Jan 11 14:57:52 2019 +0000

    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>
---
 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 @@ 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);
@@ -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 */
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.