This function needs domain definition really, we don't need to pass the whole domain object. This saves couple of dereferences and characters esp. in more checks to come. Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx> Reviewed-by: Cole Robinson <crobinso@xxxxxxxxxx> --- src/qemu/qemu_firmware.c | 12 ++++++------ src/qemu/qemu_firmware.h | 2 +- src/qemu/qemu_process.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 6a76d355f5..b9bb1df179 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1202,7 +1202,7 @@ qemuFirmwareFetchParsedConfigs(bool privileged, int qemuFirmwareFillDomain(virQEMUDriverPtr driver, - virDomainObjPtr vm, + virDomainDefPtr def, unsigned int flags) { VIR_AUTOSTRINGLIST paths = NULL; @@ -1215,7 +1215,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, if (!(flags & VIR_QEMU_PROCESS_START_NEW)) return 0; - if (vm->def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) + if (def->os.firmware == VIR_DOMAIN_OS_DEF_FIRMWARE_NONE) return 0; if ((nfirmwares = qemuFirmwareFetchParsedConfigs(driver->privileged, @@ -1223,7 +1223,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, return -1; for (i = 0; i < nfirmwares; i++) { - if (qemuFirmwareMatchDomain(vm->def, firmwares[i], paths[i])) { + if (qemuFirmwareMatchDomain(def, firmwares[i], paths[i])) { theone = firmwares[i]; VIR_DEBUG("Found matching firmware (description path '%s')", paths[i]); @@ -1234,7 +1234,7 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, if (!theone) { virReportError(VIR_ERR_OPERATION_FAILED, _("Unable to find any firmware to satisfy '%s'"), - virDomainOsDefFirmwareTypeToString(vm->def->os.firmware)); + virDomainOsDefFirmwareTypeToString(def->os.firmware)); goto cleanup; } @@ -1243,10 +1243,10 @@ qemuFirmwareFillDomain(virQEMUDriverPtr driver, * likely that admin/FW manufacturer messed up. */ qemuFirmwareSanityCheck(theone, paths[i]); - if (qemuFirmwareEnableFeatures(driver, vm->def, theone) < 0) + if (qemuFirmwareEnableFeatures(driver, def, theone) < 0) goto cleanup; - vm->def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE; + def->os.firmware = VIR_DOMAIN_OS_DEF_FIRMWARE_NONE; ret = 0; cleanup: diff --git a/src/qemu/qemu_firmware.h b/src/qemu/qemu_firmware.h index 4be65bc664..37cbfae39d 100644 --- a/src/qemu/qemu_firmware.h +++ b/src/qemu/qemu_firmware.h @@ -45,7 +45,7 @@ qemuFirmwareFetchConfigs(char ***firmwares, int qemuFirmwareFillDomain(virQEMUDriverPtr driver, - virDomainObjPtr vm, + virDomainDefPtr def, unsigned int flags); int diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1e128d1d83..4195042194 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6267,7 +6267,7 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, return -1; VIR_DEBUG("Prepare bios/uefi paths"); - if (qemuFirmwareFillDomain(driver, vm, flags) < 0) + if (qemuFirmwareFillDomain(driver, vm->def, flags) < 0) return -1; if (qemuDomainInitializePflashStorageSource(vm) < 0) return -1; -- 2.24.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list