[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 14 of 27 V4] libxl: make libxl_device_console internal
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1330533036 0 # Node ID 5a3e6c301be716a994f54195857a7dd9cff56296 # Parent 4ff5c9212400df0c271873ce30adabb4c26a80fa 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 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl.c Wed Feb 29 16:30:36 2012 +0000 @@ -2023,7 +2023,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; @@ -2070,7 +2070,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 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_create.c Wed Feb 29 16:30:36 2012 +0000 @@ -177,17 +177,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, @@ -586,14 +585,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); @@ -611,7 +610,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]); @@ -627,10 +626,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 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_dm.c Wed Feb 29 16:30:36 2012 +0000 @@ -688,7 +688,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; @@ -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 -r 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_internal.h Wed Feb 29 16:30:36 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 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_types.idl Wed Feb 29 16:30:36 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"), @@ -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 -r 4ff5c9212400 -r 5a3e6c301be7 tools/libxl/libxl_types_internal.idl --- a/tools/libxl/libxl_types_internal.idl Wed Feb 29 16:30:36 2012 +0000 +++ b/tools/libxl/libxl_types_internal.idl Wed Feb 29 16:30:36 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@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |