vmspawn: Add comment explaining substring match in firmware_data_matches_machine()

The machine types in QEMU firmware descriptions are glob patterns
like "pc-q35-*", so we use strstr() substring matching to check if
our machine type is covered by a given firmware entry.
This commit is contained in:
Daan De Meyer
2026-04-05 21:09:23 +02:00
committed by Daan De Meyer
parent f8e88be1d1
commit a85845f043
+5
View File
@@ -151,6 +151,11 @@ static bool firmware_data_matches_machine(const FirmwareData *fwd, const char *a
if (!streq((*t)->architecture, arch))
continue;
/* The machine types in firmware descriptions are glob patterns such as "pc-q35-*", but
* we pass the short alias (e.g. "q35") as the machine type to QEMU as it always points to
* the latest version. We can't use fnmatch() here because "q35" doesn't match the
* "pc-q35-*" glob, so instead we use substring matching to check if our machine type
* appears in the pattern. */
STRV_FOREACH(m, (*t)->machines)
if (strstr(*m, machine))
return true;