For use in the test suite.
---
src/qemu/qemu_capabilities.c | 29 +++++++++++++++++++++++++----
src/qemu/qemu_capabilities.h | 5 +++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 9055bf9..891cab1 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -2388,6 +2388,30 @@ int virQEMUCapsGetMachineMaxCpus(virQEMUCapsPtr qemuCaps,
}
+/**
+ * virQEMUCapsSetGICCapabilities:
+ * @qemuCaps: QEMU capabilities
+ * @capabilities: GIC capabilities
+ * @ncapabilities: number of GIC capabilities
+ *
+ * Set the GIC capabilities for @qemuCaps.
+ *
+ * The ownership of @capabilities is taken away from the caller, ie. this
+ * function will not make a copy of @capabilities, so releasing that memory
+ * after it's been called is a bug.
+ */
+void
+virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
+ virGICCapability *capabilities,
+ size_t ncapabilities)
+{
+ VIR_FREE(qemuCaps->gicCapabilities);
+
+ qemuCaps->gicCapabilities = capabilities;
+ qemuCaps->ngicCapabilities = ncapabilities;
+}
+
+
static int
virQEMUCapsProbeQMPCommands(virQEMUCapsPtr qemuCaps,
qemuMonitorPtr mon)
@@ -2739,10 +2763,7 @@ virQEMUCapsProbeQMPGICCapabilities(virQEMUCapsPtr qemuCaps,
if ((ncaps = qemuMonitorGetGICCapabilities(mon, &caps)) < 0)
return -1;
- VIR_FREE(qemuCaps->gicCapabilities);
-
- qemuCaps->gicCapabilities = caps;
- qemuCaps->ngicCapabilities = ncaps;
+ virQEMUCapsSetGICCapabilities(qemuCaps, caps, ncaps);
return 0;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index fef78b7..16fd2de 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -426,6 +426,11 @@ bool virQEMUCapsIsValid(virQEMUCapsPtr qemuCaps);
void virQEMUCapsFilterByMachineType(virQEMUCapsPtr qemuCaps,
const char *machineType);
+/* Only for use by test suite */
+void virQEMUCapsSetGICCapabilities(virQEMUCapsPtr qemuCaps,
+ virGICCapability *capabilities,
+ size_t ncapabilities);
+
virQEMUCapsCachePtr virQEMUCapsCacheNew(const char *libDir,
const char *cacheDir,
uid_t uid, gid_t gid);
--
2.5.5