mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-10-19 07:33:46 +03:00
qemu: Move virBuffer inside switch() statement
This doesn't make a whole lot of difference now, but once we introduce more virDomainIOMMUModel values the current structure will no longer work. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
@@ -6928,7 +6928,6 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|||||||
const virDomainDef *def,
|
const virDomainDef *def,
|
||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
VIR_AUTOCLEAN(virBuffer) opts = VIR_BUFFER_INITIALIZER;
|
|
||||||
const virDomainIOMMUDef *iommu = def->iommu;
|
const virDomainIOMMUDef *iommu = def->iommu;
|
||||||
|
|
||||||
if (!iommu)
|
if (!iommu)
|
||||||
@@ -6942,7 +6941,9 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
switch (iommu->model) {
|
switch (iommu->model) {
|
||||||
case VIR_DOMAIN_IOMMU_MODEL_INTEL:
|
case VIR_DOMAIN_IOMMU_MODEL_INTEL: {
|
||||||
|
VIR_AUTOCLEAN(virBuffer) opts = VIR_BUFFER_INITIALIZER;
|
||||||
|
|
||||||
virBufferAddLit(&opts, "intel-iommu");
|
virBufferAddLit(&opts, "intel-iommu");
|
||||||
if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
|
if (iommu->intremap != VIR_TRISTATE_SWITCH_ABSENT) {
|
||||||
virBufferAsprintf(&opts, ",intremap=%s",
|
virBufferAsprintf(&opts, ",intremap=%s",
|
||||||
@@ -6960,15 +6961,17 @@ qemuBuildIOMMUCommandLine(virCommandPtr cmd,
|
|||||||
virBufferAsprintf(&opts, ",device-iotlb=%s",
|
virBufferAsprintf(&opts, ",device-iotlb=%s",
|
||||||
virTristateSwitchTypeToString(iommu->iotlb));
|
virTristateSwitchTypeToString(iommu->iotlb));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virCommandAddArg(cmd, "-device");
|
||||||
|
virCommandAddArgBuffer(cmd, &opts);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
case VIR_DOMAIN_IOMMU_MODEL_LAST:
|
||||||
default:
|
default:
|
||||||
virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
|
virReportEnumRangeError(virDomainIOMMUModel, iommu->model);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
virCommandAddArg(cmd, "-device");
|
|
||||||
virCommandAddArgBuffer(cmd, &opts);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user