Ian Campbell
2011-Mar-31 11:38 UTC
[Xen-devel] [PATCH 0 of 4] [V2] libxl: Add enumeration type to IDL
As part of this I namespace some enum values, firstly within the LIBXL_ namespace (which is clearly a good idea) but secondly to namespace the values to within their respective typename, which is less clearly of benefit. It makes the IDL for enumerations somewhat cleaner but I''m not totally wedded to it -- opinions welcome. Changes since first version: - Use typedef enum FOO { } FOO idiom which allows existing users of "enum FOO xxx;" to continue working. - Add libxl_compat.h which defines the old names in an attempt to retain API (but not ABI) compatibility. By default all previous APIs will be exposed. Not sure if it makes more sense to require users to specify which they want. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 11:38 UTC
[Xen-devel] [PATCH 1 of 4] libxl: typedef libxl_action_on_shutdown
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1301571102 -3600 # Node ID e307b27c955b1fb0f0ef5e391fa9e37976d43d84 # Parent d0dd569bfcb0f5f8e2d903c8b6f9999ff1290e96 libxl: typedef libxl_action_on_shutdown This is the libxl convention. By using the "typedef enum foo { } foo;" syntax we can retain backwards compatibility with existing users. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r d0dd569bfcb0 -r e307b27c955b tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 31 12:31:29 2011 +0100 +++ b/tools/libxl/libxl.h Thu Mar 31 12:31:42 2011 +0100 @@ -245,7 +245,7 @@ enum { #define LIBXL_VERSION 0 -enum libxl_action_on_shutdown { +typedef enum libxl_action_on_shutdown { LIBXL_ACTION_DESTROY, LIBXL_ACTION_RESTART, @@ -255,7 +255,7 @@ enum libxl_action_on_shutdown { LIBXL_ACTION_COREDUMP_DESTROY, LIBXL_ACTION_COREDUMP_RESTART, -}; +} libxl_action_on_shutdown; typedef struct { libxl_domain_create_info c_info; @@ -271,10 +271,10 @@ typedef struct { libxl_device_vfb *vfbs; libxl_device_vkb *vkbs; - enum libxl_action_on_shutdown on_poweroff; - enum libxl_action_on_shutdown on_reboot; - enum libxl_action_on_shutdown on_watchdog; - enum libxl_action_on_shutdown on_crash; + libxl_action_on_shutdown on_poweroff; + libxl_action_on_shutdown on_reboot; + libxl_action_on_shutdown on_watchdog; + libxl_action_on_shutdown on_crash; } libxl_domain_config; /* context functions */ diff -r d0dd569bfcb0 -r e307b27c955b tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:31:29 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:31:42 2011 +0100 @@ -442,7 +442,7 @@ static void printf_info(int domid, printf(")\n"); } -static int parse_action_on_shutdown(const char *buf, enum libxl_action_on_shutdown *a) +static int parse_action_on_shutdown(const char *buf, libxl_action_on_shutdown *a) { int i; const char *n; @@ -1166,7 +1166,7 @@ static int handle_domain_death(libxl_ctx libxl_domain_config *d_config, libxl_dominfo *info) { int restart = 0; - enum libxl_action_on_shutdown action; + libxl_action_on_shutdown action; switch (info->shutdown_reason) { case SHUTDOWN_poweroff: _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 11:38 UTC
[Xen-devel] [PATCH 2 of 4] libxl: move all enum values into the libxl namespace
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1301571142 -3600 # Node ID f4bbcbd0417f7e4a4a167f385d6408494ed78e22 # Parent e307b27c955b1fb0f0ef5e391fa9e37976d43d84 libxl: move all enum values into the libxl namespace Add libxl_compat.h to define the previous values so as not to break existing users. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/Makefile --- a/tools/libxl/Makefile Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/Makefile Thu Mar 31 12:32:22 2011 +0100 @@ -124,7 +124,7 @@ install: all ln -sf libxlutil.so.$(XLUMAJOR).$(XLUMINOR) $(DESTDIR)$(LIBDIR)/libxlutil.so.$(XLUMAJOR) ln -sf libxlutil.so.$(XLUMAJOR) $(DESTDIR)$(LIBDIR)/libxlutil.so $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR) - $(INSTALL_DATA) libxl.h _libxl_types.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR) + $(INSTALL_DATA) libxl.h _libxl_types.h libxl_uuid.h libxl_compat.h $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh .PHONY: clean diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/libxl.c Thu Mar 31 12:32:22 2011 +0100 @@ -694,16 +694,16 @@ int libxl_event_get_disk_eject_info(libx "/local/domain/%d/backend/%" TOSTRING(BACKEND_STRING_SIZE) "[a-z]/%*d/%*d", &disk->backend_domid, backend_type); if (!strcmp(backend_type, "tap") || !strcmp(backend_type, "vbd")) { - disk->backend = DISK_BACKEND_TAP; + disk->backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(backend_type, "qdisk")) { - disk->backend = DISK_BACKEND_QDISK; + disk->backend = LIBXL_DISK_BACKEND_QDISK; } else { - disk->backend = DISK_BACKEND_UNKNOWN; + disk->backend = LIBXL_DISK_BACKEND_UNKNOWN; } disk->domid = domid; disk->pdev_path = strdup(""); - disk->format = DISK_FORMAT_EMPTY; + disk->format = LIBXL_DISK_FORMAT_EMPTY; /* this value is returned to the user: do not free right away */ disk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/dev", backend), NULL); disk->unpluggable = 1; @@ -908,14 +908,14 @@ static int validate_virtual_disk(libxl__ struct stat stat_buf; char *delimiter; - if (disk->format == DISK_FORMAT_EMPTY) + if (disk->format == LIBXL_DISK_FORMAT_EMPTY) return 0; - if (disk->format == DISK_FORMAT_RAW) { + if (disk->format == LIBXL_DISK_FORMAT_RAW) { delimiter = strchr(file_name, '':''); if (delimiter) { if (!strncmp(file_name, "vhd:", sizeof("vhd:")-1)) { - disk->format = DISK_FORMAT_VHD; + disk->format = LIBXL_DISK_FORMAT_VHD; file_name = ++delimiter; } } @@ -925,7 +925,7 @@ static int validate_virtual_disk(libxl__ LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to stat %s", file_name); return ERROR_INVAL; } - if (disk->backend == DISK_BACKEND_PHY) { + if (disk->backend == LIBXL_DISK_BACKEND_PHY) { if ( !(S_ISBLK(stat_buf.st_mode)) ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual disk %s is not a block device!\n", file_name); @@ -980,7 +980,7 @@ int libxl_device_disk_add(libxl_ctx *ctx device.kind = DEVICE_VBD; switch (disk->backend) { - case DISK_BACKEND_PHY: + case LIBXL_DISK_BACKEND_PHY: libxl__device_physdisk_major_minor(disk->pdev_path, &major, &minor); flexarray_append(back, "physical-device"); flexarray_append(back, libxl__sprintf(&gc, "%x:%x", major, minor)); @@ -990,8 +990,8 @@ int libxl_device_disk_add(libxl_ctx *ctx device.backend_kind = DEVICE_VBD; break; - case DISK_BACKEND_TAP: - if (libxl__blktap_enabled(&gc) && disk->format != DISK_FORMAT_EMPTY) { + case LIBXL_DISK_BACKEND_TAP: + if (libxl__blktap_enabled(&gc) && disk->format != LIBXL_DISK_FORMAT_EMPTY) { const char *dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format); if (!dev) { @@ -1012,13 +1012,13 @@ int libxl_device_disk_add(libxl_ctx *ctx break; } - case DISK_BACKEND_QDISK: + case LIBXL_DISK_BACKEND_QDISK: flexarray_append(back, "params"); flexarray_append(back, libxl__sprintf(&gc, "%s:%s", libxl__device_disk_string_of_format(disk->format), disk->pdev_path)); if (libxl__blktap_enabled(&gc) && - disk->backend != DISK_BACKEND_QDISK) + disk->backend != LIBXL_DISK_BACKEND_QDISK) device.backend_kind = DEVICE_TAP; else device.backend_kind = DEVICE_QDISK; @@ -1085,7 +1085,7 @@ int libxl_device_disk_del(libxl_ctx *ctx device.backend_domid = disk->backend_domid; device.backend_devid = devid; device.backend_kind - (disk->backend == DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP; + (disk->backend == LIBXL_DISK_BACKEND_PHY) ? DEVICE_VBD : DEVICE_TAP; device.domid = disk->domid; device.devid = devid; device.kind = DEVICE_VBD; @@ -1103,8 +1103,8 @@ char * libxl_device_disk_local_attach(li char *ret = NULL; switch (disk->backend) { - case DISK_BACKEND_PHY: - if (disk->format != DISK_FORMAT_RAW) { + case LIBXL_DISK_BACKEND_PHY: + if (disk->format != LIBXL_DISK_FORMAT_RAW) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "physical block device must" " be raw"); break; @@ -1113,13 +1113,13 @@ char * libxl_device_disk_local_attach(li disk->pdev_path); dev = disk->pdev_path; break; - case DISK_BACKEND_TAP: - if (disk->format == DISK_FORMAT_VHD || disk->format == DISK_FORMAT_RAW) + case LIBXL_DISK_BACKEND_TAP: + if (disk->format == LIBXL_DISK_FORMAT_VHD || disk->format == LIBXL_DISK_FORMAT_RAW) { if (libxl__blktap_enabled(&gc)) dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format); else { - if (disk->format != DISK_FORMAT_RAW) { + if (disk->format != LIBXL_DISK_FORMAT_RAW) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "tapdisk2 is required" " to open a vhd disk"); break; @@ -1131,8 +1131,8 @@ char * libxl_device_disk_local_attach(li } } break; - } else if (disk->format == DISK_FORMAT_QCOW || - disk->format == DISK_FORMAT_QCOW2) { + } else if (disk->format == LIBXL_DISK_FORMAT_QCOW || + disk->format == LIBXL_DISK_FORMAT_QCOW2) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qcow or qcow2 disk image"); break; } else { @@ -1140,8 +1140,8 @@ char * libxl_device_disk_local_attach(li "type: %d", disk->backend); break; } - case DISK_BACKEND_QDISK: - if (disk->format != DISK_FORMAT_RAW) { + case LIBXL_DISK_BACKEND_QDISK: + if (disk->format != LIBXL_DISK_FORMAT_RAW) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot locally attach a qdisk " "image if the format is not raw"); break; @@ -1150,7 +1150,7 @@ char * libxl_device_disk_local_attach(li disk->pdev_path); dev = disk->pdev_path; break; - case DISK_BACKEND_UNKNOWN: + case LIBXL_DISK_BACKEND_UNKNOWN: default: LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend " "type: %d", disk->backend); @@ -1202,7 +1202,7 @@ int libxl_device_nic_init(libxl_device_n if ( asprintf(&nic_info->script, "%s/vif-bridge", libxl_xen_script_dir_path()) < 0 ) return ERROR_FAIL; - nic_info->nictype = NICTYPE_IOEMU; + nic_info->nictype = LIBXL_NICTYPE_IOEMU; return 0; } @@ -1851,7 +1851,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u if (!disk->pdev_path) { disk->pdev_path = strdup(""); - disk->format = DISK_FORMAT_EMPTY; + disk->format = LIBXL_DISK_FORMAT_EMPTY; } disks = libxl_device_disk_list(ctx, domid, &num); for (i = 0; i < num; i++) { @@ -2372,10 +2372,10 @@ int libxl_button_press(libxl_ctx *ctx, u int rc = -1; switch (button) { - case POWER_BUTTON: + case LIBXL_BUTTON_POWER: rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_POWER, 0); break; - case SLEEP_BUTTON: + case LIBXL_BUTTON_SLEEP: rc = xc_domain_send_trigger(ctx->xch, domid, XEN_DOMCTL_SENDTRIGGER_SLEEP, 0); break; default: diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/libxl.h Thu Mar 31 12:32:22 2011 +0100 @@ -162,8 +162,8 @@ typedef struct { void libxl_cpuarray_destroy(libxl_cpuarray *array); typedef enum { - XENFV = 1, - XENPV, + LIBXL_QEMU_MACHINE_TYPE_FV = 1, + LIBXL_QEMU_MACHINE_TYPE_PV, } libxl_qemu_machine_type; typedef enum { @@ -177,24 +177,24 @@ typedef enum { } libxl_console_consback; typedef enum { - DISK_FORMAT_UNKNOWN = 0, - DISK_FORMAT_QCOW, - DISK_FORMAT_QCOW2, - DISK_FORMAT_VHD, - DISK_FORMAT_RAW, - DISK_FORMAT_EMPTY, + LIBXL_DISK_FORMAT_UNKNOWN = 0, + LIBXL_DISK_FORMAT_QCOW, + LIBXL_DISK_FORMAT_QCOW2, + LIBXL_DISK_FORMAT_VHD, + LIBXL_DISK_FORMAT_RAW, + LIBXL_DISK_FORMAT_EMPTY, } libxl_disk_format; typedef enum { - DISK_BACKEND_UNKNOWN = 0, - DISK_BACKEND_PHY, - DISK_BACKEND_TAP, - DISK_BACKEND_QDISK, + LIBXL_DISK_BACKEND_UNKNOWN = 0, + LIBXL_DISK_BACKEND_PHY, + LIBXL_DISK_BACKEND_TAP, + LIBXL_DISK_BACKEND_QDISK, } libxl_disk_backend; typedef enum { - NICTYPE_IOEMU = 1, - NICTYPE_VIF, + LIBXL_NICTYPE_IOEMU = 1, + LIBXL_NICTYPE_VIF, } libxl_nic_type; typedef struct { @@ -487,8 +487,8 @@ int libxl_userdata_retrieve(libxl_ctx *c */ typedef enum { - POWER_BUTTON, - SLEEP_BUTTON + LIBXL_BUTTON_POWER, + LIBXL_BUTTON_SLEEP } libxl_button; int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button); diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl_compat.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxl/libxl_compat.h Thu Mar 31 12:32:22 2011 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2011 Citrix Ltd. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published + * by the Free Software Foundation; version 2.1 only. with the special + * exception on linking described in file LICENSE. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + */ + +#ifndef LIBXL_COMPAT_H +#define LIBXL_COMPAT_H + +/* + * This header provides a compatibility shim which allows users of + * libxl written against a previous Xen version''s libxl some hope of + * building against a new release. + * + * Users can define LIBXL_COMPAT_LEVEL to define the minimum level of + * libxl API they would like to be available. e.g. to provide wrappers + * for version xx.yy (4.1) the value should be 0xxxyy (0x0401) + */ + +/* Default to including all compatibility code */ +#ifndef LIBXL_COMPAT_LEVEL +#define LIBXL_COMPAT_LEVEL 0x0000 +#endif + +#if LIBXL_COMPAT_LEVEL < 0x0402 + +#define XENFV LIBXL_QEMU_MACHINE_TYPE_FV +#define XENPV LIBXL_QEMU_MACHINE_TYPE_PV + +#define DISK_FORMAT_UNKNOWN LIBXL_DISK_FORMAT_UNKNOWN +#define DISK_FORMAT_QCOW LIBXL_DISK_FORMAT_QCOW +#define DISK_FORMAT_QCOW2 LIBXL_DISK_FORMAT_QCOW2 +#define DISK_FORMAT_VHD LIBXL_DISK_FORMAT_VHD +#define DISK_FORMAT_RAW LIBXL_DISK_FORMAT_RAW +#define DISK_FORMAT_EMPTY LIBXL_DISK_FORMAT_EMPTY + +#define DISK_BACKEND_UNKNOWN LIBXL_DISK_BACKEND_UNKNOWN +#define DISK_BACKEND_PHY LIBXL_DISK_BACKEND_PHY +#define DISK_BACKEND_TAP LIBXL_DISK_BACKEND_TAP +#define DISK_BACKEND_QDISK LIBXL_DISK_BACKEND_QDISK + +#define NICTYPE_IOEMU LIBXL_NICTYPE_IOEMU +#define NICTYPE_VIF LIBXL_NICTYPE_VIF + +#define POWER_BUTTON LIBXL_BUTTON_POWER +#define SLEEP_BUTTON LIBXL_BUTTON_SLEEP + +#endif + +#endif /* LIBXL_COMPAT_H */ diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/libxl_device.c Thu Mar 31 12:32:22 2011 +0100 @@ -123,11 +123,11 @@ out: char *libxl__device_disk_string_of_format(libxl_disk_format format) { switch (format) { - case DISK_FORMAT_QCOW: return "qcow"; - case DISK_FORMAT_QCOW2: return "qcow2"; - case DISK_FORMAT_VHD: return "vhd"; - case DISK_FORMAT_RAW: - case DISK_FORMAT_EMPTY: return "aio"; + case LIBXL_DISK_FORMAT_QCOW: return "qcow"; + case LIBXL_DISK_FORMAT_QCOW2: return "qcow2"; + case LIBXL_DISK_FORMAT_VHD: return "vhd"; + case LIBXL_DISK_FORMAT_RAW: + case LIBXL_DISK_FORMAT_EMPTY: return "aio"; default: return NULL; } } @@ -135,9 +135,9 @@ char *libxl__device_disk_string_of_forma char *libxl__device_disk_string_of_backend(libxl_disk_backend backend) { switch (backend) { - case DISK_BACKEND_QDISK: return "qdisk"; - case DISK_BACKEND_TAP: return "tap"; - case DISK_BACKEND_PHY: return "phy"; + case LIBXL_DISK_BACKEND_QDISK: return "qdisk"; + case LIBXL_DISK_BACKEND_TAP: return "tap"; + case LIBXL_DISK_BACKEND_PHY: return "phy"; default: return NULL; } } diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/libxl_dm.c Thu Mar 31 12:32:22 2011 +0100 @@ -98,7 +98,7 @@ static char ** libxl__build_device_model if (info->serial) { flexarray_vappend(dm_args, "-serial", info->serial, NULL); } - if (info->type == XENFV) { + if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) { int ioemu_vifs = 0; if (info->videoram) { @@ -130,7 +130,7 @@ static char ** libxl__build_device_model flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc, "0x%x", info->vcpu_avail), NULL); } for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == NICTYPE_IOEMU) { + if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) { char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x", vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2], vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]); @@ -162,10 +162,14 @@ static char ** libxl__build_device_model for (i = 0; info->extra && info->extra[i] != NULL; i++) flexarray_append(dm_args, info->extra[i]); flexarray_append(dm_args, "-M"); - if (info->type == XENPV) + switch (info->type) { + case LIBXL_QEMU_MACHINE_TYPE_PV: flexarray_append(dm_args, "xenpv"); - else + break; + case LIBXL_QEMU_MACHINE_TYPE_FV: flexarray_append(dm_args, "xenfv"); + break; + } flexarray_append(dm_args, NULL); return (char **) flexarray_contents(dm_args); } @@ -187,7 +191,7 @@ static char ** libxl__build_device_model flexarray_vappend(dm_args, libxl__strdup(gc, info->device_model), "-xen-domid", libxl__sprintf(gc, "%d", info->domid), NULL); - if (info->type == XENPV) { + if (info->type == LIBXL_QEMU_MACHINE_TYPE_PV) { flexarray_append(dm_args, "-xen-attach"); } @@ -225,7 +229,7 @@ static char ** libxl__build_device_model flexarray_append(dm_args, "-sdl"); } - if (info->type == XENPV && !info->nographic) { + if (info->type == LIBXL_QEMU_MACHINE_TYPE_PV && !info->nographic) { flexarray_vappend(dm_args, "-vga", "xenfb", NULL); } @@ -238,7 +242,7 @@ static char ** libxl__build_device_model if (info->serial) { flexarray_vappend(dm_args, "-serial", info->serial, NULL); } - if (info->type == XENFV) { + if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) { int ioemu_vifs = 0; if (info->stdvga) { @@ -268,7 +272,7 @@ static char ** libxl__build_device_model flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->vcpus)); } for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == NICTYPE_IOEMU) { + if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) { char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x", vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2], vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]); @@ -303,16 +307,20 @@ static char ** libxl__build_device_model for (i = 0; info->extra && info->extra[i] != NULL; i++) flexarray_append(dm_args, info->extra[i]); flexarray_append(dm_args, "-M"); - if (info->type == XENPV) + switch (info->type) { + case LIBXL_QEMU_MACHINE_TYPE_PV: flexarray_append(dm_args, "xenpv"); - else + break; + case LIBXL_QEMU_MACHINE_TYPE_FV: flexarray_append(dm_args, "xenfv"); + break; + } /* RAM Size */ flexarray_append(dm_args, "-m"); flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->target_ram)); - if (info->type == XENFV) { + if (info->type == LIBXL_QEMU_MACHINE_TYPE_FV) { disks = libxl_device_disk_list(libxl__gc_owner(gc), info->domid, &nb); for (i; i < nb; i++) { if (disks[i].is_cdrom) { @@ -813,7 +821,7 @@ static int libxl__build_xenpv_qemu_args( info->domid = domid; info->dom_name = libxl_domid_to_name(ctx, domid); info->device_model = libxl__abs_path(gc, "qemu-dm", libxl_libexec_path()); - info->type = XENPV; + info->type = LIBXL_QEMU_MACHINE_TYPE_PV; return 0; } @@ -845,7 +853,7 @@ int libxl__need_xenpv_qemu(libxl__gc *gc int blktap_enabled = -1; for (i = 0; i < nr_disks; i++) { switch (disks[i].backend) { - case DISK_BACKEND_TAP: + case LIBXL_DISK_BACKEND_TAP: if (blktap_enabled == -1) blktap_enabled = libxl__blktap_enabled(gc); if (!blktap_enabled) { @@ -854,12 +862,12 @@ int libxl__need_xenpv_qemu(libxl__gc *gc } break; - case DISK_BACKEND_QDISK: + case LIBXL_DISK_BACKEND_QDISK: ret = 1; goto out; - case DISK_BACKEND_PHY: - case DISK_BACKEND_UNKNOWN: + case LIBXL_DISK_BACKEND_PHY: + case LIBXL_DISK_BACKEND_UNKNOWN: break; } } diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/libxl_utils.c Thu Mar 31 12:32:22 2011 +0100 @@ -283,9 +283,9 @@ int libxl_string_to_backend(libxl_ctx *c int rc = 0; if (!strcmp(s, "phy")) { - *backend = DISK_BACKEND_PHY; + *backend = LIBXL_DISK_BACKEND_PHY; } else if (!strcmp(s, "file")) { - *backend = DISK_BACKEND_TAP; + *backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(s, "tap")) { p = strchr(s, '':''); if (!p) { @@ -294,11 +294,11 @@ int libxl_string_to_backend(libxl_ctx *c } p++; if (!strcmp(p, "vhd")) { - *backend = DISK_BACKEND_TAP; + *backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(p, "qcow")) { - *backend = DISK_BACKEND_QDISK; + *backend = LIBXL_DISK_BACKEND_QDISK; } else if (!strcmp(p, "qcow2")) { - *backend = DISK_BACKEND_QDISK; + *backend = LIBXL_DISK_BACKEND_QDISK; } } out: diff -r e307b27c955b -r f4bbcbd0417f tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:32:22 2011 +0100 @@ -480,12 +480,12 @@ static int parse_disk_config(libxl_devic *p = ''\0''; if ( !strcmp(tok, "phy") ) { state = DSTATE_PHYSPATH; - disk->format = DISK_FORMAT_RAW; - disk->backend = DISK_BACKEND_PHY; + disk->format = LIBXL_DISK_FORMAT_RAW; + disk->backend = LIBXL_DISK_BACKEND_PHY; }else if ( !strcmp(tok, "file") ) { state = DSTATE_PHYSPATH; - disk->format = DISK_FORMAT_RAW; - disk->backend = DISK_BACKEND_TAP; + disk->format = LIBXL_DISK_FORMAT_RAW; + disk->backend = LIBXL_DISK_BACKEND_TAP; }else if ((!strcmp(tok, "tap")) || (!strcmp(tok, "tap2"))) { state = DSTATE_TAP; @@ -496,16 +496,16 @@ static int parse_disk_config(libxl_devic tok = p + 1; } else if (*p == '','') { state = DSTATE_VIRTPATH; - disk->format = DISK_FORMAT_EMPTY; - disk->backend = DISK_BACKEND_TAP; + disk->format = LIBXL_DISK_FORMAT_EMPTY; + disk->backend = LIBXL_DISK_BACKEND_TAP; disk->pdev_path = strdup(""); tok = p + 1; } break; case DSTATE_TAP: if (*p == '','') { - disk->format = DISK_FORMAT_RAW; - disk->backend = DISK_BACKEND_TAP; + disk->format = LIBXL_DISK_FORMAT_RAW; + disk->backend = LIBXL_DISK_BACKEND_TAP; state = DSTATE_PHYSPATH; } else if ( *p == '':'' ) { *p = ''\0''; @@ -514,17 +514,17 @@ static int parse_disk_config(libxl_devic break; } if (!strcmp(tok, "vhd")) { - disk->format = DISK_FORMAT_VHD; - disk->backend = DISK_BACKEND_TAP; + disk->format = LIBXL_DISK_FORMAT_VHD; + disk->backend = LIBXL_DISK_BACKEND_TAP; }else if ( !strcmp(tok, "qcow") ) { - disk->format = DISK_FORMAT_QCOW; - disk->backend = DISK_BACKEND_QDISK; + disk->format = LIBXL_DISK_FORMAT_QCOW; + disk->backend = LIBXL_DISK_BACKEND_QDISK; }else if ( !strcmp(tok, "qcow2") ) { - disk->format = DISK_FORMAT_QCOW2; - disk->backend = DISK_BACKEND_QDISK; + disk->format = LIBXL_DISK_FORMAT_QCOW2; + disk->backend = LIBXL_DISK_BACKEND_QDISK; }else if (!strcmp(tok, "raw")) { - disk->format = DISK_FORMAT_RAW; - disk->backend = DISK_BACKEND_TAP; + disk->format = LIBXL_DISK_FORMAT_RAW; + disk->backend = LIBXL_DISK_BACKEND_TAP; } else { fprintf(stderr, "Unknown tapdisk type: %s\n", tok); @@ -863,9 +863,9 @@ static void parse_config_data(const char nic->bridge = strdup(p2 + 1); } else if (!strcmp(p, "type")) { if (!strcmp(p2 + 1, "ioemu")) - nic->nictype = NICTYPE_IOEMU; + nic->nictype = LIBXL_NICTYPE_IOEMU; else - nic->nictype = NICTYPE_VIF; + nic->nictype = LIBXL_NICTYPE_VIF; } else if (!strcmp(p, "ip")) { free(nic->ip); nic->ip = strdup(p2 + 1); @@ -1156,7 +1156,7 @@ skip_vfb: } } - dm_info->type = c_info->hvm ? XENFV : XENPV; + dm_info->type = c_info->hvm ? LIBXL_QEMU_MACHINE_TYPE_FV : LIBXL_QEMU_MACHINE_TYPE_PV; xlu_cfg_destroy(config); } @@ -3346,9 +3346,9 @@ static void button_press(const char *p, find_domain(p); if (!strcmp(b, "power")) { - button = POWER_BUTTON; + button = LIBXL_BUTTON_POWER; } else if (!strcmp(b, "sleep")) { - button = SLEEP_BUTTON; + button = LIBXL_BUTTON_SLEEP; } else { fprintf(stderr, "%s is an invalid button identifier\n", b); exit(2); @@ -4260,9 +4260,9 @@ int main_networkattach(int argc, char ** for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) { if (!strncmp("type=", *argv, 5)) { if (!strncmp("vif", (*argv) + 5, 4)) { - nic.nictype = NICTYPE_VIF; + nic.nictype = LIBXL_NICTYPE_VIF; } else if (!strncmp("ioemu", (*argv) + 5, 5)) { - nic.nictype = NICTYPE_IOEMU; + nic.nictype = LIBXL_NICTYPE_IOEMU; } else { fprintf(stderr, "Invalid parameter `type''.\n"); return 1; @@ -4428,22 +4428,22 @@ int main_blockattach(int argc, char **ar tok = strtok(argv[optind+1], ":"); if (!strcmp(tok, "phy")) { - disk.backend = DISK_BACKEND_PHY; + disk.backend = LIBXL_DISK_BACKEND_PHY; } else if (!strcmp(tok, "file")) { - disk.backend = DISK_BACKEND_TAP; + disk.backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(tok, "tap")) { tok = strtok(NULL, ":"); if (!strcmp(tok, "aio")) { - disk.backend = DISK_BACKEND_TAP; + disk.backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(tok, "vhd")) { - disk.format = DISK_FORMAT_VHD; - disk.backend = DISK_BACKEND_TAP; + disk.format = LIBXL_DISK_FORMAT_VHD; + disk.backend = LIBXL_DISK_BACKEND_TAP; } else if (!strcmp(tok, "qcow")) { - disk.format = DISK_FORMAT_QCOW; - disk.backend = DISK_BACKEND_QDISK; + disk.format = LIBXL_DISK_FORMAT_QCOW; + disk.backend = LIBXL_DISK_BACKEND_QDISK; } else if (!strcmp(tok, "qcow2")) { - disk.format = DISK_FORMAT_QCOW2; - disk.backend = DISK_BACKEND_QDISK; + disk.format = LIBXL_DISK_FORMAT_QCOW2; + disk.backend = LIBXL_DISK_BACKEND_QDISK; } else { fprintf(stderr, "Error: `%s'' is not a valid disk image.\n", tok); return 1; diff -r e307b27c955b -r f4bbcbd0417f tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Thu Mar 31 12:32:22 2011 +0100 @@ -224,7 +224,7 @@ static int device_nic_val(caml_gc *gc, l c_val->bridge = dup_String_val(gc, Field(v, 5)); c_val->ifname = dup_String_val(gc, Field(v, 6)); c_val->script = dup_String_val(gc, Field(v, 7)); - c_val->nictype = (Int_val(Field(v, 8))) + NICTYPE_IOEMU; + c_val->nictype = (Int_val(Field(v, 8))) + LIBXL_NICTYPE_IOEMU; out: CAMLreturn(ret); @@ -594,7 +594,7 @@ value stub_xl_button_press(value domid, INIT_STRUCT(); INIT_CTX(); - ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + POWER_BUTTON); + ret = libxl_button_press(ctx, Int_val(domid), Int_val(button) + LIBXL_BUTTON_POWER); if (ret != 0) failwith_xl("button_press", &lg); FREE_CTX(); diff -r e307b27c955b -r f4bbcbd0417f tools/python/xen/lowlevel/xl/xl.c --- a/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:31:42 2011 +0100 +++ b/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:32:22 2011 +0100 @@ -769,8 +769,8 @@ PyMODINIT_FUNC initxl(void) _INT_CONST(m, SHUTDOWN_crash); _INT_CONST(m, SHUTDOWN_watchdog); - _INT_CONST(m, XENFV); - _INT_CONST(m, XENPV); + _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_FV); + _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_PV); _INT_CONST_LIBXL(m, CONSTYPE_SERIAL); _INT_CONST_LIBXL(m, CONSTYPE_PV); @@ -778,26 +778,26 @@ PyMODINIT_FUNC initxl(void) _INT_CONST_LIBXL(m, CONSBACK_XENCONSOLED); _INT_CONST_LIBXL(m, CONSBACK_IOEMU); - _INT_CONST(m, DISK_FORMAT_UNKNOWN); - _INT_CONST(m, DISK_FORMAT_QCOW); - _INT_CONST(m, DISK_FORMAT_QCOW2); - _INT_CONST(m, DISK_FORMAT_VHD); - _INT_CONST(m, DISK_FORMAT_RAW); - _INT_CONST(m, DISK_FORMAT_EMPTY); + _INT_CONST_LIBXL(m, DISK_FORMAT_UNKNOWN); + _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW); + _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW2); + _INT_CONST_LIBXL(m, DISK_FORMAT_VHD); + _INT_CONST_LIBXL(m, DISK_FORMAT_RAW); + _INT_CONST_LIBXL(m, DISK_FORMAT_EMPTY); - _INT_CONST(m, DISK_BACKEND_UNKNOWN); - _INT_CONST(m, DISK_BACKEND_PHY); - _INT_CONST(m, DISK_BACKEND_TAP); - _INT_CONST(m, DISK_BACKEND_QDISK); + _INT_CONST_LIBXL(m, DISK_BACKEND_UNKNOWN); + _INT_CONST_LIBXL(m, DISK_BACKEND_PHY); + _INT_CONST_LIBXL(m, DISK_BACKEND_TAP); + _INT_CONST_LIBXL(m, DISK_BACKEND_QDISK); - _INT_CONST(m, NICTYPE_IOEMU); - _INT_CONST(m, NICTYPE_VIF); + _INT_CONST_LIBXL(m, NICTYPE_IOEMU); + _INT_CONST_LIBXL(m, NICTYPE_VIF); _INT_CONST_LIBXL(m, EVENT_DOMAIN_DEATH); _INT_CONST_LIBXL(m, EVENT_DISK_EJECT); - _INT_CONST(m, POWER_BUTTON); - _INT_CONST(m, SLEEP_BUTTON); + _INT_CONST_LIBXL(m, BUTTON_POWER); + _INT_CONST_LIBXL(m, BUTTON_SLEEP); genwrap__init(m); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 11:38 UTC
[Xen-devel] [PATCH 3 of 4] libxl: namespace enum values within their type
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1301571234 -3600 # Node ID 6a72a608fe9e8d3639038697fcea0197c59156fe # Parent f4bbcbd0417f7e4a4a167f385d6408494ed78e22 libxl: namespace enum values within their type. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl.c --- a/tools/libxl/libxl.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl.c Thu Mar 31 12:33:54 2011 +0100 @@ -592,7 +592,7 @@ int libxl_get_wait_fd(libxl_ctx *ctx, in int libxl_wait_for_domain_death(libxl_ctx *ctx, uint32_t domid, libxl_waiter *waiter) { waiter->path = strdup("@releaseDomain"); - if (asprintf(&(waiter->token), "%d", LIBXL_EVENT_DOMAIN_DEATH) < 0) + if (asprintf(&(waiter->token), "%d", LIBXL_EVENT_TYPE_DOMAIN_DEATH) < 0) return -1; if (!xs_watch(ctx->xsh, waiter->path, waiter->token)) return -1; @@ -613,7 +613,7 @@ int libxl_wait_for_disk_ejects(libxl_ctx libxl__xs_get_dompath(&gc, domid), libxl__device_disk_dev_number(disks[i].vdev)) < 0) goto out; - if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_DISK_EJECT) < 0) + if (asprintf(&(waiter[i].token), "%d", LIBXL_EVENT_TYPE_DISK_EJECT) < 0) goto out; xs_watch(ctx->xsh, waiter[i].path, waiter[i].token); } @@ -782,7 +782,7 @@ out: return 0; } -int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type) +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type) { libxl__gc gc = LIBXL_INIT_GC(ctx); char *p = libxl__sprintf(&gc, "%s/xenconsole", libxl_private_bindir_path()); @@ -791,10 +791,10 @@ int libxl_console_exec(libxl_ctx *ctx, u char *cons_type_s; switch (type) { - case LIBXL_CONSTYPE_PV: + case LIBXL_CONSOLE_TYPE_PV: cons_type_s = "pv"; break; - case LIBXL_CONSTYPE_SERIAL: + case LIBXL_CONSOLE_TYPE_SERIAL: cons_type_s = "serial"; break; default: @@ -815,12 +815,12 @@ int libxl_primary_console_exec(libxl_ctx int rc; if (stubdomid) rc = libxl_console_exec(ctx, stubdomid, - STUBDOM_CONSOLE_SERIAL, LIBXL_CONSTYPE_PV); + STUBDOM_CONSOLE_SERIAL, LIBXL_CONSOLE_TYPE_PV); else { if (libxl__domain_is_hvm(&gc, domid_vm)) - rc = libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_SERIAL); + rc = libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSOLE_TYPE_SERIAL); else - rc = libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSTYPE_PV); + rc = libxl_console_exec(ctx, domid_vm, 0, LIBXL_CONSOLE_TYPE_PV); } libxl__free_all(&gc); return rc; @@ -1202,7 +1202,7 @@ int libxl_device_nic_init(libxl_device_n if ( asprintf(&nic_info->script, "%s/vif-bridge", libxl_xen_script_dir_path()) < 0 ) return ERROR_FAIL; - nic_info->nictype = LIBXL_NICTYPE_IOEMU; + nic_info->nictype = LIBXL_NIC_TYPE_IOEMU; return 0; } @@ -1641,7 +1641,7 @@ int libxl_device_console_add(libxl_ctx * flexarray_append(front, "limit"); flexarray_append(front, libxl__sprintf(&gc, "%d", LIBXL_XENCONSOLE_LIMIT)); flexarray_append(front, "type"); - if (console->consback == LIBXL_CONSBACK_XENCONSOLED) + if (console->consback == LIBXL_CONSOLE_BACKEND_XENCONSOLED) flexarray_append(front, "xenconsoled"); else flexarray_append(front, "ioemu"); diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl.h Thu Mar 31 12:33:54 2011 +0100 @@ -167,14 +167,14 @@ typedef enum { } libxl_qemu_machine_type; typedef enum { - LIBXL_CONSTYPE_SERIAL = 1, - LIBXL_CONSTYPE_PV, -} libxl_console_constype; + LIBXL_CONSOLE_TYPE_SERIAL = 1, + LIBXL_CONSOLE_TYPE_PV, +} libxl_console_type; typedef enum { - LIBXL_CONSBACK_XENCONSOLED, - LIBXL_CONSBACK_IOEMU, -} libxl_console_consback; + LIBXL_CONSOLE_BACKEND_XENCONSOLED, + LIBXL_CONSOLE_BACKEND_IOEMU, +} libxl_console_backend; typedef enum { LIBXL_DISK_FORMAT_UNKNOWN = 0, @@ -193,8 +193,8 @@ typedef enum { } libxl_disk_backend; typedef enum { - LIBXL_NICTYPE_IOEMU = 1, - LIBXL_NICTYPE_VIF, + LIBXL_NIC_TYPE_IOEMU = 1, + LIBXL_NIC_TYPE_VIF, } libxl_nic_type; typedef struct { @@ -246,15 +246,15 @@ enum { #define LIBXL_VERSION 0 typedef enum libxl_action_on_shutdown { - LIBXL_ACTION_DESTROY, + LIBXL_ACTION_ON_SHUTDOWN_DESTROY, - LIBXL_ACTION_RESTART, - LIBXL_ACTION_RESTART_RENAME, + LIBXL_ACTION_ON_SHUTDOWN_RESTART, + LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME, - LIBXL_ACTION_PRESERVE, + LIBXL_ACTION_ON_SHUTDOWN_PRESERVE, - LIBXL_ACTION_COREDUMP_DESTROY, - LIBXL_ACTION_COREDUMP_RESTART, + LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY, + LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART, } libxl_action_on_shutdown; typedef struct { @@ -322,8 +322,8 @@ int libxl_run_bootloader(libxl_ctx *ctx, /* events handling */ typedef enum { - LIBXL_EVENT_DOMAIN_DEATH, - LIBXL_EVENT_DISK_EJECT, + LIBXL_EVENT_TYPE_DOMAIN_DEATH, + LIBXL_EVENT_TYPE_DISK_EJECT, } libxl_event_type; typedef struct { @@ -396,7 +396,7 @@ int libxl_wait_for_free_memory(libxl_ctx int libxl_wait_for_memory_target(libxl_ctx *ctx, uint32_t domid, int wait_secs); int libxl_vncviewer_exec(libxl_ctx *ctx, uint32_t domid, int autopass); -int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_constype type); +int libxl_console_exec(libxl_ctx *ctx, uint32_t domid, int cons_num, libxl_console_type type); /* libxl_primary_console_exec finds the domid and console number * corresponding to the primary console of the given vm, then calls * libxl_console_exec with the right arguments (domid might be different diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl.idl Thu Mar 31 12:33:54 2011 +0100 @@ -9,8 +9,8 @@ libxl_mac = Builtin("mac") libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE) libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE) libxl_qemu_machine_type = Number("qemu_machine_type", namespace="libxl_") -libxl_console_consback = Number("console_consback", namespace="libxl_") -libxl_console_constype = Number("console_constype", namespace="libxl_") +libxl_console_backend = Number("console_backend", namespace="libxl_") +libxl_console_type = Number("console_type", namespace="libxl_") libxl_disk_format = Number("disk_format", namespace="libxl_") libxl_disk_backend = Number("disk_backend", namespace="libxl_") libxl_nic_type = Number("nic_type", namespace="libxl_") @@ -196,7 +196,7 @@ libxl_device_console = Struct("device_co ("backend_domid", uint32), ("domid", domid), ("devid", integer), - ("consback", libxl_console_consback), + ("consback", libxl_console_backend), ("build_state", Reference(libxl_domain_build_state), True), ("output", string), ]) diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl_compat.h --- a/tools/libxl/libxl_compat.h Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl_compat.h Thu Mar 31 12:33:54 2011 +0100 @@ -35,6 +35,14 @@ #define XENFV LIBXL_QEMU_MACHINE_TYPE_FV #define XENPV LIBXL_QEMU_MACHINE_TYPE_PV +#define libxl_console_constype libxl_console_type +#define LIBXL_CONSTYPE_SERIAL LIBXL_CONSOLE_TYPE_SERIAL +#define LIBXL_CONSTYPE_PV LIBXL_CONSOLE_TYPE_PV + +#define LIBXL_CONSBACK_XENCONSOLED LIBXL_CONSOLE_BACKEND_XENCONSOLED +#define LIBXL_CONSBACK_IOEMU LIBXL_CONSOLE_BACKEND_IOEMU +#define libxl_console_consback libxl_console_backend + #define DISK_FORMAT_UNKNOWN LIBXL_DISK_FORMAT_UNKNOWN #define DISK_FORMAT_QCOW LIBXL_DISK_FORMAT_QCOW #define DISK_FORMAT_QCOW2 LIBXL_DISK_FORMAT_QCOW2 @@ -47,12 +55,23 @@ #define DISK_BACKEND_TAP LIBXL_DISK_BACKEND_TAP #define DISK_BACKEND_QDISK LIBXL_DISK_BACKEND_QDISK -#define NICTYPE_IOEMU LIBXL_NICTYPE_IOEMU -#define NICTYPE_VIF LIBXL_NICTYPE_VIF +#define NICTYPE_IOEMU LIBXL_NIC_TYPE_IOEMU +#define NICTYPE_VIF LIBXL_NIC_TYPE_VIF #define POWER_BUTTON LIBXL_BUTTON_POWER #define SLEEP_BUTTON LIBXL_BUTTON_SLEEP +#define LIBXL_ACTION_DESTROY LIBXL_ACTION_ON_SHUTDOWN_DESTROY +#define LIBXL_ACTION_RESTART LIBXL_ACTION_ON_SHUTDOWN_RESTART +#define LIBXL_ACTION_RESTART_RENAME LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME +#define LIBXL_ACTION_PRESERVE LIBXL_ACTION_ON_SHUTDOWN_PRESERVE +#define LIBXL_ACTION_COREDUMP_DESTROY LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY +#define LIBXL_ACTION_COREDUMP_RESTART LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART + +#define LIBXL_EVENT_DOMAIN_DEATH LIBXL_EVENT_TYPE_DOMAIN_DEATH +#define LIBXL_EVENT_DISK_EJECT LIBXL_EVENT_TYPE_DISK_EJECT + + #endif #endif /* LIBXL_COMPAT_H */ diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl_create.c Thu Mar 31 12:33:54 2011 +0100 @@ -138,7 +138,7 @@ static int init_console_info(libxl_devic { memset(console, 0x00, sizeof(libxl_device_console)); console->devid = dev_num; - console->consback = LIBXL_CONSBACK_XENCONSOLED; + console->consback = LIBXL_CONSOLE_BACKEND_XENCONSOLED; console->output = strdup("pty"); if ( NULL == console->output ) return ERROR_NOMEM; @@ -515,7 +515,7 @@ static int do_domain_create(libxl__gc *g d_config->num_disks, &d_config->disks[0]); if (need_qemu) - console.consback = LIBXL_CONSBACK_IOEMU; + console.consback = LIBXL_CONSOLE_BACKEND_IOEMU; libxl_device_console_add(ctx, domid, &console); libxl_device_console_destroy(&console); diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/libxl_dm.c --- a/tools/libxl/libxl_dm.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/libxl_dm.c Thu Mar 31 12:33:54 2011 +0100 @@ -130,7 +130,7 @@ static char ** libxl__build_device_model flexarray_vappend(dm_args, "-vcpu_avail", libxl__sprintf(gc, "0x%x", info->vcpu_avail), NULL); } for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) { + if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) { char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x", vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2], vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]); @@ -272,7 +272,7 @@ static char ** libxl__build_device_model flexarray_append(dm_args, libxl__sprintf(gc, "%d", info->vcpus)); } for (i = 0; i < num_vifs; i++) { - if (vifs[i].nictype == LIBXL_NICTYPE_IOEMU) { + if (vifs[i].nictype == LIBXL_NIC_TYPE_IOEMU) { char *smac = libxl__sprintf(gc, "%02x:%02x:%02x:%02x:%02x:%02x", vifs[i].mac[0], vifs[i].mac[1], vifs[i].mac[2], vifs[i].mac[3], vifs[i].mac[4], vifs[i].mac[5]); @@ -581,7 +581,7 @@ retry_transaction: for (i = 0; i < num_console; i++) { console[i].devid = i; - console[i].consback = LIBXL_CONSBACK_IOEMU; + console[i].consback = LIBXL_CONSOLE_BACKEND_IOEMU; console[i].domid = domid; /* STUBDOM_CONSOLE_LOGGING (console 0) is for minios logging * STUBDOM_CONSOLE_SAVE (console 1) is for writing the save file @@ -838,7 +838,7 @@ int libxl__need_xenpv_qemu(libxl__gc *gc } for (i = 0; i < nr_consoles; i++) { - if (consoles[i].consback == LIBXL_CONSBACK_IOEMU) { + if (consoles[i].consback == LIBXL_CONSOLE_BACKEND_IOEMU) { ret = 1; goto out; } diff -r f4bbcbd0417f -r 6a72a608fe9e tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:33:54 2011 +0100 @@ -101,15 +101,15 @@ struct save_file_header { static const char *action_on_shutdown_names[] = { - [LIBXL_ACTION_DESTROY] = "destroy", - - [LIBXL_ACTION_RESTART] = "restart", - [LIBXL_ACTION_RESTART_RENAME] = "rename-restart", - - [LIBXL_ACTION_PRESERVE] = "preserve", - - [LIBXL_ACTION_COREDUMP_DESTROY] = "coredump-destroy", - [LIBXL_ACTION_COREDUMP_RESTART] = "coredump-restart", + [LIBXL_ACTION_ON_SHUTDOWN_DESTROY] = "destroy", + + [LIBXL_ACTION_ON_SHUTDOWN_RESTART] = "restart", + [LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME] = "rename-restart", + + [LIBXL_ACTION_ON_SHUTDOWN_PRESERVE] = "preserve", + + [LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY] = "coredump-destroy", + [LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART] = "coredump-restart", }; /* Optional data, in order: @@ -863,9 +863,9 @@ static void parse_config_data(const char nic->bridge = strdup(p2 + 1); } else if (!strcmp(p, "type")) { if (!strcmp(p2 + 1, "ioemu")) - nic->nictype = LIBXL_NICTYPE_IOEMU; + nic->nictype = LIBXL_NIC_TYPE_IOEMU; else - nic->nictype = LIBXL_NICTYPE_VIF; + nic->nictype = LIBXL_NIC_TYPE_VIF; } else if (!strcmp(p, "ip")) { free(nic->ip); nic->ip = strdup(p2 + 1); @@ -1185,12 +1185,12 @@ static int handle_domain_death(libxl_ctx break; default: LOG("Unknown shutdown reason code %d. Destroying domain.", info->shutdown_reason); - action = LIBXL_ACTION_DESTROY; + action = LIBXL_ACTION_ON_SHUTDOWN_DESTROY; } LOG("Action for shutdown reason code %d is %s", info->shutdown_reason, action_on_shutdown_names[action]); - if (action == LIBXL_ACTION_COREDUMP_DESTROY || action == LIBXL_ACTION_COREDUMP_RESTART) { + if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY || action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART) { char *corefile; int rc; @@ -1203,30 +1203,30 @@ static int handle_domain_death(libxl_ctx } /* No point crying over spilled milk, continue on failure. */ - if (action == LIBXL_ACTION_COREDUMP_DESTROY) - action = LIBXL_ACTION_DESTROY; + if (action == LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY) + action = LIBXL_ACTION_ON_SHUTDOWN_DESTROY; else - action = LIBXL_ACTION_RESTART; + action = LIBXL_ACTION_ON_SHUTDOWN_RESTART; } switch (action) { - case LIBXL_ACTION_PRESERVE: + case LIBXL_ACTION_ON_SHUTDOWN_PRESERVE: break; - case LIBXL_ACTION_RESTART_RENAME: + case LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME: restart = 2; break; - case LIBXL_ACTION_RESTART: + case LIBXL_ACTION_ON_SHUTDOWN_RESTART: restart = 1; /* fall-through */ - case LIBXL_ACTION_DESTROY: + case LIBXL_ACTION_ON_SHUTDOWN_DESTROY: LOG("Domain %d needs to be cleaned up: destroying the domain", domid); libxl_domain_destroy(ctx, domid, 0); break; - case LIBXL_ACTION_COREDUMP_DESTROY: - case LIBXL_ACTION_COREDUMP_RESTART: + case LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY: + case LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART: /* Already handled these above. */ abort(); } @@ -1624,7 +1624,7 @@ start: continue; libxl_get_event(ctx, &event); switch (event.type) { - case LIBXL_EVENT_DOMAIN_DEATH: + case LIBXL_EVENT_TYPE_DOMAIN_DEATH: ret = libxl_event_get_domain_death_info(ctx, domid, &event, &info); if (ret < 0) { @@ -1682,7 +1682,7 @@ start: goto out; } break; - case LIBXL_EVENT_DISK_EJECT: + case LIBXL_EVENT_TYPE_DISK_EJECT: if (libxl_event_get_disk_eject_info(ctx, domid, &event, &disk)) { libxl_cdrom_insert(ctx, domid, &disk); libxl_device_disk_destroy(&disk); @@ -1951,7 +1951,7 @@ int main_cd_insert(int argc, char **argv int main_console(int argc, char **argv) { int opt = 0, num = 0; - libxl_console_constype type = 0; + libxl_console_type type = 0; while ((opt = getopt(argc, argv, "hn:t:")) != -1) { switch (opt) { @@ -1960,9 +1960,9 @@ int main_console(int argc, char **argv) return 0; case ''t'': if (!strcmp(optarg, "pv")) - type = LIBXL_CONSTYPE_PV; + type = LIBXL_CONSOLE_TYPE_PV; else if (!strcmp(optarg, "serial")) - type = LIBXL_CONSTYPE_SERIAL; + type = LIBXL_CONSOLE_TYPE_SERIAL; else { fprintf(stderr, "console type supported are: pv, serial\n"); return 2; @@ -2257,7 +2257,7 @@ static void shutdown_domain(const char * libxl_get_event(ctx, &event); - if (event.type == LIBXL_EVENT_DOMAIN_DEATH) { + if (event.type == LIBXL_EVENT_TYPE_DOMAIN_DEATH) { if (libxl_event_get_domain_death_info(ctx, domid, &event, &info) < 0) continue; @@ -4260,9 +4260,9 @@ int main_networkattach(int argc, char ** for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) { if (!strncmp("type=", *argv, 5)) { if (!strncmp("vif", (*argv) + 5, 4)) { - nic.nictype = LIBXL_NICTYPE_VIF; + nic.nictype = LIBXL_NIC_TYPE_VIF; } else if (!strncmp("ioemu", (*argv) + 5, 5)) { - nic.nictype = LIBXL_NICTYPE_IOEMU; + nic.nictype = LIBXL_NIC_TYPE_IOEMU; } else { fprintf(stderr, "Invalid parameter `type''.\n"); return 1; diff -r f4bbcbd0417f -r 6a72a608fe9e tools/ocaml/libs/xl/xl_stubs.c --- a/tools/ocaml/libs/xl/xl_stubs.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/ocaml/libs/xl/xl_stubs.c Thu Mar 31 12:33:54 2011 +0100 @@ -224,7 +224,7 @@ static int device_nic_val(caml_gc *gc, l c_val->bridge = dup_String_val(gc, Field(v, 5)); c_val->ifname = dup_String_val(gc, Field(v, 6)); c_val->script = dup_String_val(gc, Field(v, 7)); - c_val->nictype = (Int_val(Field(v, 8))) + LIBXL_NICTYPE_IOEMU; + c_val->nictype = (Int_val(Field(v, 8))) + LIBXL_NIC_TYPE_IOEMU; out: CAMLreturn(ret); @@ -236,7 +236,7 @@ static int device_console_val(caml_gc *g c_val->backend_domid = Int_val(Field(v, 0)); c_val->devid = Int_val(Field(v, 1)); - c_val->consback = (Int_val(Field(v, 2))) + LIBXL_CONSBACK_XENCONSOLED; + c_val->consback = (Int_val(Field(v, 2))) + LIBXL_CONSOLE_BACKEND_XENCONSOLED; CAMLreturn(0); } diff -r f4bbcbd0417f -r 6a72a608fe9e tools/python/xen/lowlevel/xl/xl.c --- a/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:32:22 2011 +0100 +++ b/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:33:54 2011 +0100 @@ -772,11 +772,11 @@ PyMODINIT_FUNC initxl(void) _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_FV); _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_PV); - _INT_CONST_LIBXL(m, CONSTYPE_SERIAL); - _INT_CONST_LIBXL(m, CONSTYPE_PV); + _INT_CONST_LIBXL(m, CONSOLE_TYPE_SERIAL); + _INT_CONST_LIBXL(m, CONSOLE_TYPE_PV); - _INT_CONST_LIBXL(m, CONSBACK_XENCONSOLED); - _INT_CONST_LIBXL(m, CONSBACK_IOEMU); + _INT_CONST_LIBXL(m, CONSOLE_BACKEND_XENCONSOLED); + _INT_CONST_LIBXL(m, CONSOLE_BACKEND_IOEMU); _INT_CONST_LIBXL(m, DISK_FORMAT_UNKNOWN); _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW); @@ -790,11 +790,11 @@ PyMODINIT_FUNC initxl(void) _INT_CONST_LIBXL(m, DISK_BACKEND_TAP); _INT_CONST_LIBXL(m, DISK_BACKEND_QDISK); - _INT_CONST_LIBXL(m, NICTYPE_IOEMU); - _INT_CONST_LIBXL(m, NICTYPE_VIF); + _INT_CONST_LIBXL(m, NIC_TYPE_IOEMU); + _INT_CONST_LIBXL(m, NIC_TYPE_VIF); - _INT_CONST_LIBXL(m, EVENT_DOMAIN_DEATH); - _INT_CONST_LIBXL(m, EVENT_DISK_EJECT); + _INT_CONST_LIBXL(m, EVENT_TYPE_DOMAIN_DEATH); + _INT_CONST_LIBXL(m, EVENT_TYPE_DISK_EJECT); _INT_CONST_LIBXL(m, BUTTON_POWER); _INT_CONST_LIBXL(m, BUTTON_SLEEP); _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 11:38 UTC
[Xen-devel] [PATCH 4 of 4] libxl: add an Enumeration type to the IDL, use it for all enums
# HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1301571244 -3600 # Node ID acb800c269780d7c69dc2a1fd6571c92d4269707 # Parent 6a72a608fe9e8d3639038697fcea0197c59156fe libxl: add an Enumeration type to the IDL, use it for all enums The IDL requires a specific value for each enumerate, this make it much easier to avoid (or at least track) ABI changes since they must now be explicit. I believe I have used the same values as would have been chosen previoulsy but have not confirmed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 6a72a608fe9e -r acb800c26978 tools/libxl/gentypes.py --- a/tools/libxl/gentypes.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/gentypes.py Thu Mar 31 12:34:04 2011 +0100 @@ -34,7 +34,28 @@ def libxl_C_instance_of(ty, instancename def libxl_C_type_define(ty, indent = ""): s = "" - if isinstance(ty, libxltypes.Aggregate): + + if isinstance(ty, libxltypes.Enumeration): + if ty.comment is not None: + s += format_comment(0, ty.comment) + + if ty.typename is None: + s += "enum {\n" + else: + s += "typedef enum {\n" + + for v in ty.values: + if v.comment is not None: + s += format_comment(4, v.comment) + x = "%s = %d" % (v.name, v.value) + x = x.replace("\n", "\n ") + s += " " + x + ",\n" + if ty.typename is None: + s += "}" + else: + s += "} %s" % ty.typename + + elif isinstance(ty, libxltypes.Aggregate): if ty.comment is not None: s += format_comment(0, ty.comment) diff -r 6a72a608fe9e -r acb800c26978 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxl.h Thu Mar 31 12:34:04 2011 +0100 @@ -161,42 +161,6 @@ typedef struct { #define LIBXL_CPUARRAY_INVALID_ENTRY ~0 void libxl_cpuarray_destroy(libxl_cpuarray *array); -typedef enum { - LIBXL_QEMU_MACHINE_TYPE_FV = 1, - LIBXL_QEMU_MACHINE_TYPE_PV, -} libxl_qemu_machine_type; - -typedef enum { - LIBXL_CONSOLE_TYPE_SERIAL = 1, - LIBXL_CONSOLE_TYPE_PV, -} libxl_console_type; - -typedef enum { - LIBXL_CONSOLE_BACKEND_XENCONSOLED, - LIBXL_CONSOLE_BACKEND_IOEMU, -} libxl_console_backend; - -typedef enum { - LIBXL_DISK_FORMAT_UNKNOWN = 0, - LIBXL_DISK_FORMAT_QCOW, - LIBXL_DISK_FORMAT_QCOW2, - LIBXL_DISK_FORMAT_VHD, - LIBXL_DISK_FORMAT_RAW, - LIBXL_DISK_FORMAT_EMPTY, -} libxl_disk_format; - -typedef enum { - LIBXL_DISK_BACKEND_UNKNOWN = 0, - LIBXL_DISK_BACKEND_PHY, - LIBXL_DISK_BACKEND_TAP, - LIBXL_DISK_BACKEND_QDISK, -} libxl_disk_backend; - -typedef enum { - LIBXL_NIC_TYPE_IOEMU = 1, - LIBXL_NIC_TYPE_VIF, -} libxl_nic_type; - typedef struct { /* * Path is always set if the file reference is valid. However if @@ -245,18 +209,6 @@ enum { #define LIBXL_VERSION 0 -typedef enum libxl_action_on_shutdown { - LIBXL_ACTION_ON_SHUTDOWN_DESTROY, - - LIBXL_ACTION_ON_SHUTDOWN_RESTART, - LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME, - - LIBXL_ACTION_ON_SHUTDOWN_PRESERVE, - - LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY, - LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART, -} libxl_action_on_shutdown; - typedef struct { libxl_domain_create_info c_info; libxl_domain_build_info b_info; @@ -321,11 +273,6 @@ int libxl_run_bootloader(libxl_ctx *ctx, /* events handling */ -typedef enum { - LIBXL_EVENT_TYPE_DOMAIN_DEATH, - LIBXL_EVENT_TYPE_DISK_EJECT, -} libxl_event_type; - typedef struct { /* event type */ libxl_event_type type; @@ -486,11 +433,6 @@ int libxl_userdata_retrieve(libxl_ctx *c * On error return, *data_r and *datalen_r are undefined. */ -typedef enum { - LIBXL_BUTTON_POWER, - LIBXL_BUTTON_SLEEP -} libxl_button; - int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button); int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo); diff -r 6a72a608fe9e -r acb800c26978 tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxl.idl Thu Mar 31 12:34:04 2011 +0100 @@ -8,12 +8,6 @@ libxl_uuid = Builtin("uuid") libxl_mac = Builtin("mac") libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE) libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE) -libxl_qemu_machine_type = Number("qemu_machine_type", namespace="libxl_") -libxl_console_backend = Number("console_backend", namespace="libxl_") -libxl_console_type = Number("console_type", namespace="libxl_") -libxl_disk_format = Number("disk_format", namespace="libxl_") -libxl_disk_backend = Number("disk_backend", namespace="libxl_") -libxl_nic_type = Number("nic_type", namespace="libxl_") libxl_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE) libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE) @@ -23,6 +17,68 @@ libxl_file_reference = Builtin("file_ref libxl_hwcap = Builtin("hwcap") # +# Constants / Enumerations +# + +libxl_qemu_machine_type = Enumeration("qemu_machine_type", [ + (1, "FV"), + (2, "PV"), + ]) + +libxl_console_type = Enumeration("console_type", [ + (1, "SERIAL"), + (2, "PV"), + ]) + +libxl_console_backend = Enumeration("console_backend", [ + (1, "XENCONSOLED"), + (2, "IOEMU"), + ]) + +libxl_disk_format = Enumeration("disk_format", [ + (0, "UNKNOWN"), + (1, "QCOW"), + (2, "QCOW2"), + (3, "VHD"), + (4, "RAW"), + (5, "EMPTY"), + ]) + +libxl_disk_backend = Enumeration("disk_backend", [ + (0, "UNKNOWN"), + (1, "PHY"), + (2, "TAP"), + (3, "QDISK"), + ]) + +libxl_nic_type = Enumeration("nic_type", [ + (1, "IOEMU"), + (2, "VIF"), + ]) + +libxl_action_on_shutdown = Enumeration("action_on_shutdown", [ + (1, "DESTROY"), + + (2, "RESTART"), + (3, "RESTART_RENAME"), + + (4, "PRESERVE"), + + (5, "COREDUMP_DESTROY"), + (6, "COREDUMP_RESTART"), + ]) + +libxl_event_type = Enumeration("event_type", [ + (1, "DOMAIN_DEATH"), + (2, "DISK_EJECT"), + ]) + +libxl_button = Enumeration("button", [ + (1, "POWER"), + (2, "SLEEP"), + ]) + +# # Complex libxl types # libxl_dominfo = Struct("dominfo",[ diff -r 6a72a608fe9e -r acb800c26978 tools/libxl/libxltypes.py --- a/tools/libxl/libxltypes.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxltypes.py Thu Mar 31 12:34:04 2011 +0100 @@ -52,6 +52,37 @@ class UInt(Number): self.width = w +class EnumerationValue(object): + def __init__(self, value, name, **kwargs): + kwargs.setdefault("namespace", None) + kwargs.setdefault("typename", None) + + if kwargs["typename"]: + name = kwargs["typename"] + "_" + name + + self.typename = kwargs["typename"] + self.rawname = str.upper(name) + + if kwargs["namespace"]: + name = kwargs["namespace"] + name + + self.name = str.upper(name) + + self.value = value + self.comment = kwargs.setdefault("comment", None) + +class Enumeration(Type): + def __init__(self, typename, values, **kwargs): + kwargs.setdefault(''destructor_fn'', None) + Type.__init__(self, typename, **kwargs) + + self.values = [] + for v in values: + (num,name) = v + self.values.append(EnumerationValue(num, name, + namespace=self.namespace, + typename=self.rawname)) + class BitField(Type): def __init__(self, ty, w, **kwargs): kwargs.setdefault(''namespace'', None) diff -r 6a72a608fe9e -r acb800c26978 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:34:04 2011 +0100 @@ -450,6 +450,8 @@ static int parse_action_on_shutdown(cons for (i = 0; i < sizeof(action_on_shutdown_names) / sizeof(action_on_shutdown_names[0]); i++) { n = action_on_shutdown_names[i]; + if (!n) continue; + if (strcmp(buf, n) == 0) { *a = i; return 1; diff -r 6a72a608fe9e -r acb800c26978 tools/python/genwrap.py --- a/tools/python/genwrap.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/python/genwrap.py Thu Mar 31 12:34:04 2011 +0100 @@ -9,6 +9,8 @@ import libxltypes def py_type(ty): if ty == libxltypes.bool or isinstance(ty, libxltypes.BitField) and ty.width == 1: return TYPE_BOOL + if isinstance(ty, libxltypes.Enumeration): + return TYPE_UINT if isinstance(ty, libxltypes.Number): if ty.signed: return TYPE_INT @@ -34,15 +36,16 @@ def fsanitize(name): def py_decls(ty): l = [] - l.append(''_hidden Py_%s *Py%s_New(void);\n''%(ty.rawname, ty.rawname)) - l.append(''_hidden int Py%s_Check(PyObject *self);\n''%ty.rawname) - for f in ty.fields: - if py_type(f.type) is not None: - continue - l.append(''_hidden PyObject *attrib__%s_get(%s *%s);''%(\ - fsanitize(f.type.typename), f.type.typename, f.name)) - l.append(''_hidden int attrib__%s_set(PyObject *v, %s *%s);''%(\ - fsanitize(f.type.typename), f.type.typename, f.name)) + if isinstance(ty, libxltypes.Aggregate): + l.append(''_hidden Py_%s *Py%s_New(void);\n''%(ty.rawname, ty.rawname)) + l.append(''_hidden int Py%s_Check(PyObject *self);\n''%ty.rawname) + for f in ty.fields: + if py_type(f.type) is not None: + continue + l.append(''_hidden PyObject *attrib__%s_get(%s *%s);''%(\ + fsanitize(f.type.typename), f.type.typename, f.name)) + l.append(''_hidden int attrib__%s_set(PyObject *v, %s *%s);''%(\ + fsanitize(f.type.typename), f.type.typename, f.name)) return ''\n''.join(l) + "\n" def py_attrib_get(ty, f): @@ -189,16 +192,23 @@ def py_initfuncs(types): l.append(''void genwrap__init(PyObject *m)'') l.append(''{'') for ty in types: - l.append('' if (PyType_Ready(&Py%s_Type) >= 0) {''%ty.rawname) - l.append('' Py_INCREF(&Py%s_Type);''%ty.rawname) - l.append('' PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);''%(ty.rawname, ty.rawname)) - l.append('' }'') + if isinstance(ty, libxltypes.Enumeration): + for v in ty.values: + l.append('' PyModule_AddIntConstant(m, "%s", %s);'' % (v.rawname, v.name)) + elif isinstance(ty, libxltypes.Aggregate): + l.append('' if (PyType_Ready(&Py%s_Type) >= 0) {''%ty.rawname) + l.append('' Py_INCREF(&Py%s_Type);''%ty.rawname) + l.append('' PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);''%(ty.rawname, ty.rawname)) + l.append('' }'') + else: + raise NotImplementedError("unknown type %s (%s)" % (ty.typename, type(ty))) + l.append(''}'') return ''\n''.join(l) + "\n\n" def tree_frob(types): ret = types[:] - for ty in ret: + for ty in [ty for ty in ret if isinstance(ty, libxltypes.Aggregate)]: ty.fields = filter(lambda f:f.name is not None and f.type.typename is not None, ty.fields) return ret @@ -249,8 +259,8 @@ _hidden PyObject *genwrap__ll_get(long l _hidden int genwrap__ll_set(PyObject *v, long long *val, long long mask); """ % " ".join(sys.argv)) - for ty in types: - f.write(''/* Internal APU for %s wrapper */\n''%ty.typename) + for ty in [ty for ty in types if isinstance(ty, libxltypes.Aggregate)]: + f.write(''/* Internal API for %s wrapper */\n''%ty.typename) f.write(py_wrapstruct(ty)) f.write(py_decls(ty)) f.write(''\n'') @@ -276,10 +286,11 @@ _hidden int genwrap__ll_set(PyObject *v, """ % tuple(('' ''.join(sys.argv),) + (os.path.split(decls)[-1:]),)) for ty in types: - f.write(''/* Attribute get/set functions for %s */\n''%ty.typename) - for a in ty.fields: - f.write(py_attrib_get(ty,a)) - f.write(py_attrib_set(ty,a)) - f.write(py_object_def(ty)) + if isinstance(ty, libxltypes.Aggregate): + f.write(''/* Attribute get/set functions for %s */\n''%ty.typename) + for a in ty.fields: + f.write(py_attrib_get(ty,a)) + f.write(py_attrib_set(ty,a)) + f.write(py_object_def(ty)) f.write(py_initfuncs(types)) f.close() diff -r 6a72a608fe9e -r acb800c26978 tools/python/xen/lowlevel/xl/xl.c --- a/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:34:04 2011 +0100 @@ -769,35 +769,6 @@ PyMODINIT_FUNC initxl(void) _INT_CONST(m, SHUTDOWN_crash); _INT_CONST(m, SHUTDOWN_watchdog); - _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_FV); - _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_PV); - - _INT_CONST_LIBXL(m, CONSOLE_TYPE_SERIAL); - _INT_CONST_LIBXL(m, CONSOLE_TYPE_PV); - - _INT_CONST_LIBXL(m, CONSOLE_BACKEND_XENCONSOLED); - _INT_CONST_LIBXL(m, CONSOLE_BACKEND_IOEMU); - - _INT_CONST_LIBXL(m, DISK_FORMAT_UNKNOWN); - _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW); - _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW2); - _INT_CONST_LIBXL(m, DISK_FORMAT_VHD); - _INT_CONST_LIBXL(m, DISK_FORMAT_RAW); - _INT_CONST_LIBXL(m, DISK_FORMAT_EMPTY); - - _INT_CONST_LIBXL(m, DISK_BACKEND_UNKNOWN); - _INT_CONST_LIBXL(m, DISK_BACKEND_PHY); - _INT_CONST_LIBXL(m, DISK_BACKEND_TAP); - _INT_CONST_LIBXL(m, DISK_BACKEND_QDISK); - - _INT_CONST_LIBXL(m, NIC_TYPE_IOEMU); - _INT_CONST_LIBXL(m, NIC_TYPE_VIF); - - _INT_CONST_LIBXL(m, EVENT_TYPE_DOMAIN_DEATH); - _INT_CONST_LIBXL(m, EVENT_TYPE_DISK_EJECT); - - _INT_CONST_LIBXL(m, BUTTON_POWER); - _INT_CONST_LIBXL(m, BUTTON_SLEEP); genwrap__init(m); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Campbell
2011-Mar-31 11:42 UTC
[Xen-devel] Re: [PATCH 4 of 4] libxl: add an Enumeration type to the IDL, use it for all enums
I forgot to qrefresh a last minute change (autogen the typedef enum FOO { } FOO syntax) into this version please use the following instead. # HG changeset patch # User Ian Campbell <ian.campbell@citrix.com> # Date 1301571721 -3600 # Node ID a3b5c15e1f8b4abca3db2457cafe719fa26348b8 # Parent 6a72a608fe9e8d3639038697fcea0197c59156fe libxl: add an Enumeration type to the IDL, use it for all enums The IDL requires a specific value for each enumerate, this make it much easier to avoid (or at least track) ABI changes since they must now be explicit. I believe I have used the same values as would have been chosen previoulsy but have not confirmed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/libxl/gentypes.py --- a/tools/libxl/gentypes.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/gentypes.py Thu Mar 31 12:42:01 2011 +0100 @@ -34,7 +34,28 @@ def libxl_C_instance_of(ty, instancename def libxl_C_type_define(ty, indent = ""): s = "" - if isinstance(ty, libxltypes.Aggregate): + + if isinstance(ty, libxltypes.Enumeration): + if ty.comment is not None: + s += format_comment(0, ty.comment) + + if ty.typename is None: + s += "enum {\n" + else: + s += "typedef enum %s {\n" % ty.typename + + for v in ty.values: + if v.comment is not None: + s += format_comment(4, v.comment) + x = "%s = %d" % (v.name, v.value) + x = x.replace("\n", "\n ") + s += " " + x + ",\n" + if ty.typename is None: + s += "}" + else: + s += "} %s" % ty.typename + + elif isinstance(ty, libxltypes.Aggregate): if ty.comment is not None: s += format_comment(0, ty.comment) diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/libxl/libxl.h --- a/tools/libxl/libxl.h Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxl.h Thu Mar 31 12:42:01 2011 +0100 @@ -161,42 +161,6 @@ typedef struct { #define LIBXL_CPUARRAY_INVALID_ENTRY ~0 void libxl_cpuarray_destroy(libxl_cpuarray *array); -typedef enum { - LIBXL_QEMU_MACHINE_TYPE_FV = 1, - LIBXL_QEMU_MACHINE_TYPE_PV, -} libxl_qemu_machine_type; - -typedef enum { - LIBXL_CONSOLE_TYPE_SERIAL = 1, - LIBXL_CONSOLE_TYPE_PV, -} libxl_console_type; - -typedef enum { - LIBXL_CONSOLE_BACKEND_XENCONSOLED, - LIBXL_CONSOLE_BACKEND_IOEMU, -} libxl_console_backend; - -typedef enum { - LIBXL_DISK_FORMAT_UNKNOWN = 0, - LIBXL_DISK_FORMAT_QCOW, - LIBXL_DISK_FORMAT_QCOW2, - LIBXL_DISK_FORMAT_VHD, - LIBXL_DISK_FORMAT_RAW, - LIBXL_DISK_FORMAT_EMPTY, -} libxl_disk_format; - -typedef enum { - LIBXL_DISK_BACKEND_UNKNOWN = 0, - LIBXL_DISK_BACKEND_PHY, - LIBXL_DISK_BACKEND_TAP, - LIBXL_DISK_BACKEND_QDISK, -} libxl_disk_backend; - -typedef enum { - LIBXL_NIC_TYPE_IOEMU = 1, - LIBXL_NIC_TYPE_VIF, -} libxl_nic_type; - typedef struct { /* * Path is always set if the file reference is valid. However if @@ -245,18 +209,6 @@ enum { #define LIBXL_VERSION 0 -typedef enum libxl_action_on_shutdown { - LIBXL_ACTION_ON_SHUTDOWN_DESTROY, - - LIBXL_ACTION_ON_SHUTDOWN_RESTART, - LIBXL_ACTION_ON_SHUTDOWN_RESTART_RENAME, - - LIBXL_ACTION_ON_SHUTDOWN_PRESERVE, - - LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_DESTROY, - LIBXL_ACTION_ON_SHUTDOWN_COREDUMP_RESTART, -} libxl_action_on_shutdown; - typedef struct { libxl_domain_create_info c_info; libxl_domain_build_info b_info; @@ -321,11 +273,6 @@ int libxl_run_bootloader(libxl_ctx *ctx, /* events handling */ -typedef enum { - LIBXL_EVENT_TYPE_DOMAIN_DEATH, - LIBXL_EVENT_TYPE_DISK_EJECT, -} libxl_event_type; - typedef struct { /* event type */ libxl_event_type type; @@ -486,11 +433,6 @@ int libxl_userdata_retrieve(libxl_ctx *c * On error return, *data_r and *datalen_r are undefined. */ -typedef enum { - LIBXL_BUTTON_POWER, - LIBXL_BUTTON_SLEEP -} libxl_button; - int libxl_button_press(libxl_ctx *ctx, uint32_t domid, libxl_button button); int libxl_get_physinfo(libxl_ctx *ctx, libxl_physinfo *physinfo); diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/libxl/libxl.idl --- a/tools/libxl/libxl.idl Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxl.idl Thu Mar 31 12:42:01 2011 +0100 @@ -8,12 +8,6 @@ libxl_uuid = Builtin("uuid") libxl_mac = Builtin("mac") libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE) libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE) -libxl_qemu_machine_type = Number("qemu_machine_type", namespace="libxl_") -libxl_console_backend = Number("console_backend", namespace="libxl_") -libxl_console_type = Number("console_type", namespace="libxl_") -libxl_disk_format = Number("disk_format", namespace="libxl_") -libxl_disk_backend = Number("disk_backend", namespace="libxl_") -libxl_nic_type = Number("nic_type", namespace="libxl_") libxl_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE) libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE) @@ -23,6 +17,68 @@ libxl_file_reference = Builtin("file_ref libxl_hwcap = Builtin("hwcap") # +# Constants / Enumerations +# + +libxl_qemu_machine_type = Enumeration("qemu_machine_type", [ + (1, "FV"), + (2, "PV"), + ]) + +libxl_console_type = Enumeration("console_type", [ + (1, "SERIAL"), + (2, "PV"), + ]) + +libxl_console_backend = Enumeration("console_backend", [ + (1, "XENCONSOLED"), + (2, "IOEMU"), + ]) + +libxl_disk_format = Enumeration("disk_format", [ + (0, "UNKNOWN"), + (1, "QCOW"), + (2, "QCOW2"), + (3, "VHD"), + (4, "RAW"), + (5, "EMPTY"), + ]) + +libxl_disk_backend = Enumeration("disk_backend", [ + (0, "UNKNOWN"), + (1, "PHY"), + (2, "TAP"), + (3, "QDISK"), + ]) + +libxl_nic_type = Enumeration("nic_type", [ + (1, "IOEMU"), + (2, "VIF"), + ]) + +libxl_action_on_shutdown = Enumeration("action_on_shutdown", [ + (1, "DESTROY"), + + (2, "RESTART"), + (3, "RESTART_RENAME"), + + (4, "PRESERVE"), + + (5, "COREDUMP_DESTROY"), + (6, "COREDUMP_RESTART"), + ]) + +libxl_event_type = Enumeration("event_type", [ + (1, "DOMAIN_DEATH"), + (2, "DISK_EJECT"), + ]) + +libxl_button = Enumeration("button", [ + (1, "POWER"), + (2, "SLEEP"), + ]) + +# # Complex libxl types # libxl_dominfo = Struct("dominfo",[ diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/libxl/libxltypes.py --- a/tools/libxl/libxltypes.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/libxltypes.py Thu Mar 31 12:42:01 2011 +0100 @@ -52,6 +52,37 @@ class UInt(Number): self.width = w +class EnumerationValue(object): + def __init__(self, value, name, **kwargs): + kwargs.setdefault("namespace", None) + kwargs.setdefault("typename", None) + + if kwargs["typename"]: + name = kwargs["typename"] + "_" + name + + self.typename = kwargs["typename"] + self.rawname = str.upper(name) + + if kwargs["namespace"]: + name = kwargs["namespace"] + name + + self.name = str.upper(name) + + self.value = value + self.comment = kwargs.setdefault("comment", None) + +class Enumeration(Type): + def __init__(self, typename, values, **kwargs): + kwargs.setdefault(''destructor_fn'', None) + Type.__init__(self, typename, **kwargs) + + self.values = [] + for v in values: + (num,name) = v + self.values.append(EnumerationValue(num, name, + namespace=self.namespace, + typename=self.rawname)) + class BitField(Type): def __init__(self, ty, w, **kwargs): kwargs.setdefault(''namespace'', None) diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Thu Mar 31 12:42:01 2011 +0100 @@ -450,6 +450,8 @@ static int parse_action_on_shutdown(cons for (i = 0; i < sizeof(action_on_shutdown_names) / sizeof(action_on_shutdown_names[0]); i++) { n = action_on_shutdown_names[i]; + if (!n) continue; + if (strcmp(buf, n) == 0) { *a = i; return 1; diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/python/genwrap.py --- a/tools/python/genwrap.py Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/python/genwrap.py Thu Mar 31 12:42:01 2011 +0100 @@ -9,6 +9,8 @@ import libxltypes def py_type(ty): if ty == libxltypes.bool or isinstance(ty, libxltypes.BitField) and ty.width == 1: return TYPE_BOOL + if isinstance(ty, libxltypes.Enumeration): + return TYPE_UINT if isinstance(ty, libxltypes.Number): if ty.signed: return TYPE_INT @@ -34,15 +36,16 @@ def fsanitize(name): def py_decls(ty): l = [] - l.append(''_hidden Py_%s *Py%s_New(void);\n''%(ty.rawname, ty.rawname)) - l.append(''_hidden int Py%s_Check(PyObject *self);\n''%ty.rawname) - for f in ty.fields: - if py_type(f.type) is not None: - continue - l.append(''_hidden PyObject *attrib__%s_get(%s *%s);''%(\ - fsanitize(f.type.typename), f.type.typename, f.name)) - l.append(''_hidden int attrib__%s_set(PyObject *v, %s *%s);''%(\ - fsanitize(f.type.typename), f.type.typename, f.name)) + if isinstance(ty, libxltypes.Aggregate): + l.append(''_hidden Py_%s *Py%s_New(void);\n''%(ty.rawname, ty.rawname)) + l.append(''_hidden int Py%s_Check(PyObject *self);\n''%ty.rawname) + for f in ty.fields: + if py_type(f.type) is not None: + continue + l.append(''_hidden PyObject *attrib__%s_get(%s *%s);''%(\ + fsanitize(f.type.typename), f.type.typename, f.name)) + l.append(''_hidden int attrib__%s_set(PyObject *v, %s *%s);''%(\ + fsanitize(f.type.typename), f.type.typename, f.name)) return ''\n''.join(l) + "\n" def py_attrib_get(ty, f): @@ -189,16 +192,23 @@ def py_initfuncs(types): l.append(''void genwrap__init(PyObject *m)'') l.append(''{'') for ty in types: - l.append('' if (PyType_Ready(&Py%s_Type) >= 0) {''%ty.rawname) - l.append('' Py_INCREF(&Py%s_Type);''%ty.rawname) - l.append('' PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);''%(ty.rawname, ty.rawname)) - l.append('' }'') + if isinstance(ty, libxltypes.Enumeration): + for v in ty.values: + l.append('' PyModule_AddIntConstant(m, "%s", %s);'' % (v.rawname, v.name)) + elif isinstance(ty, libxltypes.Aggregate): + l.append('' if (PyType_Ready(&Py%s_Type) >= 0) {''%ty.rawname) + l.append('' Py_INCREF(&Py%s_Type);''%ty.rawname) + l.append('' PyModule_AddObject(m, "%s", (PyObject *)&Py%s_Type);''%(ty.rawname, ty.rawname)) + l.append('' }'') + else: + raise NotImplementedError("unknown type %s (%s)" % (ty.typename, type(ty))) + l.append(''}'') return ''\n''.join(l) + "\n\n" def tree_frob(types): ret = types[:] - for ty in ret: + for ty in [ty for ty in ret if isinstance(ty, libxltypes.Aggregate)]: ty.fields = filter(lambda f:f.name is not None and f.type.typename is not None, ty.fields) return ret @@ -249,8 +259,8 @@ _hidden PyObject *genwrap__ll_get(long l _hidden int genwrap__ll_set(PyObject *v, long long *val, long long mask); """ % " ".join(sys.argv)) - for ty in types: - f.write(''/* Internal APU for %s wrapper */\n''%ty.typename) + for ty in [ty for ty in types if isinstance(ty, libxltypes.Aggregate)]: + f.write(''/* Internal API for %s wrapper */\n''%ty.typename) f.write(py_wrapstruct(ty)) f.write(py_decls(ty)) f.write(''\n'') @@ -276,10 +286,11 @@ _hidden int genwrap__ll_set(PyObject *v, """ % tuple(('' ''.join(sys.argv),) + (os.path.split(decls)[-1:]),)) for ty in types: - f.write(''/* Attribute get/set functions for %s */\n''%ty.typename) - for a in ty.fields: - f.write(py_attrib_get(ty,a)) - f.write(py_attrib_set(ty,a)) - f.write(py_object_def(ty)) + if isinstance(ty, libxltypes.Aggregate): + f.write(''/* Attribute get/set functions for %s */\n''%ty.typename) + for a in ty.fields: + f.write(py_attrib_get(ty,a)) + f.write(py_attrib_set(ty,a)) + f.write(py_object_def(ty)) f.write(py_initfuncs(types)) f.close() diff -r 6a72a608fe9e -r a3b5c15e1f8b tools/python/xen/lowlevel/xl/xl.c --- a/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:33:54 2011 +0100 +++ b/tools/python/xen/lowlevel/xl/xl.c Thu Mar 31 12:42:01 2011 +0100 @@ -769,35 +769,6 @@ PyMODINIT_FUNC initxl(void) _INT_CONST(m, SHUTDOWN_crash); _INT_CONST(m, SHUTDOWN_watchdog); - _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_FV); - _INT_CONST_LIBXL(m, QEMU_MACHINE_TYPE_PV); - - _INT_CONST_LIBXL(m, CONSOLE_TYPE_SERIAL); - _INT_CONST_LIBXL(m, CONSOLE_TYPE_PV); - - _INT_CONST_LIBXL(m, CONSOLE_BACKEND_XENCONSOLED); - _INT_CONST_LIBXL(m, CONSOLE_BACKEND_IOEMU); - - _INT_CONST_LIBXL(m, DISK_FORMAT_UNKNOWN); - _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW); - _INT_CONST_LIBXL(m, DISK_FORMAT_QCOW2); - _INT_CONST_LIBXL(m, DISK_FORMAT_VHD); - _INT_CONST_LIBXL(m, DISK_FORMAT_RAW); - _INT_CONST_LIBXL(m, DISK_FORMAT_EMPTY); - - _INT_CONST_LIBXL(m, DISK_BACKEND_UNKNOWN); - _INT_CONST_LIBXL(m, DISK_BACKEND_PHY); - _INT_CONST_LIBXL(m, DISK_BACKEND_TAP); - _INT_CONST_LIBXL(m, DISK_BACKEND_QDISK); - - _INT_CONST_LIBXL(m, NIC_TYPE_IOEMU); - _INT_CONST_LIBXL(m, NIC_TYPE_VIF); - - _INT_CONST_LIBXL(m, EVENT_TYPE_DOMAIN_DEATH); - _INT_CONST_LIBXL(m, EVENT_TYPE_DISK_EJECT); - - _INT_CONST_LIBXL(m, BUTTON_POWER); - _INT_CONST_LIBXL(m, BUTTON_SLEEP); genwrap__init(m); } _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Mar-31 18:39 UTC
Re: [Xen-devel] [PATCH 1 of 4] libxl: typedef libxl_action_on_shutdown
Ian Campbell writes ("[Xen-devel] [PATCH 1 of 4] libxl: typedef libxl_action_on_shutdown"):> libxl: typedef libxl_action_on_shutdownAcked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Mar-31 18:40 UTC
Re: [Xen-devel] [PATCH 2 of 4] libxl: move all enum values into the libxl namespace
Ian Campbell writes ("[Xen-devel] [PATCH 2 of 4] libxl: move all enum values into the libxl namespace"):> libxl: move all enum values into the libxl namespaceI''m afraid this one needs to be refreshed ... Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2011-Mar-31 18:41 UTC
[Xen-devel] Re: [PATCH 4 of 4] libxl: add an Enumeration type to the IDL, use it for all enums
Ian Campbell writes ("[Xen-devel] Re: [PATCH 4 of 4] libxl: add an Enumeration type to the IDL, use it for all enums"):> I forgot to qrefresh a last minute change (autogen the typedef enum FOO > { } FOO syntax) into this version please use the following instead.I think this probably needs to be refreshed too. Can you repost the series ? It might be easier if you posted your current patch queue in a single series. Thanks, Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel