|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 11 of 23] libxl: make libxl_device_console internal
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1329148132 0
# Node ID b2934eb211360cdc6f996940410fd82d435ca059
# Parent a72b3dca661fd1a0b40d8252d56017355afe3b38
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.
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r a72b3dca661f -r b2934eb21136 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl.c Mon Feb 13 15:48:52 2012 +0000
@@ -2022,7 +2022,7 @@ int libxl_device_nic_getinfo(libxl_ctx *
/******************************************************************************/
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;
@@ -2069,7 +2069,7 @@ int libxl__device_console_add(libxl__gc
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 a72b3dca661f -r b2934eb21136 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_create.c Mon Feb 13 15:48:52 2012 +0000
@@ -176,17 +176,16 @@ int libxl__domain_build_info_setdefault(
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,
@@ -585,14 +584,14 @@ static int do_domain_create(libxl__gc *g
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);
@@ -610,7 +609,7 @@ static int do_domain_create(libxl__gc *g
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]);
@@ -626,10 +625,10 @@ static int do_domain_create(libxl__gc *g
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 a72b3dca661f -r b2934eb21136 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_dm.c Mon Feb 13 15:48:52 2012 +0000
@@ -682,7 +682,7 @@ static int libxl__create_stubdom(libxl__
{
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;
@@ -814,7 +814,7 @@ retry_transaction:
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;
@@ -822,7 +822,7 @@ retry_transaction:
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
@@ -1084,7 +1084,7 @@ out:
}
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)
{
@@ -1096,7 +1096,7 @@ int libxl__need_xenpv_qemu(libxl__gc *gc
}
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 a72b3dca661f -r b2934eb21136 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_internal.h Mon Feb 13 15:48:52 2012 +0000
@@ -661,7 +661,7 @@ _hidden int libxl__device_disk_dev_numbe
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 @@ _hidden int libxl__create_xenpv_qemu(lib
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 a72b3dca661f -r b2934eb21136 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_types.idl Mon Feb 13 15:48:52 2012 +0000
@@ -42,11 +42,6 @@ libxl_console_type = Enumeration("consol
(2, "PV"),
])
-libxl_console_backend = Enumeration("console_backend", [
- (1, "XENCONSOLED"),
- (2, "IOEMU"),
- ])
-
libxl_disk_format = Enumeration("disk_format", [
(0, "UNKNOWN"),
(1, "QCOW"),
@@ -295,13 +290,6 @@ libxl_device_vkb = Struct("device_vkb",
("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 a72b3dca661f -r b2934eb21136 tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl Mon Feb 13 15:48:52 2012 +0000
+++ b/tools/libxl/libxl_types_internal.idl Mon Feb 13 15:48:52 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 @@ libxl__device_kind = Enumeration("device
(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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |