libxl: drop libxl_cpuarray -- topology was the only user.
authorIan Campbell <ian.campbell@citrix.com>
Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 31 Jan 2012 16:34:39 +0000 (16:34 +0000)
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
tools/libxl/gentest.py
tools/libxl/libxl.h
tools/libxl/libxl_json.c
tools/libxl/libxl_types.idl
tools/libxl/libxl_utils.c
tools/libxl/libxl_utils.h
tools/python/xen/lowlevel/xl/xl.c

index be05bfb49d32650c8c325ab861f2f46ac40b44d3..410b9b76de52e707c836fb23ddefaccd64919797 100644 (file)
@@ -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(libxl_string_list *p)
     l[i] = NULL;
     *p = l;
 }
-
-#if 0 /* To be remove in a subsequent patch */
-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:
index fd1a8048b35b7b2aec31e70567489687e57c800c..a9a55df3e9c836364bbd025b45e1cd64a32888b1 100644 (file)
@@ -163,13 +163,6 @@ typedef struct {
 } libxl_cpumap;
 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
index 345894b000567e8394f3a728dcea4cd5610159f9..d5e970d20f28e2d19127c6c6f376d40091f6ef90 100644 (file)
@@ -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)
 {
index 0cd6678a0b9c6f580bfd0af569609da97901d1b5..f9d6c97c5100bd2c6fe97eaed9b30a98a5bab859 100644 (file)
@@ -9,7 +9,6 @@ libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json =
 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)
index c92151abc1ba4c7f2678a3be52985222fad3340e..cd819c808c80813624ad99ab921a2a00cc91c6d7 100644 (file)
@@ -514,30 +514,6 @@ void libxl_cpumap_reset(libxl_cpumap *cpumap, int cpu)
     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);
index 845c9925e0c664c032f811645bbe7c9ab22b3694..f3002fd601da74214e9cf906f740757120c2597c 100644 (file)
@@ -86,8 +86,6 @@ static inline int libxl_cpumap_cpu_valid(libxl_cpumap *cpumap, int cpu)
 #define libxl_for_each_set_cpu(v, m) for (v = 0; v < (m).size * 8; v++) \
                                              if (libxl_cpumap_test(&(m), v))
 
-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;
 }
index c916e2f54fed0988e9d5050e15bdf592b7cd4b90..625891a6bc3c7b421376efaba4102140d63c5e98 100644 (file)
@@ -227,11 +227,6 @@ int attrib__libxl_cpumap_set(PyObject *v, libxl_cpumap *pptr)
     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_cpumap *pptr)
     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);