goto cleanup;
if ((nodemask = virXPathString("string(./nodemask)", ctxt))) {
- if (virBitmapParse(nodemask, 0, &def->sourceNodes,
+ if (virBitmapParse(nodemask, &def->sourceNodes,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
goto cleanup;
}
- if (virBitmapParse(tmp, 0, &vcpu->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &vcpu->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(vcpu->cpumask)) {
goto cleanup;
}
- if (virBitmapParse(tmp, 0, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(cpumask)) {
return NULL;
}
- if (virBitmapParse(tmp, 0, &def, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &def, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(def)) {
}
if ((nodeset = virXMLPropString(node, "nodeset"))) {
- if (virBitmapParse(nodeset, 0, &hugepage->nodemask,
+ if (virBitmapParse(nodeset, &hugepage->nodemask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
goto error;
}
- if (virBitmapParse(tmp, 0, &ret, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &ret, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
if (virBitmapIsAllClear(ret)) {
if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) {
tmp = virXPathString("string(./vcpu[1]/@cpuset)", ctxt);
if (tmp) {
- if (virBitmapParse(tmp, 0, &def->cpumask,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(def->cpumask)) {
ctxt->node = node;
if ((class_id = virXPathString("string(./class_id[1]/@bitmap)", ctxt))) {
- if (virBitmapParse(class_id, 0, &class_id_map,
+ if (virBitmapParse(class_id, &class_id_map,
CLASS_ID_BITMAP_SIZE) < 0) {
VIR_FREE(class_id);
goto error;
"in memnode element"));
goto cleanup;
}
- if (virBitmapParse(tmp, 0, &mem_node->nodeset,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &mem_node->nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(mem_node->nodeset)) {
tmp = virXMLPropString(node, "nodeset");
if (tmp) {
- if (virBitmapParse(tmp, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(tmp, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
if (virBitmapIsAllClear(nodeset)) {
goto cleanup;
}
- if (virBitmapParse(tmp, 0, &def->mem_nodes[cur_cell].cpumask,
+ if (virBitmapParse(tmp, &def->mem_nodes[cur_cell].cpumask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
- if (virBitmapParse(nodeset, 0, &nodemask, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(nodeset, &nodemask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
}
if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.cpus")) &&
value->str) {
- if (virBitmapParse(value->str, 0, &def->cpumask,
+ if (virBitmapParse(value->str, &def->cpumask,
VIR_DOMAIN_CPUMASK_LEN) < 0)
return -1;
if ((value = virConfGetValue(properties, "lxc.cgroup.cpuset.mems")) &&
value->str) {
- if (virBitmapParse(value->str, 0, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(value->str, &nodeset, VIR_DOMAIN_CPUMASK_LEN) < 0)
return -1;
if (virDomainNumatuneSet(def->numa,
def->placement_mode ==
if (virFileReadAll(path, SYSFS_THREAD_SIBLINGS_LIST_LENGTH_MAX, &buf) < 0)
goto cleanup;
- if (virBitmapParse(buf, 0, &ret, virNumaGetMaxCPUs()) < 0)
+ if (virBitmapParse(buf, &ret, virNumaGetMaxCPUs()) < 0)
goto cleanup;
cleanup:
goto error;
if ((tmp = virXPathString("string(./numad/@nodeset)", ctxt))) {
- if (virBitmapParse(tmp, 0, &priv->autoNodeset,
+ if (virBitmapParse(tmp, &priv->autoNodeset,
caps->host.nnumaCell_max) < 0)
goto error;
}
} else if (STREQ(param->field, VIR_DOMAIN_NUMA_NODESET)) {
- if (virBitmapParse(param->value.s, 0, &nodeset,
+ if (virBitmapParse(param->value.s, &nodeset,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
VIR_DEBUG("Nodeset returned from numad: %s", nodeset);
- if (virBitmapParse(nodeset, 0, &priv->autoNodeset,
+ if (virBitmapParse(nodeset, &priv->autoNodeset,
VIR_DOMAIN_CPUMASK_LEN) < 0)
goto cleanup;
/**
* virBitmapParse:
* @str: points to a string representing a human-readable bitmap
- * @terminator: character separating the bitmap to parse
* @bitmap: a bitmap created from @str
* @bitmapSize: the upper limit of num of bits in created bitmap
*
* to set, and ^N, which means to unset the bit, and N-M for ranges of bits
* to set.
*
- * To allow parsing of bitmaps within larger strings it is possible to set
- * a termination character in the argument @terminator. When the character
- * in @terminator is encountered in @str, the parsing of the bitmap stops.
- * Pass 0 as @terminator if it is not needed. Whitespace characters may not
- * be used as terminators.
- *
* Returns 0 on success, or -1 in case of error.
*/
int
virBitmapParse(const char *str,
- char terminator,
virBitmapPtr *bitmap,
size_t bitmapSize)
{
- return virBitmapParseSeparator(str, terminator, bitmap, bitmapSize);
+ return virBitmapParseSeparator(str, '\0', bitmap, bitmapSize);
}
/**
char *virBitmapFormat(virBitmapPtr bitmap);
int virBitmapParse(const char *str,
- char sep,
virBitmapPtr *bitmap,
size_t bitmapSize)
- ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
+ ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
int
virBitmapParseSeparator(const char *str,
char terminator,
if (virFileReadAll(path, 5 * VIR_HOST_CPU_MASK_LEN, &str) < 0)
goto error;
- if (virBitmapParse(str, 0, &map, max_cpuid) < 0)
+ if (virBitmapParse(str, &map, max_cpuid) < 0)
goto error;
VIR_FREE(str);
goto cleanup;
virBitmapSetAll(def->cpumask);
} else {
- if (virBitmapParse(buf, 0, &def->cpumask, hostcpus) < 0)
+ if (virBitmapParse(buf, &def->cpumask, hostcpus) < 0)
goto cleanup;
}
if (xenConfigGetString(conf, "cpus", &str, NULL) < 0)
return -1;
- if (str && (virBitmapParse(str, 0, &def->cpumask, 4096) < 0))
+ if (str && (virBitmapParse(str, &def->cpumask, 4096) < 0))
return -1;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
def->mem.cur_balloon = virDomainDefGetMemoryTotal(def);
if (cpus != NULL) {
- if (virBitmapParse(cpus, 0, &def->cpumask,
- VIR_DOMAIN_CPUMASK_LEN) < 0)
+ if (virBitmapParse(cpus, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto error;
if (virBitmapIsAllClear(def->cpumask)) {
}
priv = vm->privateData;
- if (virBitmapParse("0-3", '\0', &priv->autoNodeset, 4) < 0)
+ if (virBitmapParse("0-3", &priv->autoNodeset, 4) < 0)
goto out;
if (!virDomainDefCheckABIStability(vm->def, vm->def)) {
int ret = -1;
int size = 1025;
- if (virBitmapParse(bitsString1, 0, &bitmap, size) < 0)
+ if (virBitmapParse(bitsString1, &bitmap, size) < 0)
goto error;
if (testBit(bitmap, 1, 32, true) < 0)
/* 2. partial set */
- if (virBitmapParse(bitsString, 0, &bitmap, size) < 0)
+ if (virBitmapParse(bitsString, &bitmap, size) < 0)
goto error;
if (!bitmap)
goto error;
int ret = -1;
virBitmapPtr bitmap = NULL;
- if (virBitmapParse("100000000", 0, &bitmap, 20) != -1)
+ if (virBitmapParse("100000000", &bitmap, 20) != -1)
goto cleanup;
if (bitmap)
goto cleanup;
- if (virBitmapParse("1-1000000000", 0, &bitmap, 20) != -1)
+ if (virBitmapParse("1-1000000000", &bitmap, 20) != -1)
goto cleanup;
if (bitmap)
goto cleanup;
- if (virBitmapParse("1-10^10000000000", 0, &bitmap, 20) != -1)
+ if (virBitmapParse("1-10^10000000000", &bitmap, 20) != -1)
goto cleanup;
if (bitmap)
virBitmapPtr b1 = NULL, b2 = NULL, b3 = NULL, b4 = NULL;
if (virBitmapParseSeparator("0-3,5-8,11-15f16", 'f', &b1, 20) < 0 ||
- virBitmapParse("4,9,10,16-19", 0, &b2, 20) < 0 ||
- virBitmapParse("15", 0, &b3, 20) < 0 ||
- virBitmapParse("0,^0", 0, &b4, 20) < 0)
+ virBitmapParse("4,9,10,16-19", &b2, 20) < 0 ||
+ virBitmapParse("15", &b3, 20) < 0 ||
+ virBitmapParse("0,^0", &b4, 20) < 0)
goto cleanup;
if (!virBitmapIsAllClear(b4))
virBitmapPtr resmap = NULL;
int ret = -1;
- if (virBitmapParse(data->a, 0, &amap, 256) < 0 ||
- virBitmapParse(data->b, 0, &bmap, 256) < 0 ||
- virBitmapParse(data->res, 0, &resmap, 256) < 0)
+ if (virBitmapParse(data->a, &amap, 256) < 0 ||
+ virBitmapParse(data->b, &bmap, 256) < 0 ||
+ virBitmapParse(data->res, &resmap, 256) < 0)
goto cleanup;
virBitmapSubtract(amap, bmap);
if (!(caps = buildNUMATopology(3)))
goto error;
- if (virBitmapParse(nodestr, VIR_ARCH_NONE, &nodemask, mask_size) < 0)
+ if (virBitmapParse(nodestr, &nodemask, mask_size) < 0)
goto error;
if (!(cpumap = virCapabilitiesGetCpusForNodemask(caps, nodemask)))
return NULL;
virBitmapSetAll(map);
} else {
- if ((virBitmapParse(cpulist, '\0', &map, 1024) < 0) ||
+ if (virBitmapParse(cpulist, &map, 1024) < 0 ||
virBitmapIsAllClear(map)) {
vshError(ctl, _("Invalid cpulist '%s'"), cpulist);
goto cleanup;