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

[Xen-changelog] [xen-unstable] libxl: convert libxl_device_vkb_add to an async operation


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Sat, 28 Jul 2012 03:00:24 +0000
  • Delivery-date: Sat, 28 Jul 2012 03:00:34 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Roger Pau Monne <roger.pau@xxxxxxxxxx>
# Date 1343317656 -3600
# Node ID 21ffb640c61ccd53784c8d4c3fbf2a453db4bb60
# Parent  112ad131dca825a87903e60a3da7c022b9805cc6
libxl: convert libxl_device_vkb_add to an async operation

Split libxl_device_vkb_add into libxl__device_vkb_add (to be used
inside already running ao's), and make libxl_device_vkb_add a stub to
call libxl__device_vkb_add.

Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---


diff -r 112ad131dca8 -r 21ffb640c61c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/libxl/libxl.c       Thu Jul 26 16:47:36 2012 +0100
@@ -2919,9 +2919,26 @@ static int libxl__device_from_vkb(libxl_
     return 0;
 }
 
-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how)
 {
-    GC_INIT(ctx);
+    AO_CREATE(ctx, domid, ao_how);
+    int rc;
+
+    rc = libxl__device_vkb_add(gc, domid, vkb);
+    if (rc) {
+        LOG(ERROR, "unable to add vkb device");
+        goto out;
+    }
+
+out:
+    libxl__ao_complete(egc, ao, rc);
+    return AO_INPROGRESS;
+}
+
+int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
+                          libxl_device_vkb *vkb)
+{
     flexarray_t *front;
     flexarray_t *back;
     libxl__device device;
@@ -2966,7 +2983,6 @@ out_free:
     flexarray_free(back);
     flexarray_free(front);
 out:
-    GC_FREE;
     return rc;
 }
 
diff -r 112ad131dca8 -r 21ffb640c61c tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/libxl/libxl.h       Thu Jul 26 16:47:36 2012 +0100
@@ -711,7 +711,8 @@ int libxl_device_nic_getinfo(libxl_ctx *
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
 /* Keyboard */
-int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
+int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb,
+                         const libxl_asyncop_how *ao_how);
 int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
                             libxl_device_vkb *vkb,
                             const libxl_asyncop_how *ao_how);
diff -r 112ad131dca8 -r 21ffb640c61c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/libxl/libxl_create.c        Thu Jul 26 16:47:36 2012 +0100
@@ -960,7 +960,7 @@ static void domcreate_launch_dm(libxl__e
         libxl__device_console_dispose(&console);
 
         libxl_device_vkb_init(&vkb);
-        libxl_device_vkb_add(ctx, domid, &vkb);
+        libxl__device_vkb_add(gc, domid, &vkb);
         libxl_device_vkb_dispose(&vkb);
 
         dcs->dmss.dm.guest_domid = domid;
@@ -977,7 +977,7 @@ static void domcreate_launch_dm(libxl__e
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
-            libxl_device_vkb_add(ctx, domid, &d_config->vkbs[i]);
+            libxl__device_vkb_add(gc, domid, &d_config->vkbs[i]);
         }
 
         ret = init_console_info(&console, 0);
diff -r 112ad131dca8 -r 21ffb640c61c tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/libxl/libxl_dm.c    Thu Jul 26 16:47:36 2012 +0100
@@ -905,7 +905,7 @@ static void spawn_stub_launch_dm(libxl__
     ret = libxl_device_vfb_add(ctx, dm_domid, &dm_config->vfbs[0]);
     if (ret)
         goto out;
-    ret = libxl_device_vkb_add(ctx, dm_domid, &dm_config->vkbs[0]);
+    ret = libxl__device_vkb_add(gc, dm_domid, &dm_config->vkbs[0]);
     if (ret)
         goto out;
 
diff -r 112ad131dca8 -r 21ffb640c61c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/libxl/libxl_internal.h      Thu Jul 26 16:47:36 2012 +0100
@@ -1949,6 +1949,10 @@ _hidden void libxl__device_nic_add(libxl
                                    libxl_device_nic *nic,
                                    libxl__ao_device *aodev);
 
+/* Internal function to connect a vkb device */
+_hidden int libxl__device_vkb_add(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vkb *vkb);
+
 /* 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
diff -r 112ad131dca8 -r 21ffb640c61c tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c      Thu Jul 26 16:47:35 2012 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c      Thu Jul 26 16:47:36 2012 +0100
@@ -315,7 +315,7 @@ value stub_xl_device_vkb_add(value info,
        device_vkb_val(&gc, &lg, &c_info, info);
 
        INIT_CTX();
-       ret = libxl_device_vkb_add(ctx, Int_val(domid), &c_info);
+       ret = libxl_device_vkb_add(ctx, Int_val(domid), &c_info, 0);
        if (ret != 0)
                failwith_xl("vkb_add", &lg);
        FREE_CTX();

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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