diff options
author | Juergen Gross <juergen.gross@ts.fujitsu.com> | 2010-11-03 12:10:46 +0000 |
---|---|---|
committer | Juergen Gross <juergen.gross@ts.fujitsu.com> | 2010-11-03 12:10:46 +0000 |
commit | 9180abe5683a107588014dc57058e756c0047bb6 (patch) | |
tree | 0f7c7c633da4a3b381175c2381af12dbde9134ea /tools/libxc/xc_misc.c | |
parent | 02bac862c003b2da5bb5c396e3ca19a7fb6990ea (diff) | |
download | xen-9180abe5683a107588014dc57058e756c0047bb6.tar.gz xen-9180abe5683a107588014dc57058e756c0047bb6.tar.bz2 xen-9180abe5683a107588014dc57058e756c0047bb6.zip |
tools: change cpumaps to uint8_t
Cpumap types in tools (libxc and libxl) are changed to be based on bytes like
in the interface to the hypervisor.
To make handling easier the size of used cpumaps is always based on the
number of physical cpus supported by the hypervisor. This eliminates the need
to keep track of the cpumap size in external interfaces.
In libxl a macro for cycling through a cpumap is added (libxl_for_each_cpu).
Interfaces changed:
libxl_set_vcpuaffinity()
libxl_cpumap_alloc()
xc_vcpu_setaffinity()
xc_vcpu_getaffinity()
xc_cpupool_freeinfo()
Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_misc.c')
-rw-r--r-- | tools/libxc/xc_misc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c index 1707b997e1..f3ffb225bd 100644 --- a/tools/libxc/xc_misc.c +++ b/tools/libxc/xc_misc.c @@ -35,6 +35,21 @@ int xc_get_max_cpus(xc_interface *xch) return max_cpus; } +int xc_get_cpumap_size(xc_interface *xch) +{ + return (xc_get_max_cpus(xch) + 7) / 8; +} + +xc_cpumap_t xc_cpumap_alloc(xc_interface *xch) +{ + int sz; + + sz = xc_get_cpumap_size(xch); + if (sz == 0) + return NULL; + return calloc(1, sz); +} + int xc_readconsolering(xc_interface *xch, char *buffer, unsigned int *pnr_chars, |