* src/libxl/libxl_driver.c
* src/qemu/qemu_process.c
---
src/libxl/libxl_driver.c | 7 ++-----
src/qemu/qemu_process.c | 13 ++-----------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 3491f40..aaab044 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -450,7 +450,6 @@ libxlDomainSetVcpuAffinites(libxlDriverPrivatePtr driver,
virDomainObjPtr vm)
uint8_t *cpumap = NULL;
virNodeInfo nodeinfo;
size_t cpumaplen;
- unsigned int pos;
int vcpu, i;
int ret = -1;
@@ -471,10 +470,8 @@ libxlDomainSetVcpuAffinites(libxlDriverPrivatePtr driver,
virDomainObjPtr vm)
cpumask = (uint8_t*) def->cputune.vcpupin[vcpu]->cpumask;
for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; ++i) {
- if (cpumask[i]) {
- pos = i / 8;
- cpumap[pos] |= 1 << (i % 8);
- }
+ if (cpumask[i])
+ VIR_USE_CPU(cpumap, i);
}
map.size = cpumaplen;
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 811fa28..fb18fc8 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1212,18 +1212,9 @@ qemuProcessSetVcpuAffinites(virConnectPtr conn,
cpumask = (unsigned char *)def->cputune.vcpupin[vcpu]->cpumask;
vcpupid = priv->vcpupids[vcpu];
- /* Convert cpumask to bitmap here. */
- for (i = 0; i < VIR_DOMAIN_CPUMASK_LEN; i++) {
- int cur = 0;
- int mod = 0;
-
- if (i) {
- cur = i / 8;
- mod = i % 8;
- }
-
+ for (i = 0 ; i < VIR_DOMAIN_CPUMASK_LEN ; i++) {
if (cpumask[i])
- cpumap[cur] |= 1 << mod;
+ VIR_USE_CPU(cpumap, i);
}
if (virProcessInfoSetAffinity(vcpupid,
--
1.7.4