
Am Mittwoch 23 März 2011 17:59:11 schrieb Jim Fehlig:
Markus Groß wrote:
+ maplen = (unsigned int) ceil((double) nvcpus / 8); + if (VIR_ALLOC_N(bitmask, maplen) < 0) { + virReportOOMError(); + goto cleanup; + } + + memset(bitmask, 0, maplen); + for (i = 0; i < nvcpus; ++i) { + pos = (unsigned int) floor((double) i / 8); + bitmask[pos] |= 1 << (i % 8); + } + + map.size = maplen; + map.map = bitmask;
Hmm, could this be simplified to
if (libxl_cpumap_alloc(&priv->ctx, &map)) { virReportOOMError() goto cleanup; } for (i = 0; i < nvcpus; i++) libxl_cpumap_set(&map, i);
This would be convenient, however these functions are part of libxl_utils.c/h and are not installed by xen. At least I found them nowhere when installing xen. I will incorporate the rest of your suggestions in a v2. Thanks, Markus