libxl: drop libxl_cpuarray -- topology was the only user.

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>
This commit is contained in:
Ian Campbell committed 2012-01-31 16:34:39 +00:00
1 parent 8137e3ea1a
commit cf3b8d958c
7 files changed
+1 -97

No files matched your search

+1 -18
View 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:
-7
View 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
-21
View 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)
{
-1
View 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)
-24
View 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);
-2
View 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;
}
-24
View 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);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.