1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-25 01:34:11 +03:00

updates of some vcpupin related functions

1. add a new function virDomainVcpuPinDefCopy
2. make virDomainVcpuPinDefFree non-static
This commit is contained in:
Hu Tao 2012-08-21 17:18:29 +08:00 committed by Daniel Veillard
parent fd8fd0f916
commit a5dd8b808c
3 changed files with 40 additions and 1 deletions

View File

@ -1511,7 +1511,39 @@ virDomainClockDefClear(virDomainClockDefPtr def)
VIR_FREE(def->timers);
}
static void
virDomainVcpuPinDefPtr *
virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src, int nvcpupin)
{
int i = 0;
virDomainVcpuPinDefPtr *ret;
if (VIR_ALLOC_N(ret, nvcpupin) < 0) {
goto no_memory;
}
for (i = 0; i < nvcpupin; i++) {
if (VIR_ALLOC(ret[i]) < 0)
goto no_memory;
if (VIR_ALLOC_N(ret[i]->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0)
goto no_memory;
ret[i]->vcpuid = src[i]->vcpuid;
memcpy(ret[i]->cpumask, src[i]->cpumask, VIR_DOMAIN_CPUMASK_LEN);
}
return ret;
no_memory:
while (i >= 0) {
VIR_FREE(ret[i]->cpumask);
VIR_FREE(ret[i]);
}
VIR_FREE(ret);
virReportOOMError();
return NULL;
}
void
virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def,
int nvcpupin)
{

View File

@ -1536,6 +1536,11 @@ struct _virDomainVcpuPinDef {
char *cpumask;
};
void virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def, int nvcpupin);
virDomainVcpuPinDefPtr *virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src,
int nvcpupin);
int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin,
int vcpu);

View File

@ -506,6 +506,8 @@ virDomainTimerTickpolicyTypeToString;
virDomainTimerTrackTypeFromString;
virDomainTimerTrackTypeToString;
virDomainVcpuPinAdd;
virDomainVcpuPinDefCopy;
virDomainVcpuPinDefFree;
virDomainVcpuPinDel;
virDomainVcpuPinFindByVcpu;
virDomainVcpuPinIsDuplicate;