libxl: rename libxl_cpumap to libxl_bitmap

And leave to the caller the burden of knowing and remembering what kind
of bitmap each instance of libxl_bitmap is.

This is basically just some s/libxl_cpumap/libxl_bitmap/ (and some other
related interface name substitution, e.g., libxl_for_each_cpu) in a bunch
of files, with no real functional change involved.

A specific allocation helper is introduced, besides libxl_bitmap_alloc().
It is called libxl_cpu_bitmap_alloc() and is meant at substituting the old
libxl_cpumap_alloc(). It is just something easier to use in cases where one
wants to allocate a libxl_bitmap that is going to serve as a cpu map.

This is because we want to be able to deal with both cpu and NUMA node
maps, but we don't want to duplicate all the various helpers and wrappers.

While at it, add the usual initialization function, common to all libxl
data structures.

Signed-off-by: Dario Faggioli <dario.faggioli@citrix.eu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Dario Faggioli committed 2012-07-06 13:17:42 +01:00
1 parent b13da96bb6
commit ea12318767
13 files changed
+167 -160

No files matched your search

+5 -5
View File
@@ -231,14 +231,14 @@ int attrib__libxl_cpuid_policy_list_set(PyObject *v, libxl_cpuid_policy_list *pp
return -1;
}
int attrib__libxl_cpumap_set(PyObject *v, libxl_cpumap *pptr)
int attrib__libxl_bitmap_set(PyObject *v, libxl_bitmap *pptr)
{
int i;
long cpu;
for (i = 0; i < PyList_Size(v); i++) {
cpu = PyInt_AsLong(PyList_GetItem(v, i));
libxl_cpumap_set(pptr, cpu);
libxl_bitmap_set(pptr, cpu);
}
return 0;
}
@@ -293,14 +293,14 @@ PyObject *attrib__libxl_cpuid_policy_list_get(libxl_cpuid_policy_list *pptr)
return NULL;
}
PyObject *attrib__libxl_cpumap_get(libxl_cpumap *pptr)
PyObject *attrib__libxl_bitmap_get(libxl_bitmap *pptr)
{
PyObject *cpulist = NULL;
int i;
cpulist = PyList_New(0);
libxl_for_each_cpu(i, *pptr) {
if ( libxl_cpumap_test(pptr, i) ) {
libxl_for_each_bit(i, *pptr) {
if ( libxl_bitmap_test(pptr, i) ) {
PyObject* pyint = PyInt_FromLong(i);
PyList_Append(cpulist, pyint);
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.