mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemu_firmware: Pass virDomainDef into qemuFirmwareFillDomain()
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@redhat.com> Reviewed-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
44791eaf8b
commit
50d7465f3d
@ -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:
|
||||
|
@ -45,7 +45,7 @@ qemuFirmwareFetchConfigs(char ***firmwares,
|
||||
|
||||
int
|
||||
qemuFirmwareFillDomain(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDefPtr def,
|
||||
unsigned int flags);
|
||||
|
||||
int
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user