Make virDomainVcpuPinDel return void

Before, it only returned -1 on failure to shrink the array.
Since the switch to VIR_DELETE_ELEMENT in commit 2133441,
it returns either 0 or 0.
This commit is contained in:
Ján Tomko 2014-04-22 14:24:47 +02:00
parent a0a8dc695e
commit 180b996047
4 changed files with 7 additions and 29 deletions

View File

@ -14510,27 +14510,20 @@ virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
return -1;
}
int
void
virDomainVcpuPinDel(virDomainDefPtr def, int vcpu)
{
int n;
virDomainVcpuPinDefPtr *vcpupin_list = def->cputune.vcpupin;
/* No vcpupin exists yet */
if (!def->cputune.nvcpupin) {
return 0;
}
for (n = 0; n < def->cputune.nvcpupin; n++) {
if (vcpupin_list[n]->vcpuid == vcpu) {
virBitmapFree(vcpupin_list[n]->cpumask);
VIR_FREE(vcpupin_list[n]);
VIR_DELETE_ELEMENT(vcpupin_list, n, def->cputune.nvcpupin);
break;
return;
}
}
return 0;
}
int

View File

@ -2300,7 +2300,7 @@ int virDomainVcpuPinAdd(virDomainVcpuPinDefPtr **vcpupin_list,
int maplen,
int vcpu);
int virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
void virDomainVcpuPinDel(virDomainDefPtr def, int vcpu);
int virDomainEmulatorPinAdd(virDomainDefPtr def,
unsigned char *cpumap,

View File

@ -1945,12 +1945,7 @@ libxlDomainPinVcpuFlags(virDomainPtr dom, unsigned int vcpu,
/* full bitmap means reset the settings (if any). */
if (virBitmapIsAllSet(pcpumap)) {
if (virDomainVcpuPinDel(targetDef, vcpu) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to delete vcpupin xml for vcpu '%d'"),
vcpu);
goto endjob;
}
virDomainVcpuPinDel(targetDef, vcpu);
goto done;
}

View File

@ -4130,7 +4130,7 @@ static int qemuDomainHotplugVcpus(virQEMUDriverPtr driver,
}
/* Free vcpupin setting */
ignore_value(virDomainVcpuPinDel(vm->def, i));
virDomainVcpuPinDel(vm->def, i);
}
}
@ -4423,12 +4423,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
}
if (doReset) {
if (virDomainVcpuPinDel(vm->def, vcpu) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to delete vcpupin xml of "
"a running domain"));
goto cleanup;
}
virDomainVcpuPinDel(vm->def, vcpu);
} else {
if (vm->def->cputune.vcpupin)
virDomainVcpuPinDefArrayFree(vm->def->cputune.vcpupin, vm->def->cputune.nvcpupin);
@ -4448,12 +4443,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (doReset) {
if (virDomainVcpuPinDel(persistentDef, vcpu) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("failed to delete vcpupin xml of "
"a persistent domain"));
goto cleanup;
}
virDomainVcpuPinDel(persistentDef, vcpu);
} else {
if (!persistentDef->cputune.vcpupin) {
if (VIR_ALLOC(persistentDef->cputune.vcpupin) < 0)