Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
Notes:
Version 2:
- no change
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 87a9d06d45..8d86112f30 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -3582,6 +3582,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 aa2a0e392a..4f355c760a 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