提交 a5dd8b80 编写于 作者: H Hu Tao 提交者: Daniel Veillard

updates of some vcpupin related functions

1. add a new function virDomainVcpuPinDefCopy
2. make virDomainVcpuPinDefFree non-static
上级 fd8fd0f9
...@@ -1511,7 +1511,39 @@ virDomainClockDefClear(virDomainClockDefPtr def) ...@@ -1511,7 +1511,39 @@ virDomainClockDefClear(virDomainClockDefPtr def)
VIR_FREE(def->timers); 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, virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def,
int nvcpupin) int nvcpupin)
{ {
......
...@@ -1536,6 +1536,11 @@ struct _virDomainVcpuPinDef { ...@@ -1536,6 +1536,11 @@ struct _virDomainVcpuPinDef {
char *cpumask; char *cpumask;
}; };
void virDomainVcpuPinDefFree(virDomainVcpuPinDefPtr *def, int nvcpupin);
virDomainVcpuPinDefPtr *virDomainVcpuPinDefCopy(virDomainVcpuPinDefPtr *src,
int nvcpupin);
int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def, int virDomainVcpuPinIsDuplicate(virDomainVcpuPinDefPtr *def,
int nvcpupin, int nvcpupin,
int vcpu); int vcpu);
......
...@@ -506,6 +506,8 @@ virDomainTimerTickpolicyTypeToString; ...@@ -506,6 +506,8 @@ virDomainTimerTickpolicyTypeToString;
virDomainTimerTrackTypeFromString; virDomainTimerTrackTypeFromString;
virDomainTimerTrackTypeToString; virDomainTimerTrackTypeToString;
virDomainVcpuPinAdd; virDomainVcpuPinAdd;
virDomainVcpuPinDefCopy;
virDomainVcpuPinDefFree;
virDomainVcpuPinDel; virDomainVcpuPinDel;
virDomainVcpuPinFindByVcpu; virDomainVcpuPinFindByVcpu;
virDomainVcpuPinIsDuplicate; virDomainVcpuPinIsDuplicate;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册