[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 0 of 4] Domain creation for python libxl binding v2
This is a repost of patches 7 through 10 from 'libxl python binding updates'. The main change is to remove an undocumented change to libxl API regarding the const char *features field in domain_build_info struct. These are now handled correctly in the python binding without changing the libxl API. The patches have also been tidied up and some parts re-based relative to each other so that redundant changes are removed and the split is more logical. Below is the diff between all libxl C code before and after applying this series. Gianni -- diff -purN libxl.1/libxl_create.c libxl.2/libxl_create.c --- libxl.1/libxl_create.c 2011-01-12 14:08:36.651279949 +0000 +++ libxl.2/libxl_create.c 2011-01-12 14:16:34.226240348 +0000 @@ -27,39 +27,6 @@ #include "libxl_internal.h" #include "flexarray.h" -void libxl_domain_config_destroy(libxl_domain_config *d_config) -{ - int i; - - for (i=0; i<d_config->num_disks; i++) - libxl_device_disk_destroy(&d_config->disks[i]); - free(d_config->disks); - - for (i=0; i<d_config->num_vifs; i++) - libxl_device_nic_destroy(&d_config->vifs[i]); - free(d_config->vifs); - - for (i=0; i<d_config->num_vif2s; i++) - libxl_device_net2_destroy(&d_config->vif2s[i]); - free(d_config->vif2s); - - for (i=0; i<d_config->num_pcidevs; i++) - libxl_device_pci_destroy(&d_config->pcidevs[i]); - free(d_config->pcidevs); - - for (i=0; i<d_config->num_vfbs; i++) - libxl_device_vfb_destroy(&d_config->vfbs[i]); - free(d_config->vfbs); - - for (i=0; i<d_config->num_vkbs; i++) - libxl_device_vkb_destroy(&d_config->vkbs[i]); - free(d_config->vkbs); - - libxl_domain_create_info_destroy(&d_config->c_info); - libxl_domain_build_info_destroy(&d_config->b_info); - libxl_device_model_info_destroy(&d_config->dm_info); -} - void libxl_init_create_info(libxl_domain_create_info *c_info) { memset(c_info, '\0', sizeof(*c_info)); diff -purN libxl.1/libxl.h libxl.2/libxl.h --- libxl.1/libxl.h 2011-01-12 14:08:36.651279949 +0000 +++ libxl.2/libxl.h 2011-01-12 14:16:34.226240348 +0000 @@ -205,6 +205,18 @@ typedef struct libxl__cpuid_policy libxl typedef libxl_cpuid_policy * libxl_cpuid_policy_list; void libxl_cpuid_destroy(libxl_cpuid_policy_list *cpuid_list); +enum libxl_action_on_shutdown { + LIBXL_ACTION_DESTROY, + + LIBXL_ACTION_RESTART, + LIBXL_ACTION_RESTART_RENAME, + + LIBXL_ACTION_PRESERVE, + + LIBXL_ACTION_COREDUMP_DESTROY, + LIBXL_ACTION_COREDUMP_RESTART, +}; + #define LIBXL_PCI_FUNC_ALL (~0U) #include "_libxl_types.h" @@ -241,38 +253,6 @@ enum { #define LIBXL_VERSION 0 -enum libxl_action_on_shutdown { - LIBXL_ACTION_DESTROY, - - LIBXL_ACTION_RESTART, - LIBXL_ACTION_RESTART_RENAME, - - LIBXL_ACTION_PRESERVE, - - LIBXL_ACTION_COREDUMP_DESTROY, - LIBXL_ACTION_COREDUMP_RESTART, -}; - -typedef struct { - libxl_domain_create_info c_info; - libxl_domain_build_info b_info; - libxl_device_model_info dm_info; - - int num_disks, num_vifs, num_vif2s, num_pcidevs, num_vfbs, num_vkbs; - - libxl_device_disk *disks; - libxl_device_nic *vifs; - libxl_device_net2 *vif2s; - libxl_device_pci *pcidevs; - 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_domain_config; - /* context functions */ int libxl_ctx_init(libxl_ctx *ctx, int version, xentoollog_logger*); int libxl_ctx_free(libxl_ctx *ctx); @@ -286,7 +266,6 @@ void libxl_init_dm_info(libxl_device_mod typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv); int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid); int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd); -void libxl_domain_config_destroy(libxl_domain_config *d_config); int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info, uint32_t domid, int fd); int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid); diff -purN libxl.1/_libxl_types.c libxl.2/_libxl_types.c --- libxl.1/_libxl_types.c 2011-01-12 14:08:36.661284022 +0000 +++ libxl.2/_libxl_types.c 2011-01-12 14:16:34.226240348 +0000 @@ -159,3 +159,30 @@ void libxl_net2info_destroy(libxl_net2in memset(p, LIBXL_DTOR_POISON, sizeof(*p)); } +void libxl_domain_config_destroy(libxl_domain_config *p) +{ + int i; + libxl_domain_create_info_destroy(&p->c_info); + libxl_domain_build_info_destroy(&p->b_info); + libxl_device_model_info_destroy(&p->dm_info); + for(i = 0; i < p->num_disks; i++) + libxl_device_disk_destroy(&p->disks[i]); + free(p->disks); + for(i = 0; i < p->num_vifs; i++) + libxl_device_nic_destroy(&p->vifs[i]); + free(p->vifs); + for(i = 0; i < p->num_vif2s; i++) + libxl_device_net2_destroy(&p->vif2s[i]); + free(p->vif2s); + for(i = 0; i < p->num_pcidevs; i++) + libxl_device_pci_destroy(&p->pcidevs[i]); + free(p->pcidevs); + for(i = 0; i < p->num_vfbs; i++) + libxl_device_vfb_destroy(&p->vfbs[i]); + free(p->vfbs); + for(i = 0; i < p->num_vkbs; i++) + libxl_device_vkb_destroy(&p->vkbs[i]); + free(p->vkbs); + memset(p, LIBXL_DTOR_POISON, sizeof(*p)); +} + diff -purN libxl.1/_libxl_types.h libxl.2/_libxl_types.h --- libxl.1/_libxl_types.h 2011-01-12 14:08:36.661284022 +0000 +++ libxl.2/_libxl_types.h 2011-01-12 14:16:34.226240348 +0000 @@ -453,4 +453,27 @@ typedef struct { } libxl_net2info; void libxl_net2info_destroy(libxl_net2info *p); +typedef struct { + libxl_domain_create_info c_info; + libxl_domain_build_info b_info; + libxl_device_model_info dm_info; + int num_disks; + libxl_device_disk * disks; + int num_vifs; + libxl_device_nic * vifs; + int num_vif2s; + libxl_device_net2 * vif2s; + int num_pcidevs; + libxl_device_pci * pcidevs; + int num_vfbs; + libxl_device_vfb * vfbs; + int num_vkbs; + 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_domain_config; +void libxl_domain_config_destroy(libxl_domain_config *p); + #endif /* __LIBXL_TYPES_H */ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |