This is a straightforward wrapper around
virPCIDeviceAddressIOMMUGroupIterate() that will make some code less
awkward to write later on.
---
src/libvirt_private.syms | 1 +
src/util/virpci.c | 26 ++++++++++++++++++++++++++
src/util/virpci.h | 8 ++++++--
3 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index c1fd9f6..f8aaa4c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1967,6 +1967,7 @@ virPCIDeviceGetStubDriver;
virPCIDeviceGetUnbindFromStub;
virPCIDeviceGetUsedBy;
virPCIDeviceHasPCIExpressLink;
+virPCIDeviceIOMMUGroupIterate;
virPCIDeviceIsAssignable;
virPCIDeviceIsPCIExpress;
virPCIDeviceListAdd;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index e82583a..d3b2c7e 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1786,6 +1786,32 @@ void virPCIDeviceReattachInit(virPCIDevicePtr pci)
pci->reprobe = true;
}
+/**
+ * virPCIDeviceIOMMUGroupIterate:
+ * @dev: PCI device
+ * @actor: function to be called for all PCI addresses in @dev's IOMMU group
+ * @opaque: data passed as the last parameter to @actor
+ *
+ * Convenience wrapper around virPCIDeviceAddressIOMMUGroupIterate().
+ *
+ * Behaves exactly the same, except it takes a virPCIDevicePtr instead of a
+ * virPCIDeviceAddressPtr as its first argument.
+ *
+ * Returns: 0 on success, <0 on failure.
+ */
+int
+virPCIDeviceIOMMUGroupIterate(virPCIDevicePtr dev,
+ virPCIDeviceAddressActor actor,
+ void *opaque)
+{
+ virPCIDeviceAddress devAddr = { dev->domain, dev->bus,
+ dev->slot, dev->function };
+
+ return virPCIDeviceAddressIOMMUGroupIterate(&devAddr,
+ actor,
+ opaque);
+}
+
virPCIDeviceListPtr
virPCIDeviceListNew(void)
diff --git a/src/util/virpci.h b/src/util/virpci.h
index c7bdb58..87400e0 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -120,6 +120,12 @@ void virPCIDeviceSetReprobe(virPCIDevice *dev,
bool reprobe);
void virPCIDeviceReattachInit(virPCIDevice *dev);
+typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddress *addr,
+ void *opaque);
+int virPCIDeviceIOMMUGroupIterate(virPCIDevicePtr dev,
+ virPCIDeviceAddressActor actor,
+ void *opaque);
+
virPCIDeviceListPtr virPCIDeviceListNew(void);
int virPCIDeviceListAdd(virPCIDeviceListPtr list,
@@ -158,8 +164,6 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
virPCIDeviceFileActor actor,
void *opaque);
-typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddress *addr,
- void *opaque);
int virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
virPCIDeviceAddressActor actor,
void *opaque);
--
2.5.0