[PATCH RESEND 01/20] virpci, domain_audit: use virPCIDeviceAddressAsString()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is no need to open code the PCI address string format
when we have a function that does exactly that.

Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/conf/domain_audit.c | 6 +-----
 src/util/virpci.c       | 6 ++----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index 8bc6633af4..5fa65a8078 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -361,11 +361,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHostdevDefPtr hostdev,
     case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS:
         switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
-            address = g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT,
-                                      pcisrc->addr.domain,
-                                      pcisrc->addr.bus,
-                                      pcisrc->addr.slot,
-                                      pcisrc->addr.function);
+            address = virPCIDeviceAddressAsString(&pcisrc->addr);
             break;
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
             address = g_strdup_printf("%.3d.%.3d", usbsrc->bus, usbsrc->device);
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 50fd5ef7ea..5f50f92abb 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1471,8 +1471,7 @@ virPCIDeviceNew(unsigned int domain,
     dev->address.slot = slot;
     dev->address.function = function;
 
-    dev->name = g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT, domain, bus, slot,
-                                function);
+    dev->name = virPCIDeviceAddressAsString(&dev->address);
 
     dev->path = g_strdup_printf(PCI_SYSFS "devices/%s/config", dev->name);
 
@@ -1998,8 +1997,7 @@ virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr)
     g_autofree char *groupNumStr = NULL;
     unsigned int groupNum;
 
-    devName = g_strdup_printf(VIR_PCI_DEVICE_ADDRESS_FMT, addr->domain, addr->bus,
-                              addr->slot, addr->function);
+    devName = virPCIDeviceAddressAsString(addr);
 
     devPath = virPCIFile(devName, "iommu_group");
 
-- 
2.26.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux