From: Osier Yang Date: Tue, 7 Jun 2011 08:51:51 +0000 (+0800) Subject: Use VIR_USE_CPU instead of new wheel X-Git-Tag: v0.9.3-rc1~232 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ebf6b11ac1452ea15100283bea13972bde5224e6;p=thirdparty%2Flibvirt.git Use VIR_USE_CPU instead of new wheel --- diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index ed24d10668..86ed8505b4 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -530,7 +530,6 @@ libxlDomainSetVcpuAffinites(libxlDriverPrivatePtr driver, virDomainObjPtr vm) uint8_t *cpumap = NULL; virNodeInfo nodeinfo; size_t cpumaplen; - unsigned int pos; int vcpu, i; int ret = -1; @@ -551,10 +550,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 faeeb9967a..40078e4990 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -1233,18 +1233,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,