From 08101bde5d3f261abe8ef776f032cf800a6ff449 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Fri, 4 Feb 2022 14:30:38 +0000 Subject: [PATCH] qemu: inline code for filling in per-VM NVRAM path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Before creating a NVRAM path, the qemuDomainNVRAMPathGenerate method checks whether the config is using the old style firmware approach. This check is redundant in one of the two callers. By inlining the check into the other caller, it makes it clearer to understand that the NVRAM path filling is done conditionally. Reviewed-by: Michal Privoznik Signed-off-by: Daniel P. Berrangé --- src/qemu/qemu_domain.c | 14 +++----------- src/qemu/qemu_domain.h | 4 ---- src/qemu/qemu_firmware.c | 7 ++++--- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d4bc2c04ad..acc76c1cd6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4451,7 +4451,9 @@ qemuDomainDefPostParse(virDomainDef *def, def->os.machine = g_strdup(machine); } - qemuDomainNVRAMPathGenerate(cfg, def); + if (virDomainDefHasOldStyleROUEFI(def) && + !def->os.loader->nvram) + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); if (qemuDomainDefAddDefaultDevices(driver, def, qemuCaps) < 0) return -1; @@ -10987,16 +10989,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, } -void -qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg, - virDomainDef *def) -{ - if (virDomainDefHasOldStyleROUEFI(def) && - !def->os.loader->nvram) - qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); -} - - virDomainEventSuspendedDetailType qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index a41db6c327..be56b5dbb3 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -983,10 +983,6 @@ qemuDomainNVRAMPathFormat(virQEMUDriverConfig *cfg, virDomainDef *def, char **path); -void -qemuDomainNVRAMPathGenerate(virQEMUDriverConfig *cfg, - virDomainDef *def); - virDomainEventSuspendedDetailType qemuDomainPausedReasonToSuspendedEvent(virDomainPausedReason reason); diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index ff364996b8..209cc0046a 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1139,11 +1139,12 @@ qemuFirmwareEnableFeatures(virQEMUDriver *driver, VIR_FREE(def->os.loader->templt); def->os.loader->templt = g_strdup(flash->nvram_template.filename); - qemuDomainNVRAMPathGenerate(cfg, def); + qemuDomainNVRAMPathFormat(cfg, def, &def->os.loader->nvram); - VIR_DEBUG("decided on firmware '%s' varstore template '%s'", + VIR_DEBUG("decided on firmware '%s' template '%s' NVRAM '%s'", def->os.loader->path, - def->os.loader->templt); + def->os.loader->templt, + def->os.loader->nvram); break; case QEMU_FIRMWARE_DEVICE_KERNEL: -- 2.47.2