diff options
author | Ian Campbell <ian.campbell@citrix.com> | 2012-03-01 12:26:14 +0000 |
---|---|---|
committer | Ian Campbell <ian.campbell@citrix.com> | 2012-03-01 12:26:14 +0000 |
commit | ffa165bb9fb29adf4063fd950e07b91611892c63 (patch) | |
tree | 2d67bc4915a592fdd39d37513fcd9fc439f09096 /tools | |
parent | 31278f685071b4873a869a7dc4e8d76b6ea94a70 (diff) | |
download | xen-ffa165bb9fb29adf4063fd950e07b91611892c63.tar.gz xen-ffa165bb9fb29adf4063fd950e07b91611892c63.tar.bz2 xen-ffa165bb9fb29adf4063fd950e07b91611892c63.zip |
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@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libxl/libxl.c | 4 | ||||
-rw-r--r-- | tools/libxl/libxl_create.c | 19 | ||||
-rw-r--r-- | tools/libxl/libxl_dm.c | 10 | ||||
-rw-r--r-- | tools/libxl/libxl_internal.h | 4 | ||||
-rw-r--r-- | tools/libxl/libxl_types.idl | 12 | ||||
-rw-r--r-- | tools/libxl/libxl_types_internal.idl | 14 |
6 files changed, 32 insertions, 31 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index fe96cdc058..ae57703261 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2023,7 +2023,7 @@ int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid, /******************************************************************************/ 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 @@ int libxl__device_console_add(libxl__gc *gc, uint32_t domid, 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 --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c index b7b612679a..c30a0247fb 100644 --- a/tools/libxl/libxl_create.c +++ b/tools/libxl/libxl_create.c @@ -177,17 +177,16 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, 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 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, 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 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, 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 @@ static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config, 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 --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c index f535eb0766..257d31f752 100644 --- a/tools/libxl/libxl_dm.c +++ b/tools/libxl/libxl_dm.c @@ -688,7 +688,7 @@ static int libxl__create_stubdom(libxl__gc *gc, { 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 @@ 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; @@ -828,7 +828,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 @@ -1092,7 +1092,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) { @@ -1104,7 +1104,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 --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index ea87541fc3..b408bb347b 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -661,7 +661,7 @@ _hidden int libxl__device_disk_dev_number(const char *virtpath, 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(libxl__gc *gc, uint32_t domid, 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 --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl index eb987fa863..b8a39efd95 100644 --- a/tools/libxl/libxl_types.idl +++ b/tools/libxl/libxl_types.idl @@ -42,11 +42,6 @@ libxl_console_type = Enumeration("console_type", [ (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 @@ 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 --git a/tools/libxl/libxl_types_internal.idl b/tools/libxl/libxl_types_internal.idl index 71e13a523d..15f33419d0 100644 --- a/tools/libxl/libxl_types_internal.idl +++ b/tools/libxl/libxl_types_internal.idl @@ -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_kind", [ (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), + ]) |