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

[Xen-changelog] [xen-unstable] libxl: make libxl_device_console internal



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330604774 0
# Node ID d36443bc098c28c2649f3e494ae6f44722870261
# Parent  e5bc6847f24882143b71318e2683772f4f34251e
libxl: make libxl_device_console internal

consoles are not directly exposed to users of the library and there are no API
functions for manipluating them (only the console_exec function). Rather than
commit to a particular API now make the type internal.

When a user does come along it is much easier to add a completely new API
rather than to fix an existing broken one. It's easier to do this in a manner
which users of the library can cope with in a compatible way e.g. adding a new
API is easier to check for with ./configure.

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


diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl.c       Thu Mar 01 12:26:14 2012 +0000
@@ -2023,7 +2023,7 @@
 
 
/******************************************************************************/
 int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
-                              libxl_device_console *console,
+                              libxl__device_console *console,
                               libxl__domain_build_state *state)
 {
     flexarray_t *front;
@@ -2070,7 +2070,7 @@
     flexarray_append(front, "limit");
     flexarray_append(front, libxl__sprintf(gc, "%d", LIBXL_XENCONSOLE_LIMIT));
     flexarray_append(front, "type");
-    if (console->consback == LIBXL_CONSOLE_BACKEND_XENCONSOLED)
+    if (console->consback == LIBXL__CONSOLE_BACKEND_XENCONSOLED)
         flexarray_append(front, "xenconsoled");
     else
         flexarray_append(front, "ioemu");
diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_create.c        Thu Mar 01 12:26:14 2012 +0000
@@ -177,17 +177,16 @@
     return 0;
 }
 
-static int init_console_info(libxl_device_console *console, int dev_num)
+static int init_console_info(libxl__device_console *console, int dev_num)
 {
-    memset(console, 0x00, sizeof(libxl_device_console));
+    memset(console, 0x00, sizeof(libxl__device_console));
     console->devid = dev_num;
-    console->consback = LIBXL_CONSOLE_BACKEND_XENCONSOLED;
+    console->consback = LIBXL__CONSOLE_BACKEND_XENCONSOLED;
     console->output = strdup("pty");
-    if ( NULL == console->output )
+    if (!console->output)
         return ERROR_NOMEM;
     return 0;
 }
