]> xenbits.xensource.com Git - xen.git/commitdiff
libxl: convert libxl_device_vfb_add to an async operation
authorRoger Pau Monne <roger.pau@citrix.com>
Thu, 26 Jul 2012 15:47:37 +0000 (16:47 +0100)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 26 Jul 2012 15:47:37 +0000 (16:47 +0100)
Split libxl_device_vfb_add into libxl__device_vfb_add (to be used
inside already running ao's), and make libxl_device_vfb_add a stub
to call libxl__device_vfb_add.

Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/libxl.c
tools/libxl/libxl.h
tools/libxl/libxl_create.c
tools/libxl/libxl_dm.c
tools/libxl/libxl_internal.h
tools/ocaml/libs/xl/xenlight_stubs.c

index 5a2c6e19741262e51eb6c949378dd2b7db14981a..00ddc0ec80f9dc318964124b15dbdc3759795466 100644 (file)
@@ -3019,9 +3019,25 @@ static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
     return 0;
 }
 
-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how)
+{
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_vfb_add(gc, domid, vfb);
+    if (rc) {
+        LOG(ERROR, "unable to add vfb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
+int libxl__device_vfb_add(libxl__gc *gc, uint32_t domid, libxl_device_vfb *vfb)
 {
-    GC_INIT(ctx);
     flexarray_t *front;
     flexarray_t *back;
     libxl__device device;
@@ -3079,7 +3095,6 @@ out_free:
     flexarray_free(front);
     flexarray_free(back);
 out:
-    GC_FREE;
     return rc;
 }
 
index 70a1e78199b70ff0381bceddc44ac4b29e98fa18..e1a729693b8c75990ee2c46e8ad2a977133829da 100644 (file)
@@ -721,7 +721,8 @@ int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
                              const libxl_asyncop_how *ao_how);
 
 /* Framebuffer */
-int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
+int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb,
+                         const libxl_asyncop_how *ao_how);
 int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
                             libxl_device_vfb *vfb,
                             const libxl_asyncop_how *ao_how);
index a9704dee6530e79b1c4eef857091ab1304e40410..aafacd8c85c1aa2f2e3ca0f12b590a3688227b3b 100644 (file)
@@ -932,7 +932,6 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__ao_devices *aodevs,
     const uint32_t domid = dcs->guest_domid;
     libxl_domain_config *const d_config = dcs->guest_config;
     libxl__domain_build_state *const state = &dcs->build_state;
-    libxl_ctx *const ctx = CTX;
 
     if (ret) {
         LOG(ERROR, "unable to add disk devices");
@@ -976,7 +975,7 @@ static void domcreate_launch_dm(libxl__egc *egc, libxl__ao_devices *aodevs,
         libxl__device_console console;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
-            libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
+            libxl__device_vfb_add(gc, domid, &d_config->vfbs[i]);
             libxl__device_vkb_add(gc, domid, &d_config->vkbs[i]);
         }
 
index 47a812fd62c34c7f52bffd9a295ac9dd58bd171a..f2e9572bfae207ff3eb46b7534a330e044a18374 100644 (file)
@@ -902,7 +902,7 @@ static void spawn_stub_launch_dm(libxl__egc *egc,
         if (ret)
             goto out;
     }
-    ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config->vfbs[0]);
+    ret = libxl__device_vfb_add(gc, dm_domid, &dm_config->vfbs[0]);
     if (ret)
         goto out;
     ret = libxl__device_vkb_add(gc, dm_domid, &dm_config->vkbs[0]);
index b617df04829fa514d41d221a6db30b6a4a246c21..cfb35ab4a93b0b9c1f5c6391d34abf1bf6fceda9 100644 (file)
@@ -1953,6 +1953,10 @@ _hidden void libxl__device_nic_add(libxl__egc *egc, uint32_t domid,
 _hidden int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
                                   libxl_device_vkb *vkb);
 
+/* Internal function to connect a vfb device */
+_hidden int libxl__device_vfb_add(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vfb *vfb);
+
 /* Waits for the passed device to reach state XenbusStateInitWait.
  * This is not really useful by itself, but is important when executing
  * hotplug scripts, since we need to be sure the device is in the correct
index 3d2493bfc01621492ea41c0caeec2fd0f5cebaa1..adda67f54f0cc0a0ba93457ab390ff656f5403cd 100644 (file)
@@ -369,7 +369,7 @@ value stub_xl_device_vfb_add(value info, value domid)
        device_vfb_val(&gc, &lg, &c_info, info);
 
        INIT_CTX();
-       ret = libxl_device_vfb_add(ctx, Int_val(domid), &c_info);
+       ret = libxl_device_vfb_add(ctx, Int_val(domid), &c_info, 0);
        if (ret != 0)
                failwith_xl("vfb_add", &lg);
        FREE_CTX();