WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] libxl: idl: use "dispose" rather than "de

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] libxl: idl: use "dispose" rather than "destroy" for function to free IDL types
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Tue, 01 Nov 2011 23:55:09 +0000
Delivery-date: Tue, 01 Nov 2011 16:55:30 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1318930555 -3600
# Node ID 224359634904e327a73941d613551f00232ac777
# Parent  03850b2653066066e21522ed54fbd5f8c2743048
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>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 03850b265306 -r 224359634904 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 @@
         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 03850b265306 -r 224359634904 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 @@
         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 @@
         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 @@
 
     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 @@
 
 """ % " ".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 03850b265306 -r 224359634904 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 @@
    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 03850b265306 -r 224359634904 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 @@
 {
     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 @@
     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 @@
         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 @@
     }
 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 @@
     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 @@
     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 @@
     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 @@
         }
     }
 
-    libxl_topologyinfo_destroy(&topology);
+    libxl_topologyinfo_dispose(&topology);
 
 out:
-    libxl_cpumap_destroy(&freemap);
+    libxl_cpumap_dispose(&freemap);
     return rc;
 }
 
@@ -2993,11 +2993,11 @@
         }
     }
 
-    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 03850b265306 -r 224359634904 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 @@
 #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 @@
     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 @@
     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 @@
  */
 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 @@
 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 03850b265306 -r 224359634904 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 03850b265306 -r 224359634904 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 @@
         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 @@
              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 03850b265306 -r 224359634904 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 @@
 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 @@
     ("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_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 @@
     ("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_sched_credit = Struct("sched_credit", [
     ("weight", integer),
     ("cap", integer),
-    ], destructor_fn=None)
+    ], dispose_fn=None)
diff -r 03850b265306 -r 224359634904 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 @@
             }
             free(poolname);
         }
-        libxl_cpupoolinfo_destroy(poolinfo + i);
+        libxl_cpupoolinfo_dispose(poolinfo + i);
     }
     free(poolinfo);
     return ret;
@@ -478,7 +478,7 @@
     }
 
     for (i=0; i<nb; i++)
-        libxl_nicinfo_destroy(&nics[i]);
+        libxl_nicinfo_dispose(&nics[i]);
     free(nics);
     return rc;
 }
@@ -579,7 +579,7 @@
     return 0;
 }
 
-void libxl_cpumap_destroy(libxl_cpumap *map)
+void libxl_cpumap_dispose(libxl_cpumap *map)
 {
     free(map->map);
 }
@@ -624,7 +624,7 @@
     return 0;
 }
 
-void libxl_cpuarray_destroy(libxl_cpuarray *array)
+void libxl_cpuarray_dispose(libxl_cpuarray *array)
 {
     free(array->array);
 }
diff -r 03850b265306 -r 224359634904 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 @@
             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 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 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 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 @@
         # 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 @@
 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 03850b265306 -r 224359634904 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 @@
             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 @@
     if (logfile != 2)
         close(logfile);
 
-    libxl_domain_config_destroy(&d_config);
+    libxl_domain_config_dispose(&d_config);
 
     free(config_data);
 
@@ -2047,7 +2047,7 @@
         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 @@
         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 @@
         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 @@
         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 @@
 
     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 @@
         }
     }
   vcpupin_out1:
-    libxl_cpumap_destroy(&cpumap);
+    libxl_cpumap_dispose(&cpumap);
   vcpupin_out:
     ;
 }
@@ -3485,7 +3485,7 @@
     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 @@
 
     printf("numa_info              : none\n");
 
-    libxl_topologyinfo_destroy(&info);
+    libxl_topologyinfo_dispose(&info);
 
     return;
 }
@@ -4018,7 +4018,7 @@
         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 @@
             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 @@
         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 @@
                 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 @@
             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 @@
                 printf("\n");
             }
         }
-        libxl_cpupoolinfo_destroy(poolinfo + p);
+        libxl_cpupoolinfo_dispose(poolinfo + p);
     }
 
     return ret;
@@ -5132,7 +5132,7 @@
     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 @@
 
     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 @@
     }
 
 out:
-    libxl_topologyinfo_destroy(&topology);
-    libxl_cpumap_destroy(&cpumap);
+    libxl_topologyinfo_dispose(&topology);
+    libxl_cpumap_dispose(&cpumap);
 
     return ret;
 }
diff -r 03850b265306 -r 224359634904 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_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 03850b265306 -r 224359634904 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_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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] libxl: idl: use "dispose" rather than "destroy" for function to free IDL types, Xen patchbot-unstable <=