From: Andrea Bolognani Date: Mon, 24 Nov 2025 17:53:14 +0000 (+0100) Subject: qemu_firmware: Introduce qemuFirmwareFillDomainCustom() X-Git-Tag: v12.0.0-rc1~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3acdcd2eb78a7cc8a17acc279dfbddf873dea1f8;p=thirdparty%2Flibvirt.git qemu_firmware: Introduce qemuFirmwareFillDomainCustom() Simple helper for the case where completely custom firmware paths are in use. It's quite trivial right now, but it will be expanded slightly in an upcoming commit. Signed-off-by: Andrea Bolognani Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_firmware.c b/src/qemu/qemu_firmware.c index 9dff3828a2..9b6c14701f 100644 --- a/src/qemu/qemu_firmware.c +++ b/src/qemu/qemu_firmware.c @@ -1601,6 +1601,32 @@ qemuFirmwareFetchParsedConfigs(bool privileged, } +/** + * qemuFirmwareFillDomainCustom: + * @def: domain definition + * + * Fill in whatever information we can when totally custom firmware + * paths are in use. + * + * Should only be used as a fallback in case looking at the firmware + * descriptors yielded no results, and neither did going through the + * legacy list of CODE:VARS pairs. + */ +static void +qemuFirmwareFillDomainCustom(virDomainDef *def) +{ + virDomainLoaderDef *loader = def->os.loader; + + if (!loader) + return; + + if (!loader->format) + loader->format = VIR_STORAGE_FILE_RAW; + + return; +} + + /** * qemuFirmwareFillDomainLegacy: * @driver: QEMU driver @@ -1890,15 +1916,11 @@ qemuFirmwareFillDomain(virQEMUDriver *driver, if ((ret = qemuFirmwareFillDomainLegacy(driver, def)) < 0) return -1; - /* If we've gotten this far without finding a match, it - * means that we're dealing with a set of completely - * custom paths. In that case, unless the user has - * specified otherwise, we have to assume that they're in - * raw format */ if (ret == 1) { - if (loader && !loader->format) { - loader->format = VIR_STORAGE_FILE_RAW; - } + /* If we've gotten this far without finding a match, + * it means that we're dealing with a set of completely + * custom paths. We can still fill in some information */ + qemuFirmwareFillDomainCustom(def); } } else { virReportError(VIR_ERR_OPERATION_FAILED,