WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: convert VKB handling to device API

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: convert VKB handling to device API
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 01 Nov 2011 23:55:20 +0000
Delivery-date: Tue, 01 Nov 2011 16:59:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1318941403 -3600
# Node ID 175b7e156bcb64aa22f7461659a2f9058687799e
# Parent  97a2a4c27d2335b9be435f982025d2a9562b9b89
libxl: convert VKB handling to device API

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c       Tue Oct 18 13:36:43 2011 +0100
@@ -1586,10 +1586,24 @@
 }
 
 
/******************************************************************************/
-void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num)
+int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb)
 {
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
-    vkb->devid = dev_num;
+    return 0;
+}
+
+static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vkb *vkb,
+                                  libxl__device *device)
+{
+    device->backend_devid = vkb->devid;
+    device->backend_domid = vkb->backend_domid;
+    device->backend_kind = LIBXL__DEVICE_KIND_VKBD;
+    device->devid = vkb->devid;
+    device->domid = domid;
+    device->kind = LIBXL__DEVICE_KIND_VKBD;
+
+    return 0;
 }
 
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
@@ -1611,12 +1625,8 @@
         goto out_free;
     }
 
-    device.backend_devid = vkb->devid;
-    device.backend_domid = vkb->backend_domid;
-    device.backend_kind = LIBXL__DEVICE_KIND_VKBD;
-    device.devid = vkb->devid;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_VKBD;
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out_free;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
@@ -1644,14 +1654,36 @@
     return rc;
 }
 
-int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid)
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vkb *vkb)
 {
-    return ERROR_NI;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_remove(&gc, &device, 1);
+out:
+    libxl__free_all(&gc);
+    return rc;
 }
 
-int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid)
+int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_device_vkb *vkb)
 {
-    return ERROR_NI;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_destroy(&gc, &device);
+out:
+    libxl__free_all(&gc);
+    return rc;
 }
 
 static void libxl__device_disk_from_xs_be(libxl__gc *gc,
@@ -1939,16 +1971,6 @@
     return rc;
 }
 
-int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid)
-{
-    return ERROR_NI;
-}
-
-int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid)
-{
-    return ERROR_NI;
-}
-
 
/******************************************************************************/
 
 int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.h       Tue Oct 18 13:36:43 2011 +0100
@@ -473,10 +473,11 @@
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
-void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num);
+/* Keyboard */
+int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb);
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
-int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
-int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid);
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
+int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb 
*vkb);
 
 void libxl_device_vfb_init(libxl_device_vfb *vfb, int dev_num);
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb 
*vfb);
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Oct 18 13:36:43 2011 +0100
@@ -857,7 +857,8 @@
 
             d_config->vkbs = (libxl_device_vkb *) realloc(d_config->vkbs, 
sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1));
             vkb = d_config->vkbs + d_config->num_vkbs;
-            libxl_device_vkb_init(vkb, d_config->num_vkbs);
+            libxl_device_vkb_init(ctx, vkb);
+            vkb->devid = d_config->num_vkbs;
 
             p = strtok(buf2, ",");
             if (!p)
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py    Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py    Tue Oct 18 13:36:43 2011 +0100
@@ -26,10 +26,7 @@
                         ("clean_shutdown", ["domid", "unit"]),
                         ("hard_shutdown",  ["domid", "unit"]),
                       ],
-    "device_vkb":     [ ("add",            ["t", "domid", "unit"]),
-                        ("clean_shutdown", ["domid", "unit"]),
-                        ("hard_shutdown",  ["domid", "unit"]),
-                      ],
+    "device_vkb":     DEVICE_FUNCTIONS,
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
     "device_pci":     [ ("add",            ["t", "domid", "unit"]),
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c      Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c      Tue Oct 18 13:36:43 2011 +0100
@@ -306,14 +306,17 @@
        CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vkb_clean_shutdown(value domid)
+value stub_xl_device_vkb_remove(value info, value domid)
 {
        CAMLparam1(domid);
+       libxl_device_vkb c_info;
        int ret;
        INIT_STRUCT();
 
+       device_vkb_val(&gc, &lg, &c_info, info);
+
        INIT_CTX();
-       ret = libxl_device_vkb_clean_shutdown(ctx, Int_val(domid));
+       ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info);
        if (ret != 0)
                failwith_xl("vkb_clean_shutdown", &lg);
        FREE_CTX();
@@ -321,14 +324,17 @@
        CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vkb_hard_shutdown(value domid)
+value stub_xl_device_vkb_destroy(value info, value domid)
 {
        CAMLparam1(domid);
+       libxl_device_vkb c_info;
        int ret;
        INIT_STRUCT();
 
+       device_vkb_val(&gc, &lg, &c_info, info);
+
        INIT_CTX();
-       ret = libxl_device_vkb_hard_shutdown(ctx, Int_val(domid));
+       ret = libxl_device_vkb_destroy(ctx, Int_val(domid), &c_info);
        if (ret != 0)
                failwith_xl("vkb_hard_shutdown", &lg);
        FREE_CTX();

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: convert VKB handling to device API, Xen patchbot-unstable <=