[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 7 of 9] libxl: drop libxl_cpuarray -- topology was the only user



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1327512175 0
# Node ID 0bf43ff297fc2cb4d6982da80cceec181deb6d55
# Parent  e1753f37c9064f1e84fa32dfc37ff0f286e2df1e
libxl: drop libxl_cpuarray -- topology was the only user.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py
--- a/tools/libxl/gentest.py
+++ b/tools/libxl/gentest.py
@@ -21,7 +21,7 @@ def randomize_enum(e):
 
 handcoded = ["libxl_cpumap", "libxl_key_value_list",
              "libxl_cpuid_policy_list", "libxl_file_reference",
-             "libxl_string_list", "libxl_cpuarray"]
+             "libxl_string_list"]
 
 def gen_rand_init(ty, v, indent = "    ", parent = None):
     s = ""
@@ -194,23 +194,6 @@ static void libxl_string_list_rand_init(
     l[i] = NULL;
     *p = l;
 }
-
-#if 0
-static void libxl_cpuarray_rand_init(libxl_cpuarray *p)
-{
-    int i;
-    /* Up to 16 VCPUs on 32 PCPUS */
-    p->entries = rand() % 16;
-    p->array = calloc(p->entries, sizeof(*p->array));
-    for (i = 0; i < p->entries; i++) {
-        int r = rand() % 32*1.5; /* 2:1 valid:invalid */
-        if (r >= 32)
-            p->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-        else
-            p->array[i] = r;
-    }
-}
-#endif
 """)
     for ty in builtins + types:
         if ty.typename not in handcoded:
diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h
--- a/tools/libxl/libxl.h
+++ b/tools/libxl/libxl.h
@@ -158,13 +158,6 @@ typedef struct {
 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_dispose(libxl_cpuarray *array);
-
-typedef struct {
     /*
      * Path is always set if the file reference is valid. However if
      * mapped is true then the actual file may already be unlinked.
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -246,27 +246,6 @@ out:
     return s;
 }
 
-yajl_gen_status libxl_cpuarray_gen_json(yajl_gen hand,
-                                        libxl_cpuarray *cpuarray)
-{
-    yajl_gen_status s;
-    int i;
-
-    s = yajl_gen_array_open(hand);
-    if (s != yajl_gen_status_ok) goto out;
-
-    for(i=0; i<cpuarray->entries; i++) {
-        if (cpuarray->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY)
-            s = yajl_gen_null(hand);
-        else
-            s = yajl_gen_integer(hand, cpuarray->array[i]);
-        if (s != yajl_gen_status_ok) goto out;
-    }
-    s = yajl_gen_array_close(hand);
-out:
-    return s;
-}
-
 yajl_gen_status libxl_file_reference_gen_json(yajl_gen hand,
                                               libxl_file_reference *p)
 {
diff --git a/tools/libxl/libxl_types.idl b/tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl
+++ b/tools/libxl/libxl_types.idl
@@ -9,7 +9,6 @@ libxl_domid = Builtin("domid", json_fn =
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", 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", 
dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE)
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -514,30 +514,6 @@ void libxl_cpumap_reset(libxl_cpumap *cp
     cpumap->map[cpu / 8] &= ~(1 << (cpu & 7));
 }
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray)
-{
-    int max_cpus;
-    int i;
-
-    max_cpus = libxl_get_max_cpus(ctx);
-    if (max_cpus == 0)
-        return ERROR_FAIL;
-
-    cpuarray->array = calloc(max_cpus, sizeof(*cpuarray->array));
-    if (!cpuarray->array)
-        return ERROR_NOMEM;
-    cpuarray->entries = max_cpus;
-    for (i = 0; i < max_cpus; i++)
-        cpuarray->array[i] = LIBXL_CPUARRAY_INVALID_ENTRY;
-
-    return 0;
-}
-
-void libxl_cpuarray_dispose(libxl_cpuarray *array)
-{
-    free(array->array);
-}
-
 int libxl_get_max_cpus(libxl_ctx *ctx)
 {
     return xc_get_max_cpus(ctx->xch);
diff --git a/tools/libxl/libxl_utils.h b/tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h
+++ b/tools/libxl/libxl_utils.h
@@ -72,8 +72,6 @@ void libxl_cpumap_set(libxl_cpumap *cpum
 void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu);
 #define libxl_for_each_cpu(var, map) for (var = 0; var < (map).size * 8; var++)
 
-int libxl_cpuarray_alloc(libxl_ctx *ctx, libxl_cpuarray *cpuarray);
-
 static inline uint32_t libxl__sizekb_to_mb(uint32_t s) {
     return (s + 1023) / 1024;
 }
diff --git a/tools/python/xen/lowlevel/xl/xl.c 
b/tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c
+++ b/tools/python/xen/lowlevel/xl/xl.c
@@ -227,11 +227,6 @@ int attrib__libxl_cpumap_set(PyObject *v
     return 0;
 }
 
-int attrib__libxl_cpuarray_set(PyObject *v, libxl_cpuarray *pptr)
-{
-    return -1;
-}
-
 int attrib__libxl_file_reference_set(PyObject *v, libxl_file_reference *pptr)
 {
     return genwrap__string_set(v, &pptr->path);
@@ -304,25 +299,6 @@ PyObject *attrib__libxl_cpumap_get(libxl
     return cpulist;
 }
 
-PyObject *attrib__libxl_cpuarray_get(libxl_cpuarray *pptr)
-{
-    PyObject *list = NULL;
-    int i;
-
-    list = PyList_New(0);
-    for (i = 0; i < pptr->entries; i++) {
-        if (pptr->array[i] == LIBXL_CPUARRAY_INVALID_ENTRY) {
-            PyList_Append(list, Py_None);
-        } else {
-            PyObject* pyint = PyInt_FromLong(pptr->array[i]);
-
-            PyList_Append(list, pyint);
-            Py_DECREF(pyint);
-        }
-    }
-    return list;
-}
-
 PyObject *attrib__libxl_file_reference_get(libxl_file_reference *pptr)
 {
     return genwrap__string_get(&pptr->path);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.