-
 int libxl__domain_build(libxl__gc *gc,
                         libxl_domain_build_info *info,
                         uint32_t domid,
@@ -586,14 +585,14 @@
     switch (d_config->c_info.type) {
     case LIBXL_DOMAIN_TYPE_HVM:
     {
-        libxl_device_console console;
+        libxl__device_console console;
         libxl_device_vkb vkb;
 
         ret = init_console_info(&console, 0);
         if ( ret )
             goto error_out;
         libxl__device_console_add(gc, domid, &console, &state);
-        libxl_device_console_dispose(&console);
+        libxl__device_console_dispose(&console);
 
         libxl_device_vkb_init(&vkb);
         libxl_device_vkb_add(ctx, domid, &vkb);
@@ -611,7 +610,7 @@
     case LIBXL_DOMAIN_TYPE_PV:
     {
         int need_qemu = 0;
-        libxl_device_console console;
+        libxl__device_console console;
 
         for (i = 0; i < d_config->num_vfbs; i++) {
             libxl_device_vfb_add(ctx, domid, &d_config->vfbs[i]);
@@ -627,10 +626,10 @@
                 d_config->num_disks, &d_config->disks[0]);
 
         if (need_qemu)
-             console.consback = LIBXL_CONSOLE_BACKEND_IOEMU;
+             console.consback = LIBXL__CONSOLE_BACKEND_IOEMU;
 
         libxl__device_console_add(gc, domid, &console, &state);
-        libxl_device_console_dispose(&console);
+        libxl__device_console_dispose(&console);
 
         if (need_qemu) {
             libxl__create_xenpv_qemu(gc, domid, d_config, &state, 
&dm_starting);
diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c    Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_dm.c    Thu Mar 01 12:26:14 2012 +0000
@@ -688,7 +688,7 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
-    libxl_device_console *console;
+    libxl__device_console *console;
     libxl_domain_config dm_config;
     libxl_device_vfb vfb;
     libxl_device_vkb vkb;
@@ -820,7 +820,7 @@
     if (guest_config->b_info.u.hvm.serial)
         num_console++;
 
-    console = libxl__calloc(gc, num_console, sizeof(libxl_device_console));
+    console = libxl__calloc(gc, num_console, sizeof(libxl__device_console));
     if (!console) {
         ret = ERROR_NOMEM;
         goto out_free;
@@ -828,7 +828,7 @@
 
     for (i = 0; i < num_console; i++) {
         console[i].devid = i;
-        console[i].consback = LIBXL_CONSOLE_BACKEND_IOEMU;
+        console[i].consback = LIBXL__CONSOLE_BACKEND_IOEMU;
         /* STUBDOM_CONSOLE_LOGGING (console 0) is for minios logging
          * STUBDOM_CONSOLE_SAVE (console 1) is for writing the save file
          * STUBDOM_CONSOLE_RESTORE (console 2) is for reading the save file
@@ -1092,7 +1092,7 @@
 }
 
 int libxl__need_xenpv_qemu(libxl__gc *gc,
-        int nr_consoles, libxl_device_console *consoles,
+        int nr_consoles, libxl__device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
         int nr_disks, libxl_device_disk *disks)
 {
@@ -1104,7 +1104,7 @@
     }
 
     for (i = 0; i < nr_consoles; i++) {
-        if (consoles[i].consback == LIBXL_CONSOLE_BACKEND_IOEMU) {
+        if (consoles[i].consback == LIBXL__CONSOLE_BACKEND_IOEMU) {
             ret = 1;
             goto out;
         }
diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Thu Mar 01 12:26:14 2012 +0000
@@ -661,7 +661,7 @@
                                           int *pdisk, int *ppartition);
 
 _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
-                                      libxl_device_console *console,
+                                      libxl__device_console *console,
                                       libxl__domain_build_state *state);
 
 _hidden int libxl__device_generic_add(libxl__gc *gc, libxl__device *device,
@@ -904,7 +904,7 @@
                               libxl__domain_build_state *state,
                               libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
-        int nr_consoles, libxl_device_console *consoles,
+        int nr_consoles, libxl__device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
         int nr_disks, libxl_device_disk *disks);
   /* Caller must either: pass starting_r==0, or on successful
diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl       Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_types.idl       Thu Mar 01 12:26:14 2012 +0000
@@ -42,11 +42,6 @@
     (2, "PV"),
     ])
 
-libxl_console_backend = Enumeration("console_backend", [
-    (1, "XENCONSOLED"),
-    (2, "IOEMU"),
-    ])
-
 libxl_disk_format = Enumeration("disk_format", [
     (0, "UNKNOWN"),
     (1, "QCOW"),
@@ -319,13 +314,6 @@
     ("devid", integer),
     ])
 
-libxl_device_console = Struct("device_console", [
-    ("backend_domid", libxl_domid),
-    ("devid", integer),
-    ("consback", libxl_console_backend),
-    ("output", string),
-    ])
-
 libxl_device_disk = Struct("device_disk", [
     ("backend_domid", libxl_domid),
     ("pdev_path", string),
diff -r e5bc6847f248 -r d36443bc098c tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl      Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_types_internal.idl      Thu Mar 01 12:26:14 2012 +0000
@@ -1,5 +1,7 @@
 namespace("libxl__")
 
+libxl_domid = Builtin("domid", namespace="libxl_", json_fn = 
"yajl_gen_integer")
+
 libxl__qmp_message_type = Enumeration("qmp_message_type", [
     (1, "QMP"),
     (2, "return"),
@@ -17,3 +19,15 @@
     (6, "VKBD"),
     (7, "CONSOLE"),
     ])
+
+libxl__console_backend = Enumeration("console_backend", [
+    (1, "XENCONSOLED"),
+    (2, "IOEMU"),
+    ])
+
+libxl__device_console = Struct("device_console", [
+    ("backend_domid", libxl_domid),
+    ("devid", integer),
+    ("consback", libxl__console_backend),
+    ("output", string),
+    ])

_______________________________________________
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®.