提交 ffcb39cb 编写于 作者: J Jiri Denemark

qemu: Add qemuMonitorCPUDefsCopy

Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 7e0a6ac0
......@@ -3591,6 +3591,29 @@ qemuMonitorCPUDefsNew(size_t count)
}
qemuMonitorCPUDefsPtr
qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr src)
{
g_autoptr(qemuMonitorCPUDefs) defs = NULL;
size_t i;
if (!src)
return NULL;
defs = qemuMonitorCPUDefsNew(src->ncpus);
for (i = 0; i < src->ncpus; i++) {
qemuMonitorCPUDefInfoPtr cpuDst = defs->cpus + i;
qemuMonitorCPUDefInfoPtr cpuSrc = src->cpus + i;
cpuDst->usable = cpuSrc->usable;
cpuDst->name = g_strdup(cpuSrc->name);
cpuDst->blockers = g_strdupv(cpuSrc->blockers);
}
return g_steal_pointer(&defs);
}
int
qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
qemuMonitorCPUModelExpansionType type,
......
......@@ -1103,6 +1103,7 @@ struct _qemuMonitorCPUDefs {
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
qemuMonitorCPUDefsPtr *cpuDefs);
qemuMonitorCPUDefsPtr qemuMonitorCPUDefsNew(size_t count);
qemuMonitorCPUDefsPtr qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr src);
void qemuMonitorCPUDefsFree(qemuMonitorCPUDefsPtr defs);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(qemuMonitorCPUDefs, qemuMonitorCPUDefsFree);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册