mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-12-08 23:03:46 +00:00
71 lines
2.2 KiB
Diff
71 lines
2.2 KiB
Diff
|
From 9f67ec3b70a5c304c6baf6488a8070e4a9ece837 Mon Sep 17 00:00:00 2001
|
||
|
From: Michal Privoznik <mprivozn@redhat.com>
|
||
|
Date: Tue, 7 Jan 2020 10:10:02 +0100
|
||
|
Subject: [PATCH 2/4] qemu_firmware: Introduce @want variable to
|
||
|
qemuFirmwareMatchDomain()
|
||
|
MIME-Version: 1.0
|
||
|
Content-Type: text/plain; charset=UTF-8
|
||
|
Content-Transfer-Encoding: 8bit
|
||
|
|
||
|
This simplifies condition when matching FW interface by having a
|
||
|
single line condition instead of multiline one. Also, it prepares
|
||
|
the code for future expansion.
|
||
|
|
||
|
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
||
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
||
|
---
|
||
|
src/qemu/qemu_firmware.c | 25 +++++++++++++++++++++----
|
||
|
1 file changed, 21 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c
|
||
|
index 96058c9b45..41e05e570b 100644
|
||
|
--- a/src/qemu/qemu_firmware.c
|
||
|
+++ b/src/qemu/qemu_firmware.c
|
||
|
@@ -930,22 +930,39 @@ qemuFirmwareMatchesMachineArch(const qemuFirmware *fw,
|
||
|
}
|
||
|
|
||
|
|
||
|
+static qemuFirmwareOSInterface
|
||
|
+qemuFirmwareOSInterfaceTypeFromOsDefFirmware(virDomainOsDefFirmware fw)
|
||
|
+{
|
||
|
+ switch (fw) {
|
||
|
+ case VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS:
|
||
|
+ return QEMU_FIRMWARE_OS_INTERFACE_BIOS;
|
||
|
+ case VIR_DOMAIN_OS_DEF_FIRMWARE_EFI:
|
||
|
+ return QEMU_FIRMWARE_OS_INTERFACE_UEFI;
|
||
|
+ case VIR_DOMAIN_OS_DEF_FIRMWARE_NONE:
|
||
|
+ case VIR_DOMAIN_OS_DEF_FIRMWARE_LAST:
|
||
|
+ break;
|
||
|
+ }
|
||
|
+
|
||
|
+ return QEMU_FIRMWARE_OS_INTERFACE_NONE;
|
||
|
+}
|
||
|
+
|
||
|
+
|
||
|
static bool
|
||
|
qemuFirmwareMatchDomain(const virDomainDef *def,
|
||
|
const qemuFirmware *fw,
|
||
|
const char *path)
|
||
|
{
|
||
|
size_t i;
|
||
|
+ qemuFirmwareOSInterface want;
|
||
|
bool supportsS3 = false;
|
||
|
bool supportsS4 = false;
|
||
|
bool requiresSMM = false;
|
||
|
bool supportsSEV = false;
|
||
|
|
||
|
+ want = qemuFirmwareOSInterfaceTypeFromOsDefFirmware(def->os.firmware);
|
||
|
+
|
||
|
for (i = 0; i < fw->ninterfaces; i++) {
|
||
|
- if ((def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_BIOS &&
|
||
|
- fw->interfaces[i] == QEMU_FIRMWARE_OS_INTERFACE_BIOS) ||
|
||
|
- (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_EFI &&
|
||
|
- fw->interfaces[i] == QEMU_FIRMWARE_OS_INTERFACE_UEFI))
|
||
|
+ if (fw->interfaces[i] == want)
|
||
|
break;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.24.1
|
||
|
|