提交 8bc9131b 编写于 作者: P Peter Krempa

conf: domaincaps: Extract formatting of the <features> subelement

Extract it to virDomainCapsFormatFeatures so that the main function does
not get so bloated over time.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
上级 c4940317
......@@ -593,6 +593,23 @@ virDomainCapsFeatureSEVFormat(virBufferPtr buf,
}
static void
virDomainCapsFormatFeatures(const virDomainCaps *caps,
virBufferPtr buf)
{
virBufferAddLit(buf, "<features>\n");
virBufferAdjustIndent(buf, 2);
virDomainCapsFeatureGICFormat(buf, &caps->gic);
qemuDomainCapsFeatureFormatSimple(buf, "vmcoreinfo", caps->vmcoreinfo);
qemuDomainCapsFeatureFormatSimple(buf, "genid", caps->genid);
virDomainCapsFeatureSEVFormat(buf, caps->sev);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</features>\n");
}
char *
virDomainCapsFormat(const virDomainCaps *caps)
{
......@@ -629,16 +646,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</devices>\n");
virBufferAddLit(&buf, "<features>\n");
virBufferAdjustIndent(&buf, 2);
virDomainCapsFeatureGICFormat(&buf, &caps->gic);
qemuDomainCapsFeatureFormatSimple(&buf, "vmcoreinfo", caps->vmcoreinfo);
qemuDomainCapsFeatureFormatSimple(&buf, "genid", caps->genid);
virDomainCapsFeatureSEVFormat(&buf, caps->sev);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</features>\n");
virDomainCapsFormatFeatures(caps, &buf);
virBufferAdjustIndent(&buf, -2);
virBufferAddLit(&buf, "</domainCapabilities>\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册