]> xenbits.xensource.com Git - people/aperard/libvirt.git/commitdiff
qemu_command: Don't open code virPCIDeviceAddressAsString()
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 28 Nov 2023 15:06:30 +0000 (16:06 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 5 Dec 2023 08:26:47 +0000 (09:26 +0100)
When building a hostdev props, its PCI address is formatted via
g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT, ...); Well, we have a
function that does exactly that: virPCIDeviceAddressAsString().
Use the latter.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_command.c

index d54149ed2d376dc1c2f23f110679bc39d38a7682..23909dbbabdcb87c0411396182e1dd95a137b839 100644 (file)
@@ -4704,11 +4704,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def,
     g_autoptr(virJSONValue) props = NULL;
     virDomainHostdevSubsysPCI *pcisrc = &dev->source.subsys.u.pci;
     virDomainNetTeamingInfo *teaming;
-    g_autofree char *host = g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT,
-                                            pcisrc->addr.domain,
-                                            pcisrc->addr.bus,
-                                            pcisrc->addr.slot,
-                                            pcisrc->addr.function);
+    g_autofree char *host = virPCIDeviceAddressAsString(&pcisrc->addr);
     const char *failover_pair_id = NULL;
 
     /* caller has to assign proper passthrough backend type */