mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 12:35:17 +00:00
virpci, domain_audit: use virPCIDeviceAddressAsString()
There is no need to open code the PCI address string format when we have a function that does exactly that. Reviewed-by: Laine Stump <laine@redhat.com> Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
This commit is contained in:
parent
32c5e43204
commit
03f9c17805
@ -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);
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user