Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_monitor.c | 33 +++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor.h | 2 ++
2 files changed, 35 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 4442ef6cca..ebd7eaa1a9 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3565,6 +3565,39 @@ qemuMonitorCPUDefsNew(size_t count)
}
+int
+qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr *dst,
+ qemuMonitorCPUDefsPtr src)
+{
+ VIR_AUTOPTR(qemuMonitorCPUDefs) defs = NULL;
+ size_t i;
+
+ if (!src) {
+ *dst = NULL;
+ return 0;
+ }
+
+ if (!(defs = qemuMonitorCPUDefsNew(src->ncpus)))
+ return -1;
+
+ defs->ncpus = src->ncpus;
+ for (i = 0; i < src->ncpus; i++) {
+ qemuMonitorCPUDefInfoPtr cpuDst = defs->cpus + i;
+ qemuMonitorCPUDefInfoPtr cpuSrc = src->cpus + i;
+
+ cpuDst->usable = cpuSrc->usable;
+
+ if (VIR_STRDUP(cpuDst->name, cpuSrc->name) < 0 ||
+ virStringListCopy(&cpuDst->blockers,
+ (const char **)cpuSrc->blockers) < 0)
+ return -1;
+ }
+
+ VIR_STEAL_PTR(*dst, defs);
+ return 0;
+}
+
+
int
qemuMonitorGetCPUModelExpansion(qemuMonitorPtr mon,
qemuMonitorCPUModelExpansionType type,
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7d35c97860..0b6d4848a0 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1111,6 +1111,8 @@ struct _qemuMonitorCPUDefs {
int qemuMonitorGetCPUDefinitions(qemuMonitorPtr mon,
qemuMonitorCPUDefsPtr *cpuDefs);
qemuMonitorCPUDefsPtr qemuMonitorCPUDefsNew(size_t count);
+int qemuMonitorCPUDefsCopy(qemuMonitorCPUDefsPtr *dst,
+ qemuMonitorCPUDefsPtr src);
void qemuMonitorCPUDefsFree(qemuMonitorCPUDefsPtr defs);
VIR_DEFINE_AUTOPTR_FUNC(qemuMonitorCPUDefs, qemuMonitorCPUDefsFree);
--
2.23.0