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

qemu: Refactor virQEMUCapsFormatAccel

And make it use virQEMUCapsGetAccel once rather than repeating the same
code in all functions called from virQEMUCapsFormatAccel.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 4fd90d06
......@@ -3907,12 +3907,11 @@ virQEMUCapsLoadCache(virArch hostArch,
static void
virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsAccelPtr caps,
virBufferPtr buf,
virDomainVirtType type)
const char *typeStr)
{
qemuMonitorCPUModelInfoPtr model = virQEMUCapsGetCPUModelInfo(qemuCaps, type);
const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg";
qemuMonitorCPUModelInfoPtr model = caps->hostCPU.info;
size_t i;
if (!model)
......@@ -3962,22 +3961,13 @@ virQEMUCapsFormatHostCPUModelInfo(virQEMUCapsPtr qemuCaps,
static void
virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps,
virQEMUCapsFormatCPUModels(virQEMUCapsAccelPtr caps,
virBufferPtr buf,
virDomainVirtType type)
const char *typeStr)
{
qemuMonitorCPUDefsPtr defs;
const char *typeStr;
qemuMonitorCPUDefsPtr defs = caps->cpuModels;
size_t i;
if (type == VIR_DOMAIN_VIRT_KVM) {
typeStr = "kvm";
defs = qemuCaps->kvm.cpuModels;
} else {
typeStr = "tcg";
defs = qemuCaps->tcg.cpuModels;
}
if (!defs)
return;
......@@ -4015,8 +4005,11 @@ virQEMUCapsFormatAccel(virQEMUCapsPtr qemuCaps,
virBufferPtr buf,
virDomainVirtType type)
{
virQEMUCapsFormatHostCPUModelInfo(qemuCaps, buf, type);
virQEMUCapsFormatCPUModels(qemuCaps, buf, type);
virQEMUCapsAccelPtr caps = virQEMUCapsGetAccel(qemuCaps, type);
const char *typeStr = type == VIR_DOMAIN_VIRT_KVM ? "kvm" : "tcg";
virQEMUCapsFormatHostCPUModelInfo(caps, buf, typeStr);
virQEMUCapsFormatCPUModels(caps, buf, typeStr);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册