From bfdc14515366894348e943ff33671f19037bf4d6 Mon Sep 17 00:00:00 2001 From: Laine Stump Date: Sat, 19 Nov 2016 14:30:03 -0500 Subject: [PATCH] util: new function virPCIDeviceGetConfigPath() The path to the config file for a PCI device is conventiently stored in a virPCIDevice object, but that object's contents aren't directly visible outside of virpci.c, so we need to have an accessor function for it if anyone needs to look at it. --- src/libvirt_private.syms | 1 + src/util/virpci.c | 12 ++++++++++++ src/util/virpci.h | 1 + 3 files changed, 14 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index ee59caeb7e..43220e0656 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2138,6 +2138,7 @@ virPCIDeviceCopy; virPCIDeviceDetach; virPCIDeviceFileIterate; virPCIDeviceFree; +virPCIDeviceGetConfigPath; virPCIDeviceGetDriverPathAndName; virPCIDeviceGetIOMMUGroupDev; virPCIDeviceGetIOMMUGroupList; diff --git a/src/util/virpci.c b/src/util/virpci.c index 6c8174a67e..0601f496f5 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -1848,6 +1848,18 @@ virPCIDeviceGetName(virPCIDevicePtr dev) return dev->name; } +/** + * virPCIDeviceGetConfigPath: + * + * Returns a pointer to a string containing the path of @dev's PCI + * config file. + */ +const char * +virPCIDeviceGetConfigPath(virPCIDevicePtr dev) +{ + return dev->path; +} + void virPCIDeviceSetManaged(virPCIDevicePtr dev, bool managed) { dev->managed = managed; diff --git a/src/util/virpci.h b/src/util/virpci.h index 5c63eab736..a5e8d005a9 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -97,6 +97,7 @@ virPCIDevicePtr virPCIDeviceNew(unsigned int domain, virPCIDevicePtr virPCIDeviceCopy(virPCIDevicePtr dev); void virPCIDeviceFree(virPCIDevicePtr dev); const char *virPCIDeviceGetName(virPCIDevicePtr dev); +const char *virPCIDeviceGetConfigPath(virPCIDevicePtr dev); int virPCIDeviceDetach(virPCIDevicePtr dev, virPCIDeviceListPtr activeDevs,