qemu: Add virQEMUCapsSetGICCapabilities()

For use in the test suite.
This commit is contained in:
Andrea Bolognani 2016-05-10 10:50:34 +02:00
parent 1a012c9a51
commit 8b74919d69
2 changed files with 30 additions and 4 deletions

View File

@ -2367,6 +2367,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)
@ -2719,10 +2743,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;
}

View File

@ -427,6 +427,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);