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

View File

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

View File

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

View File

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