[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 03 of 27 v3] libxl: idl: use "dispose" rather than "destroy" for function to free IDL types
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1318930555 -3600 # Node ID d71e77d3fbf19c4c986c519f4805dee113f5f622 # Parent 450a1d48932c74e8ca24239ebe88c3f71f1b64e5 libxl: idl: use "dispose" rather than "destroy" for function to free IDL types Destroy is an overloaded term which would commonly like to be used for actual destructive operations, such as destroying a domain etc. Dispose isn't a great term but it does the job. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/gentest.py --- a/tools/libxl/gentest.py Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/gentest.py Tue Oct 18 10:35:55 2011 +0100 @@ -256,8 +256,8 @@ int main(int argc, char **argv) f.write(" printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename) f.write(" if (s == NULL) abort();\n") f.write(" free(s);\n") - if ty.destructor_fn is not None: - f.write(" %s(&%s_val);\n" % (ty.destructor_fn, ty.typename)) + if ty.dispose_fn is not None: + f.write(" %s(&%s_val);\n" % (ty.dispose_fn, ty.typename)) f.write("\n") f.write(" printf(\"Testing Enumerations\\n\");\n") diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/gentypes.py --- a/tools/libxl/gentypes.py Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/gentypes.py Tue Oct 18 10:35:55 2011 +0100 @@ -74,7 +74,7 @@ def libxl_C_type_define(ty, indent = "") raise NotImplementedError("%s" % type(ty)) return s.replace("\n", "\n%s" % indent) -def libxl_C_type_destroy(ty, v, indent = " ", parent = None): +def libxl_C_type_dispose(ty, v, indent = " ", parent = None): s = "" if isinstance(ty, libxltypes.KeyedUnion): if parent is None: @@ -83,16 +83,16 @@ def libxl_C_type_destroy(ty, v, indent = for f in ty.fields: (nparent,fexpr) = ty.member(v, f, parent is None) s += "case %s:\n" % f.enumname - s += libxl_C_type_destroy(f.type, fexpr, indent + " ", nparent) + s += libxl_C_type_dispose(f.type, fexpr, indent + " ", nparent) s += " break;\n" s += "}\n" - elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.destructor_fn is None): + elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.dispose_fn is None): for f in [f for f in ty.fields if not f.const]: (nparent,fexpr) = ty.member(v, f, parent is None) - s += libxl_C_type_destroy(f.type, fexpr, "", nparent) + s += libxl_C_type_dispose(f.type, fexpr, "", nparent) else: - if ty.destructor_fn is not None: - s += "%s(%s);\n" % (ty.destructor_fn, ty.pass_arg(v, parent is None)) + if ty.dispose_fn is not None: + s += "%s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, parent is None)) if s != "": s = indent + s @@ -217,8 +217,8 @@ if __name__ == '__main__': for ty in types: f.write(libxl_C_type_define(ty) + ";\n") - if ty.destructor_fn is not None: - f.write("void %s(%s);\n" % (ty.destructor_fn, ty.make_arg("p"))) + if ty.dispose_fn is not None: + f.write("void %s(%s);\n" % (ty.dispose_fn, ty.make_arg("p"))) if ty.json_fn is not None: f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" % (ty.typename, ty.make_arg("p"))) if isinstance(ty, libxltypes.Enumeration): @@ -277,10 +277,10 @@ if __name__ == '__main__': """ % " ".join(sys.argv)) - for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]: - f.write("void %s(%s)\n" % (ty.destructor_fn, ty.make_arg("p"))) + for ty in [t for t in types if t.dispose_fn is not None and t.autogenerate_dispose_fn]: + f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p"))) f.write("{\n") - f.write(libxl_C_type_destroy(ty, "p")) + f.write(libxl_C_type_dispose(ty, "p")) f.write(" memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n") f.write("}\n") f.write("\n") diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/idl.txt --- a/tools/libxl/idl.txt Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/idl.txt Tue Oct 18 10:35:55 2011 +0100 @@ -39,14 +39,14 @@ Type.passby: (default: libxltypes.PASS_B libxltypes.PASS_BY_VALUE libxltypes.PASS_BY_REFERENCE -Type.destructor_fn: (default: typename + "_destroy" or None if type == None) +Type.dispose_fn: (default: typename + "_dispose" or None if type == None) The name of the C function which will free all dynamically allocated memory contained within this type (but not the type itself). -Type.autogenerate_destructor: (default: True) +Type.autogenerate_dispose_fn: (default: True) - Indicates if the above named Type.destructor_fn should be + Indicates if the above named Type.dispose_fn should be autogenerated. Type.json_fn: (default: typename + "_gen_json" or None if type == None) diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl.c --- a/tools/libxl/libxl.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl.c Tue Oct 18 10:35:55 2011 +0100 @@ -87,12 +87,12 @@ int libxl_ctx_free(libxl_ctx *ctx) { if (!ctx) return 0; if (ctx->xch) xc_interface_close(ctx->xch); - libxl_version_info_destroy(&ctx->version_info); + libxl_version_info_dispose(&ctx->version_info); if (ctx->xsh) xs_daemon_close(ctx->xsh); return 0; } -void libxl_string_list_destroy(libxl_string_list *psl) +void libxl_string_list_dispose(libxl_string_list *psl) { int i; libxl_string_list sl = *psl; @@ -105,7 +105,7 @@ void libxl_string_list_destroy(libxl_str free(sl); } -void libxl_key_value_list_destroy(libxl_key_value_list *pkvl) +void libxl_key_value_list_dispose(libxl_key_value_list *pkvl) { int i; libxl_key_value_list kvl = *pkvl; @@ -767,7 +767,7 @@ int libxl_domain_destroy(libxl_ctx *ctx, libxl__qmp_cleanup(&gc, domid); } if (libxl__devices_destroy(&gc, domid, force) < 0) - LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid); + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_devices_dispose failed for %d", domid); vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path)); if (vm_path) @@ -1641,7 +1641,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, u } out: for (i = 0; i < num; i++) - libxl_device_disk_destroy(&disks[i]); + libxl_device_disk_dispose(&disks[i]); free(disks); return ret; } @@ -2241,7 +2241,7 @@ fail: xc_hypercall_buffer_free(ctx->xch, coremap); xc_hypercall_buffer_free(ctx->xch, socketmap); xc_hypercall_buffer_free(ctx->xch, nodemap); - libxl_topologyinfo_destroy(info); + libxl_topologyinfo_dispose(info); return ERROR_FAIL; } @@ -2722,7 +2722,7 @@ int libxl_tmem_freeable(libxl_ctx *ctx) return rc; } -void libxl_file_reference_destroy(libxl_file_reference *f) +void libxl_file_reference_dispose(libxl_file_reference *f) { libxl__file_reference_unmap(f); free(f->path); @@ -2852,7 +2852,7 @@ int libxl_destroy_cpupool(libxl_ctx *ctx rc = 0; out1: - libxl_cpumap_destroy(&cpumap); + libxl_cpumap_dispose(&cpumap); out: xc_cpupool_infofree(ctx->xch, info); libxl__free_all(&gc); @@ -2941,10 +2941,10 @@ int libxl_cpupool_cpuadd_node(libxl_ctx } } - libxl_topologyinfo_destroy(&topology); + libxl_topologyinfo_dispose(&topology); out: - libxl_cpumap_destroy(&freemap); + libxl_cpumap_dispose(&freemap); return rc; } @@ -2993,11 +2993,11 @@ int libxl_cpupool_cpuremove_node(libxl_c } } - libxl_topologyinfo_destroy(&topology); + libxl_topologyinfo_dispose(&topology); out: for (p = 0; p < n_pools; p++) { - libxl_cpupoolinfo_destroy(poolinfo + p); + libxl_cpupoolinfo_dispose(poolinfo + p); } return ret; diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl.h Tue Oct 18 10:35:55 2011 +0100 @@ -144,10 +144,10 @@ typedef uint8_t libxl_mac[6]; #define LIBXL_MAC_BYTES(mac) mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] typedef char **libxl_string_list; -void libxl_string_list_destroy(libxl_string_list *sl); +void libxl_string_list_dispose(libxl_string_list *sl); typedef char **libxl_key_value_list; -void libxl_key_value_list_destroy(libxl_key_value_list *kvl); +void libxl_key_value_list_dispose(libxl_key_value_list *kvl); typedef uint32_t libxl_hwcap[8]; @@ -155,14 +155,14 @@ typedef struct { uint32_t size; /* number of bytes in map */ uint8_t *map; } libxl_cpumap; -void libxl_cpumap_destroy(libxl_cpumap *map); +void libxl_cpumap_dispose(libxl_cpumap *map); typedef struct { uint32_t entries; uint32_t *array; } libxl_cpuarray; #define LIBXL_CPUARRAY_INVALID_ENTRY ~0 -void libxl_cpuarray_destroy(libxl_cpuarray *array); +void libxl_cpuarray_dispose(libxl_cpuarray *array); typedef struct { /* @@ -174,7 +174,7 @@ typedef struct { void * data; size_t size; } libxl_file_reference; -void libxl_file_reference_destroy(libxl_file_reference *p); +void libxl_file_reference_dispose(libxl_file_reference *p); /* libxl_cpuid_policy_list is a dynamic array storing CPUID policies * for multiple leafs. It is terminated with an entry holding @@ -182,7 +182,7 @@ void libxl_file_reference_destroy(libxl_ */ typedef struct libxl__cpuid_policy libxl_cpuid_policy; typedef libxl_cpuid_policy * libxl_cpuid_policy_list; -void libxl_cpuid_destroy(libxl_cpuid_policy_list *cpuid_list); +void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list); #define LIBXL_PCI_FUNC_ALL (~0U) @@ -261,7 +261,7 @@ int libxl_init_dm_info(libxl_ctx *ctx, 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); +void libxl_domain_config_dispose(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 -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl_cpuid.c --- a/tools/libxl/libxl_cpuid.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl_cpuid.c Tue Oct 18 10:35:55 2011 +0100 @@ -16,7 +16,7 @@ #include "libxl_osdeps.h" #include "libxl_internal.h" -void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list) +void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list) { int i, j; libxl_cpuid_policy_list cpuid_list = *p_cpuid_list; diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl_create.c --- a/tools/libxl/libxl_create.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl_create.c Tue Oct 18 10:35:55 2011 +0100 @@ -31,33 +31,33 @@ #include "libxl_internal.h" #include "flexarray.h" -void libxl_domain_config_destroy(libxl_domain_config *d_config) +void libxl_domain_config_dispose(libxl_domain_config *d_config) { int i; for (i=0; i<d_config->num_disks; i++) - libxl_device_disk_destroy(&d_config->disks[i]); + libxl_device_disk_dispose(&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]); + libxl_device_nic_dispose(&d_config->vifs[i]); free(d_config->vifs); for (i=0; i<d_config->num_pcidevs; i++) - libxl_device_pci_destroy(&d_config->pcidevs[i]); + libxl_device_pci_dispose(&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]); + libxl_device_vfb_dispose(&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]); + libxl_device_vkb_dispose(&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); + libxl_domain_create_info_dispose(&d_config->c_info); + libxl_domain_build_info_dispose(&d_config->b_info); + libxl_device_model_info_dispose(&d_config->dm_info); } int libxl_init_create_info(libxl_ctx *ctx, libxl_domain_create_info *c_info) @@ -512,7 +512,7 @@ static int do_domain_create(libxl__gc *g if ( ret ) goto error_out; libxl__device_console_add(gc, domid, &console, &state); - libxl_device_console_destroy(&console); + libxl_device_console_dispose(&console); dm_info->domid = domid; ret = libxl__create_device_model(gc, dm_info, @@ -549,7 +549,7 @@ static int do_domain_create(libxl__gc *g console.consback = LIBXL_CONSOLE_BACKEND_IOEMU; libxl__device_console_add(gc, domid, &console, &state); - libxl_device_console_destroy(&console); + libxl_device_console_dispose(&console); if (need_qemu) { /* only copy those useful configs */ diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl_types.idl --- a/tools/libxl/libxl_types.idl Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl_types.idl Tue Oct 18 10:35:55 2011 +0100 @@ -8,13 +8,13 @@ namespace("libxl_") libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json = False) libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE) libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE) -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_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE) +libxl_cpumap = Builtin("cpumap", dispose_fn="libxl_cpumap_dispose", passby=PASS_BY_REFERENCE) +libxl_cpuarray = Builtin("cpuarray", dispose_fn="libxl_cpuarray_dispose", passby=PASS_BY_REFERENCE) +libxl_cpuid_policy_list = Builtin("cpuid_policy_list", dispose_fn="libxl_cpuid_dispose", passby=PASS_BY_REFERENCE) -libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE) -libxl_key_value_list = Builtin("key_value_list", destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE) -libxl_file_reference = Builtin("file_reference", destructor_fn="libxl_file_reference_destroy", passby=PASS_BY_REFERENCE) +libxl_string_list = Builtin("string_list", dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE) +libxl_key_value_list = Builtin("key_value_list", dispose_fn="libxl_key_value_list_dispose", passby=PASS_BY_REFERENCE) +libxl_file_reference = Builtin("file_reference", dispose_fn="libxl_file_reference_dispose", passby=PASS_BY_REFERENCE) libxl_hwcap = Builtin("hwcap", passby=PASS_BY_REFERENCE) @@ -109,7 +109,7 @@ SHUTDOWN_* constant."""), ("cpu_time", uint64), ("vcpu_max_id", uint32), ("vcpu_online", uint32), - ], destructor_fn=None) + ], dispose_fn=None) libxl_cpupoolinfo = Struct("cpupoolinfo", [ ("poolid", uint32), @@ -121,7 +121,7 @@ libxl_cpupoolinfo = Struct("cpupoolinfo" libxl_vminfo = Struct("vminfo", [ ("uuid", libxl_uuid), ("domid", libxl_domid), - ], destructor_fn=None) + ], dispose_fn=None) libxl_version_info = Struct("version_info", [ ("xen_version_major", integer), @@ -362,7 +362,7 @@ libxl_physinfo = Struct("physinfo", [ ("nr_nodes", uint32), ("hw_cap", libxl_hwcap), ("phys_cap", uint32), - ], destructor_fn=None, dir=DIR_OUT) + ], dispose_fn=None, dir=DIR_OUT) libxl_topologyinfo = Struct("topologyinfo", [ ("coremap", libxl_cpuarray, False, "cpu to core map"), @@ -373,4 +373,4 @@ libxl_topologyinfo = Struct("topologyinf libxl_sched_credit = Struct("sched_credit", [ ("weight", integer), ("cap", integer), - ], destructor_fn=None) + ], dispose_fn=None) diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxl_utils.c --- a/tools/libxl/libxl_utils.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxl_utils.c Tue Oct 18 10:35:55 2011 +0100 @@ -157,7 +157,7 @@ int libxl_name_to_cpupoolid(libxl_ctx *c } free(poolname); } - libxl_cpupoolinfo_destroy(poolinfo + i); + libxl_cpupoolinfo_dispose(poolinfo + i); } free(poolinfo); return ret; @@ -478,7 +478,7 @@ int libxl_mac_to_device_nic(libxl_ctx *c } for (i=0; i<nb; i++) - libxl_nicinfo_destroy(&nics[i]); + libxl_nicinfo_dispose(&nics[i]); free(nics); return rc; } @@ -579,7 +579,7 @@ int libxl_cpumap_alloc(libxl_ctx *ctx, l return 0; } -void libxl_cpumap_destroy(libxl_cpumap *map) +void libxl_cpumap_dispose(libxl_cpumap *map) { free(map->map); } @@ -624,7 +624,7 @@ int libxl_cpuarray_alloc(libxl_ctx *ctx, return 0; } -void libxl_cpuarray_destroy(libxl_cpuarray *array) +void libxl_cpuarray_dispose(libxl_cpuarray *array) { free(array->array); } diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/libxltypes.py --- a/tools/libxl/libxltypes.py Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/libxltypes.py Tue Oct 18 10:35:55 2011 +0100 @@ -44,11 +44,11 @@ class Type(object): self.rawname = typename if self.typename is not None: - self.destructor_fn = kwargs.setdefault('destructor_fn', self.typename + "_destroy") + self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose") else: - self.destructor_fn = kwargs.setdefault('destructor_fn', None) + self.dispose_fn = kwargs.setdefault('dispose_fn', None) - self.autogenerate_destructor = kwargs.setdefault('autogenerate_destructor', True) + self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True) if self.typename is not None: self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json") @@ -88,15 +88,15 @@ class Type(object): class Builtin(Type): """Builtin type""" def __init__(self, typename, **kwargs): - kwargs.setdefault('destructor_fn', None) - kwargs.setdefault('autogenerate_destructor', False) + kwargs.setdefault('dispose_fn', None) + kwargs.setdefault('autogenerate_dispose_fn', False) kwargs.setdefault('autogenerate_json', False) Type.__init__(self, typename, **kwargs) class Number(Builtin): def __init__(self, ctype, **kwargs): kwargs.setdefault('namespace', None) - kwargs.setdefault('destructor_fn', None) + kwargs.setdefault('dispose_fn', None) kwargs.setdefault('signed', False) kwargs.setdefault('json_fn', "yajl_gen_integer") self.signed = kwargs['signed'] @@ -105,7 +105,7 @@ class Number(Builtin): class UInt(Number): def __init__(self, w, **kwargs): kwargs.setdefault('namespace', None) - kwargs.setdefault('destructor_fn', None) + kwargs.setdefault('dispose_fn', None) Number.__init__(self, "uint%d_t" % w, **kwargs) self.width = w @@ -122,7 +122,7 @@ class EnumerationValue(object): class Enumeration(Type): def __init__(self, typename, values, **kwargs): - kwargs.setdefault('destructor_fn', None) + kwargs.setdefault('dispose_fn', None) Type.__init__(self, typename, **kwargs) self.values = [] @@ -205,7 +205,7 @@ class Union(Aggregate): # union therefore any specific instance of this class will # need to provide an explicit destructor function. kwargs.setdefault('passby', PASS_BY_REFERENCE) - kwargs.setdefault('destructor_fn', None) + kwargs.setdefault('dispose_fn', None) Aggregate.__init__(self, "union", name, fields, **kwargs) class KeyedUnion(Aggregate): @@ -244,7 +244,7 @@ uint16 = UInt(16) uint32 = UInt(32) uint64 = UInt(64) -string = Builtin("char *", namespace = None, destructor_fn = "free", +string = Builtin("char *", namespace = None, dispose_fn = "free", json_fn = "libxl__string_gen_json", autogenerate_json = False) diff -r 450a1d48932c -r d71e77d3fbf1 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/libxl/xl_cmdimpl.c Tue Oct 18 10:35:55 2011 +0100 @@ -1685,7 +1685,7 @@ start: 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); + libxl_device_disk_dispose(&disk); } break; } @@ -1701,7 +1701,7 @@ out: if (logfile != 2) close(logfile); - libxl_domain_config_destroy(&d_config); + libxl_domain_config_dispose(&d_config); free(config_data); @@ -2047,7 +2047,7 @@ static void pcilist(const char *dom) printf("%02x.%01x %04x:%02x:%02x.%01x\n", (pcidevs[i].vdevfn >> 3) & 0x1f, pcidevs[i].vdevfn & 0x7, pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func); - libxl_device_pci_destroy(&pcidevs[i]); + libxl_device_pci_dispose(&pcidevs[i]); } free(pcidevs); } @@ -2078,7 +2078,7 @@ static void pcidetach(const char *dom, c exit(2); } libxl_device_pci_remove(ctx, domid, &pcidev, force); - libxl_device_pci_destroy(&pcidev); + libxl_device_pci_dispose(&pcidev); } int main_pcidetach(int argc, char **argv) @@ -2115,7 +2115,7 @@ static void pciattach(const char *dom, c exit(2); } libxl_device_pci_add(ctx, domid, &pcidev); - libxl_device_pci_destroy(&pcidev); + libxl_device_pci_dispose(&pcidev); } int main_pciattach(int argc, char **argv) @@ -2231,7 +2231,7 @@ static void list_domains_details(const l memset(&d_config, 0x00, sizeof(d_config)); parse_config_data(config_file, (char *)data, len, &d_config, &dm_info); printf_info(info[i].domid, &d_config, &dm_info); - libxl_domain_config_destroy(&d_config); + libxl_domain_config_dispose(&d_config); free(data); free(config_file); } @@ -3323,7 +3323,7 @@ static void print_domain_vcpuinfo(uint32 for (i = 0; i < nb_vcpu; i++) { print_vcpuinfo(domid, &vcpuinfo[i], nr_cpus); - libxl_vcpuinfo_destroy(&vcpuinfo[i]); + libxl_vcpuinfo_dispose(&vcpuinfo[i]); } free(vcpuinfo); @@ -3445,7 +3445,7 @@ static void vcpupin(const char *d, const } } vcpupin_out1: - libxl_cpumap_destroy(&cpumap); + libxl_cpumap_dispose(&cpumap); vcpupin_out: ; } @@ -3485,7 +3485,7 @@ static void vcpuset(const char *d, const if (libxl_set_vcpuonline(ctx, domid, &cpumap) < 0) fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d\n", domid, max_vcpus); - libxl_cpumap_destroy(&cpumap); + libxl_cpumap_dispose(&cpumap); } int main_vcpuset(int argc, char **argv) @@ -3609,7 +3609,7 @@ static void output_topologyinfo(void) printf("numa_info : none\n"); - libxl_topologyinfo_destroy(&info); + libxl_topologyinfo_dispose(&info); return; } @@ -4018,7 +4018,7 @@ int main_networkattach(int argc, char ** fprintf(stderr, "libxl_device_nic_add failed.\n"); return 1; } - libxl_device_nic_destroy(&nic); + libxl_device_nic_dispose(&nic); return 0; } @@ -4051,7 +4051,7 @@ int main_networklist(int argc, char **ar printf("%6d %5d %6d %5d/%-11d %-30s\n", nics[i].devid, nics[i].state, nics[i].evtch, nics[i].rref_tx, nics[i].rref_rx, nics[i].backend); - libxl_nicinfo_destroy(&nics[i]); + libxl_nicinfo_dispose(&nics[i]); } free(nics); } @@ -4086,7 +4086,7 @@ int main_networkdetach(int argc, char ** fprintf(stderr, "libxl_device_nic_del failed.\n"); return 1; } - libxl_device_nic_destroy(&nic); + libxl_device_nic_dispose(&nic); return 0; } @@ -4152,9 +4152,9 @@ int main_blocklist(int argc, char **argv printf("%-5d %-3d %-6d %-5d %-6d %-8d %-30s\n", diskinfo.devid, diskinfo.backend_id, diskinfo.frontend_id, diskinfo.state, diskinfo.evtch, diskinfo.rref, diskinfo.backend); - libxl_diskinfo_destroy(&diskinfo); + libxl_diskinfo_dispose(&diskinfo); } - libxl_device_disk_destroy(&disks[i]); + libxl_device_disk_dispose(&disks[i]); } free(disks); } @@ -4791,7 +4791,7 @@ int main_cpupoolcreate(int argc, char ** n_nodes++; } - libxl_topologyinfo_destroy(&topology); + libxl_topologyinfo_dispose(&topology); if (n_cpus == 0) { fprintf(stderr, "no free cpu found\n"); @@ -4931,7 +4931,7 @@ int main_cpupoollist(int argc, char **ar printf("\n"); } } - libxl_cpupoolinfo_destroy(poolinfo + p); + libxl_cpupoolinfo_dispose(poolinfo + p); } return ret; @@ -5132,7 +5132,7 @@ int main_cpupoolnumasplit(int argc, char poolid = poolinfo[0].poolid; schedid = poolinfo[0].sched_id; for (p = 0; p < n_pools; p++) { - libxl_cpupoolinfo_destroy(poolinfo + p); + libxl_cpupoolinfo_dispose(poolinfo + p); } if (n_pools > 1) { fprintf(stderr, "splitting not possible, already cpupools in use\n"); @@ -5146,7 +5146,7 @@ int main_cpupoolnumasplit(int argc, char if (libxl_cpumap_alloc(ctx, &cpumap)) { fprintf(stderr, "Failed to allocate cpumap\n"); - libxl_topologyinfo_destroy(&topology); + libxl_topologyinfo_dispose(&topology); return -ERROR_FAIL; } @@ -5229,8 +5229,8 @@ int main_cpupoolnumasplit(int argc, char } out: - libxl_topologyinfo_destroy(&topology); - libxl_cpumap_destroy(&cpumap); + libxl_topologyinfo_dispose(&topology); + libxl_cpumap_dispose(&cpumap); return ret; } diff -r 450a1d48932c -r d71e77d3fbf1 tools/python/genwrap.py --- a/tools/python/genwrap.py Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/python/genwrap.py Tue Oct 18 10:35:55 2011 +0100 @@ -100,8 +100,8 @@ def py_attrib_set(ty, f): def py_object_def(ty): l = [] - if ty.destructor_fn is not None: - dtor = ' %s(&self->obj);\n'%ty.destructor_fn + if ty.dispose_fn is not None: + dtor = ' %s(&self->obj);\n'%ty.dispose_fn else: dtor = '' diff -r 450a1d48932c -r d71e77d3fbf1 tools/python/xen/lowlevel/xl/xl.c --- a/tools/python/xen/lowlevel/xl/xl.c Tue Oct 18 10:35:55 2011 +0100 +++ b/tools/python/xen/lowlevel/xl/xl.c Tue Oct 18 10:35:55 2011 +0100 @@ -246,7 +246,7 @@ int attrib__libxl_hwcap_set(PyObject *v, int attrib__libxl_key_value_list_set(PyObject *v, libxl_key_value_list *pptr) { if ( *pptr ) { - libxl_key_value_list_destroy(pptr); + libxl_key_value_list_dispose(pptr); *pptr = NULL; } if ( v == Py_None ) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |