mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
conf: domaincaps: Replace FORMAT_SINGLE macro by a function
Introduce qemuDomainCapsFeatureFormatSimple which does exactly the same thing but it's a function. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
38bc2e8c1b
commit
c4940317ef
@ -373,14 +373,6 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
|
|||||||
virBufferAddLit(buf, "</" #item ">\n"); \
|
virBufferAddLit(buf, "</" #item ">\n"); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define FORMAT_SINGLE(name, supported) \
|
|
||||||
do { \
|
|
||||||
if (supported != VIR_TRISTATE_BOOL_ABSENT) { \
|
|
||||||
virBufferAsprintf(&buf, "<%s supported='%s'/>\n", name, \
|
|
||||||
(supported == VIR_TRISTATE_BOOL_YES) ? "yes" : "no"); \
|
|
||||||
} \
|
|
||||||
} while (0)
|
|
||||||
|
|
||||||
#define ENUM_PROCESS(master, capsEnum, valToStr) \
|
#define ENUM_PROCESS(master, capsEnum, valToStr) \
|
||||||
do { \
|
do { \
|
||||||
virDomainCapsEnumFormat(buf, &master->capsEnum, \
|
virDomainCapsEnumFormat(buf, &master->capsEnum, \
|
||||||
@ -388,6 +380,19 @@ virDomainCapsStringValuesFormat(virBufferPtr buf,
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
qemuDomainCapsFeatureFormatSimple(virBufferPtr buf,
|
||||||
|
const char *featurename,
|
||||||
|
virTristateBool supported)
|
||||||
|
{
|
||||||
|
if (supported == VIR_TRISTATE_BOOL_ABSENT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
virBufferAsprintf(buf, "<%s supported='%s'/>\n", featurename,
|
||||||
|
virTristateBoolTypeToString(supported));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
virDomainCapsLoaderFormat(virBufferPtr buf,
|
virDomainCapsLoaderFormat(virBufferPtr buf,
|
||||||
const virDomainCapsLoader *loader)
|
const virDomainCapsLoader *loader)
|
||||||
@ -607,7 +612,7 @@ virDomainCapsFormat(const virDomainCaps *caps)
|
|||||||
if (caps->maxvcpus)
|
if (caps->maxvcpus)
|
||||||
virBufferAsprintf(&buf, "<vcpu max='%d'/>\n", caps->maxvcpus);
|
virBufferAsprintf(&buf, "<vcpu max='%d'/>\n", caps->maxvcpus);
|
||||||
|
|
||||||
FORMAT_SINGLE("iothreads", caps->iothreads);
|
qemuDomainCapsFeatureFormatSimple(&buf, "iothreads", caps->iothreads);
|
||||||
|
|
||||||
virDomainCapsOSFormat(&buf, &caps->os);
|
virDomainCapsOSFormat(&buf, &caps->os);
|
||||||
virDomainCapsCPUFormat(&buf, &caps->cpu);
|
virDomainCapsCPUFormat(&buf, &caps->cpu);
|
||||||
@ -628,8 +633,8 @@ virDomainCapsFormat(const virDomainCaps *caps)
|
|||||||
virBufferAdjustIndent(&buf, 2);
|
virBufferAdjustIndent(&buf, 2);
|
||||||
|
|
||||||
virDomainCapsFeatureGICFormat(&buf, &caps->gic);
|
virDomainCapsFeatureGICFormat(&buf, &caps->gic);
|
||||||
FORMAT_SINGLE("vmcoreinfo", caps->vmcoreinfo);
|
qemuDomainCapsFeatureFormatSimple(&buf, "vmcoreinfo", caps->vmcoreinfo);
|
||||||
FORMAT_SINGLE("genid", caps->genid);
|
qemuDomainCapsFeatureFormatSimple(&buf, "genid", caps->genid);
|
||||||
virDomainCapsFeatureSEVFormat(&buf, caps->sev);
|
virDomainCapsFeatureSEVFormat(&buf, caps->sev);
|
||||||
|
|
||||||
virBufferAdjustIndent(&buf, -2);
|
virBufferAdjustIndent(&buf, -2);
|
||||||
|
Loading…
Reference in New Issue
Block a user