On Mon, 2016-12-19 at 10:23 -0500, Laine Stump wrote:
This function iterates through all the devices in a domain to
determine if the address it has been given is part of a "multifunction
device" (i.e. multiple devices connected to different functions of the
same slot).
[...]
+static int
+virDomainPCIAddressIsMultiIter(virDomainDefPtr def ATTRIBUTE_UNUSED,
+ virDomainDeviceDefPtr dev ATTRIBUTE_UNUSED,
+ virDomainDeviceInfoPtr info,
+ void *data)
+{
+ virDomainPCIAddressIsMultiIterData *context = data;
+ virPCIDeviceAddressPtr testAddr = context->addr;
s/testAddr/otherAddr/
Or not, up to you :)
[...]
+/**
+ * virDomainPCIAddressIsMulti():
+ *
+ * @def: the domain definition whose devices need adjusting
+ * @addr: the address to check
+ *
+ * See if there is any PCI device in the domain with the same
+ * domain/bus/slot but different function. If so, then this address is
+ * used by a multifunction device.
+ *
+ * Returns true if the address is being used by multiple devices, else
+ * false.
"false otherwise"?
+ */
+bool
+virDomainPCIAddressIsMulti(const virDomainDef *def,
+ virPCIDeviceAddressPtr addr)
+{
+ virDomainPCIAddressIsMultiIterData data = { .addr = addr,
+ .isMulti = false };
+
+ ignore_value(virDomainDeviceInfoIterate((virDomainDefPtr)def,
Space between "(virDomainDefPtr)" and "def".
ACK
--
Andrea Bolognani / Red Hat / Virtualization