On 04/03/2016 03:27 PM, Martin Kletzander wrote:
We had both and the only difference was that the latter also
included
information about multifunction setting. The problem with that was that
we couldn't use functions made for only one of the structs (e.g.
parsing). To consolidate those two structs, move it to virpci.h and
include that in domain_conf.h.
This has annoyed me for a long time, but as usual I just ignored it. I
haven't looked further in your patches to see why you needed to do this
now, but I think I would have preferred it to be solved by leaving
virPCIDeviceAddress as it is, and including one as a member of
virDevicePCIAddress (or if that was too ugly, then naming the new single
struct as virPCIDeviceAddress instead of virDevicePCIAddress, since it's
defined in virpci.h). (I would prefer to not have "multifunction" in the
struct used by virpci.c etc because they don't use that, so it could
confuse people in those usages who might mistakenly believe they should
set it one way or the other; then eventually we would end up with a
bunch of cargo cult settings of multifunction that nobody understood,
but everybody thought were essential).
In the end it's eliminating a near duplicate struct, which is a net
positive no matter what the name, so I can give it a soft ACK - ie if
someone else objects then I would be inclined to waffle on my ACK :-)
(But again, I really wonder if this is something needed right before a
release...)
Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/conf/device_conf.h | 11 +----
src/conf/node_device_conf.c | 2 +-
src/conf/node_device_conf.h | 6 +--
src/libvirt_private.syms | 10 ++--
src/network/bridge_driver.c | 4 +-
src/node_device/node_device_linux_sysfs.c | 6 +--
src/util/virhostdev.c | 12 ++---
src/util/virnetdev.c | 4 +-
src/util/virnetdev.h | 2 +-
src/util/virpci.c | 80 +++++++++++++++----------------
src/util/virpci.h | 29 +++++------
11 files changed, 79 insertions(+), 87 deletions(-)
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 85ce40f6831e..3fe259cb8916 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -31,6 +31,7 @@
# include "virutil.h"
# include "virthread.h"
# include "virbuffer.h"
+# include "virpci.h"
typedef enum {
VIR_INTERFACE_STATE_UNKNOWN = 1,
@@ -45,16 +46,6 @@ typedef enum {
VIR_ENUM_DECL(virInterfaceState)
-typedef struct _virDevicePCIAddress virDevicePCIAddress;
-typedef virDevicePCIAddress *virDevicePCIAddressPtr;
-struct _virDevicePCIAddress {
- unsigned int domain;
- unsigned int bus;
- unsigned int slot;
- unsigned int function;
- int multi; /* virTristateSwitch */
-};
-
typedef struct _virInterfaceLink virInterfaceLink;
typedef virInterfaceLink *virInterfaceLinkPtr;
struct _virInterfaceLink {
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index a76f785eddc0..3e9c821762eb 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -1142,7 +1142,7 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt,
char *numberStr = NULL;
int nAddrNodes, ret = -1;
size_t i;
- virPCIDeviceAddressPtr pciAddr = NULL;
+ virDevicePCIAddressPtr pciAddr = NULL;
ctxt->node = iommuGroupNode;
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index be6dd5eb4ec1..9c9d942dd506 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -109,12 +109,12 @@ typedef struct _virNodeDevCapData {
unsigned int class;
char *product_name;
char *vendor_name;
- virPCIDeviceAddressPtr physical_function;
- virPCIDeviceAddressPtr *virtual_functions;
+ virDevicePCIAddressPtr physical_function;
+ virDevicePCIAddressPtr *virtual_functions;
size_t num_virtual_functions;
unsigned int max_virtual_functions;
unsigned int flags;
- virPCIDeviceAddressPtr *iommuGroupDevices;
+ virDevicePCIAddressPtr *iommuGroupDevices;
size_t nIommuGroupDevices;
unsigned int iommuGroupNumber;
int numa_node;
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 684f06cd4f16..8bb901568079 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1966,11 +1966,11 @@ virObjectUnref;
# util/virpci.h
-virPCIDeviceAddressGetIOMMUGroupAddresses;
-virPCIDeviceAddressGetIOMMUGroupNum;
-virPCIDeviceAddressGetSysfsFile;
-virPCIDeviceAddressIOMMUGroupIterate;
-virPCIDeviceAddressParse;
+virDevicePCIAddressGetIOMMUGroupAddresses;
+virDevicePCIAddressGetIOMMUGroupNum;
+virDevicePCIAddressGetSysfsFile;
+virDevicePCIAddressIOMMUGroupIterate;
+virDevicePCIAddressParse;
virPCIDeviceCopy;
virPCIDeviceDetach;
virPCIDeviceFileIterate;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c673cc1515e2..65a3e68868b8 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2336,7 +2336,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
size_t numVirtFns = 0;
unsigned int maxVirtFns = 0;
char **vfNames = NULL;
- virPCIDeviceAddressPtr *virtFns;
+ virDevicePCIAddressPtr *virtFns;
int ret = -1;
size_t i;
@@ -2356,7 +2356,7 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
goto cleanup;
for (i = 0; i < numVirtFns; i++) {
- virPCIDeviceAddressPtr thisVirtFn = virtFns[i];
+ virDevicePCIAddressPtr thisVirtFn = virtFns[i];
const char *thisName = vfNames[i];
virNetworkForwardIfDefPtr thisIf
= &netdef->forward.ifs[netdef->forward.nifs];
diff --git a/src/node_device/node_device_linux_sysfs.c
b/src/node_device/node_device_linux_sysfs.c
index 24a6a2eaa51f..0a858d31f387 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -176,7 +176,7 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapDataPtr data)
{
size_t i;
int tmpGroup, ret = -1;
- virPCIDeviceAddress addr;
+ virDevicePCIAddress addr;
/* this could be a refresh, so clear out the old data */
for (i = 0; i < data->pci_dev.nIommuGroupDevices; i++)
@@ -189,7 +189,7 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapDataPtr data)
addr.bus = data->pci_dev.bus;
addr.slot = data->pci_dev.slot;
addr.function = data->pci_dev.function;
- tmpGroup = virPCIDeviceAddressGetIOMMUGroupNum(&addr);
+ tmpGroup = virDevicePCIAddressGetIOMMUGroupNum(&addr);
if (tmpGroup == -1) {
/* error was already reported */
goto cleanup;
@@ -200,7 +200,7 @@ nodeDeviceSysfsGetPCIIOMMUGroupCaps(virNodeDevCapDataPtr data)
goto cleanup;
}
if (tmpGroup >= 0) {
- if (virPCIDeviceAddressGetIOMMUGroupAddresses(&addr,
&data->pci_dev.iommuGroupDevices,
+ if (virDevicePCIAddressGetIOMMUGroupAddresses(&addr,
&data->pci_dev.iommuGroupDevices,
&data->pci_dev.nIommuGroupDevices) < 0)
goto cleanup;
data->pci_dev.iommuGroupNumber = tmpGroup;
diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c
index 933c94263c58..1c2475356c4a 100644
--- a/src/util/virhostdev.c
+++ b/src/util/virhostdev.c
@@ -68,7 +68,7 @@ struct virHostdevIsPCINodeDeviceUsedData {
*
* pci - a short-lived virPCIDevice whose purpose is usually just to look
* up the actual PCI device in one of the bookkeeping lists; basically
- * little more than a fancy virPCIDeviceAddress
+ * little more than a fancy virDevicePCIAddress
*
* pcidevs - a list containing a bunch of the above
*
@@ -81,7 +81,7 @@ struct virHostdevIsPCINodeDeviceUsedData {
* module usually expect an 'actual'. Even with these conventions in place,
* adding comments to highlight ownership-related issues is recommended */
-static int virHostdevIsPCINodeDeviceUsed(virPCIDeviceAddressPtr devAddr, void *opaque)
+static int virHostdevIsPCINodeDeviceUsed(virDevicePCIAddressPtr devAddr, void *opaque)
{
virPCIDevicePtr actual;
int ret = -1;
@@ -270,14 +270,14 @@ static int
virHostdevPCISysfsPath(virDomainHostdevDefPtr hostdev,
char **sysfs_path)
{
- virPCIDeviceAddress config_address;
+ virDevicePCIAddress config_address;
config_address.domain = hostdev->source.subsys.u.pci.addr.domain;
config_address.bus = hostdev->source.subsys.u.pci.addr.bus;
config_address.slot = hostdev->source.subsys.u.pci.addr.slot;
config_address.function = hostdev->source.subsys.u.pci.addr.function;
- return virPCIDeviceAddressGetSysfsFile(&config_address, sysfs_path);
+ return virDevicePCIAddressGetSysfsFile(&config_address, sysfs_path);
}
@@ -508,7 +508,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
int last_processed_hostdev_vf = -1;
size_t i;
int ret = -1;
- virPCIDeviceAddressPtr devAddr = NULL;
+ virDevicePCIAddressPtr devAddr = NULL;
if (!nhostdevs)
return 0;
@@ -548,7 +548,7 @@ virHostdevPreparePCIDevices(virHostdevManagerPtr mgr,
*/
devAddr = virPCIDeviceGetAddress(pci);
if (usesVFIO) {
- if (virPCIDeviceAddressIOMMUGroupIterate(devAddr,
+ if (virDevicePCIAddressIOMMUGroupIterate(devAddr,
virHostdevIsPCINodeDeviceUsed,
&data) < 0)
goto cleanup;
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index aed50f546263..2486bd7a135d 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1808,7 +1808,7 @@ virNetDevSysfsDeviceFile(char **pf_sysfs_device_link, const char
*ifname,
int
virNetDevGetVirtualFunctions(const char *pfname,
char ***vfname,
- virPCIDeviceAddressPtr **virt_fns,
+ virDevicePCIAddressPtr **virt_fns,
size_t *n_vfname,
unsigned int *max_vfs)
{
@@ -1995,7 +1995,7 @@ virNetDevGetVirtualFunctionInfo(const char *vfname, char **pfname,
int
virNetDevGetVirtualFunctions(const char *pfname ATTRIBUTE_UNUSED,
char ***vfname ATTRIBUTE_UNUSED,
- virPCIDeviceAddressPtr **virt_fns ATTRIBUTE_UNUSED,
+ virDevicePCIAddressPtr **virt_fns ATTRIBUTE_UNUSED,
size_t *n_vfname ATTRIBUTE_UNUSED,
unsigned int *max_vfs ATTRIBUTE_UNUSED)
{
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index e7719d58a410..e8ac3e5cff3a 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -162,7 +162,7 @@ int virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
int virNetDevGetVirtualFunctions(const char *pfname,
char ***vfname,
- virPCIDeviceAddressPtr **virt_fns,
+ virDevicePCIAddressPtr **virt_fns,
size_t *n_vfname,
unsigned int *max_vfs)
ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index f7921f86d6de..215a03efa670 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -69,7 +69,7 @@ VIR_ENUM_IMPL(virPCIHeader, VIR_PCI_HEADER_LAST,
);
struct _virPCIDevice {
- virPCIDeviceAddress address;
+ virDevicePCIAddress address;
char name[PCI_ADDR_LEN]; /* domain:bus:slot.function */
char id[PCI_ID_LEN]; /* product vendor */
@@ -1696,7 +1696,7 @@ virPCIDeviceFree(virPCIDevicePtr dev)
*
* Returns: a pointer to the address, which can never be NULL.
*/
-virPCIDeviceAddressPtr
+virDevicePCIAddressPtr
virPCIDeviceGetAddress(virPCIDevicePtr dev)
{
return &(dev->address);
@@ -2001,14 +2001,14 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
}
-/* virPCIDeviceAddressIOMMUGroupIterate:
+/* virDevicePCIAddressIOMMUGroupIterate:
* Call @actor for all devices in the same iommu_group as orig
* (including orig itself) Even if there is no iommu_group for the
* device, call @actor once for orig.
*/
int
-virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
- virPCIDeviceAddressActor actor,
+virDevicePCIAddressIOMMUGroupIterate(virDevicePCIAddressPtr orig,
+ virDevicePCIAddressActor actor,
void *opaque)
{
char *groupPath = NULL;
@@ -2029,12 +2029,12 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr
orig,
}
while ((direrr = virDirRead(groupDir, &ent, groupPath)) > 0) {
- virPCIDeviceAddress newDev;
+ virDevicePCIAddress newDev;
if (ent->d_name[0] == '.')
continue;
- if (virPCIDeviceAddressParse(ent->d_name, &newDev) < 0) {
+ if (virDevicePCIAddressParse(ent->d_name, &newDev) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Found invalid device link '%s' in
'%s'"),
ent->d_name, groupPath);
@@ -2058,7 +2058,7 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
static int
-virPCIDeviceGetIOMMUGroupAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
+virPCIDeviceGetIOMMUGroupAddOne(virDevicePCIAddressPtr newDevAddr, void *opaque)
{
int ret = -1;
virPCIDeviceListPtr groupList = opaque;
@@ -2093,7 +2093,7 @@ virPCIDeviceGetIOMMUGroupList(virPCIDevicePtr dev)
if (!groupList)
goto error;
- if (virPCIDeviceAddressIOMMUGroupIterate(&(dev->address),
+ if (virDevicePCIAddressIOMMUGroupIterate(&(dev->address),
virPCIDeviceGetIOMMUGroupAddOne,
groupList) < 0)
goto error;
@@ -2107,17 +2107,17 @@ virPCIDeviceGetIOMMUGroupList(virPCIDevicePtr dev)
typedef struct {
- virPCIDeviceAddressPtr **iommuGroupDevices;
+ virDevicePCIAddressPtr **iommuGroupDevices;
size_t *nIommuGroupDevices;
-} virPCIDeviceAddressList;
-typedef virPCIDeviceAddressList *virPCIDeviceAddressListPtr;
+} virDevicePCIAddressList;
+typedef virDevicePCIAddressList *virDevicePCIAddressListPtr;
static int
-virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr newDevAddr, void *opaque)
+virPCIGetIOMMUGroupAddressesAddOne(virDevicePCIAddressPtr newDevAddr, void *opaque)
{
int ret = -1;
- virPCIDeviceAddressListPtr addrList = opaque;
- virPCIDeviceAddressPtr copyAddr;
+ virDevicePCIAddressListPtr addrList = opaque;
+ virDevicePCIAddressPtr copyAddr;
/* make a copy to insert onto the list */
if (VIR_ALLOC(copyAddr) < 0)
@@ -2137,22 +2137,22 @@ virPCIGetIOMMUGroupAddressesAddOne(virPCIDeviceAddressPtr
newDevAddr, void *opaq
/*
- * virPCIDeviceAddressGetIOMMUGroupAddresses - return a
+ * virDevicePCIAddressGetIOMMUGroupAddresses - return a
* virPCIDeviceList containing all of the devices in the same
* iommu_group as @dev.
*
* Return the new list, or NULL on failure
*/
int
-virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDeviceAddressPtr devAddr,
- virPCIDeviceAddressPtr **iommuGroupDevices,
+virDevicePCIAddressGetIOMMUGroupAddresses(virDevicePCIAddressPtr devAddr,
+ virDevicePCIAddressPtr **iommuGroupDevices,
size_t *nIommuGroupDevices)
{
int ret = -1;
- virPCIDeviceAddressList addrList = { iommuGroupDevices,
+ virDevicePCIAddressList addrList = { iommuGroupDevices,
nIommuGroupDevices };
- if (virPCIDeviceAddressIOMMUGroupIterate(devAddr,
+ if (virDevicePCIAddressIOMMUGroupIterate(devAddr,
virPCIGetIOMMUGroupAddressesAddOne,
&addrList) < 0)
goto cleanup;
@@ -2163,12 +2163,12 @@ virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDeviceAddressPtr
devAddr,
}
-/* virPCIDeviceAddressGetIOMMUGroupNum - return the group number of
+/* virDevicePCIAddressGetIOMMUGroupNum - return the group number of
* this PCI device's iommu_group, or -2 if there is no iommu_group for
* the device (or -1 if there was any other error)
*/
int
-virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr)
+virDevicePCIAddressGetIOMMUGroupNum(virDevicePCIAddressPtr addr)
{
char *devName = NULL;
char *devPath = NULL;
@@ -2391,8 +2391,8 @@ logStrToLong_ui(char const *s,
}
int
-virPCIDeviceAddressParse(char *address,
- virPCIDeviceAddressPtr bdf)
+virDevicePCIAddressParse(char *address,
+ virDevicePCIAddressPtr bdf)
{
char *p = NULL;
int ret = -1;
@@ -2429,8 +2429,8 @@ virPCIDeviceAddressParse(char *address,
* returns true if equal
*/
static bool
-virPCIDeviceAddressIsEqual(virPCIDeviceAddressPtr bdf1,
- virPCIDeviceAddressPtr bdf2)
+virDevicePCIAddressIsEqual(virDevicePCIAddressPtr bdf1,
+ virDevicePCIAddressPtr bdf2)
{
return ((bdf1->domain == bdf2->domain) &&
(bdf1->bus == bdf2->bus) &&
@@ -2440,7 +2440,7 @@ virPCIDeviceAddressIsEqual(virPCIDeviceAddressPtr bdf1,
static int
virPCIGetDeviceAddressFromSysfsLink(const char *device_link,
- virPCIDeviceAddressPtr *bdf)
+ virDevicePCIAddressPtr *bdf)
{
char *config_address = NULL;
char *device_path = NULL;
@@ -2465,7 +2465,7 @@ virPCIGetDeviceAddressFromSysfsLink(const char *device_link,
if (VIR_ALLOC(*bdf) != 0)
goto out;
- if (virPCIDeviceAddressParse(config_address, *bdf) != 0) {
+ if (virDevicePCIAddressParse(config_address, *bdf) != 0) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Failed to parse PCI config address '%s'"),
config_address);
@@ -2485,7 +2485,7 @@ virPCIGetDeviceAddressFromSysfsLink(const char *device_link,
*/
int
virPCIGetPhysicalFunction(const char *vf_sysfs_path,
- virPCIDeviceAddressPtr *pf)
+ virDevicePCIAddressPtr *pf)
{
int ret = -1;
char *device_link = NULL;
@@ -2510,14 +2510,14 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path,
*/
int
virPCIGetVirtualFunctions(const char *sysfs_path,
- virPCIDeviceAddressPtr **virtual_functions,
+ virDevicePCIAddressPtr **virtual_functions,
size_t *num_virtual_functions,
unsigned int *max_virtual_functions)
{
int ret = -1;
size_t i;
char *device_link = NULL;
- virPCIDeviceAddress *config_addr = NULL;
+ virDevicePCIAddressPtr config_addr = NULL;
char *totalvfs_file = NULL, *totalvfs_str = NULL;
*virtual_functions = NULL;
@@ -2609,8 +2609,8 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
size_t i;
size_t num_virt_fns = 0;
unsigned int max_virt_fns = 0;
- virPCIDeviceAddressPtr vf_bdf = NULL;
- virPCIDeviceAddressPtr *virt_fns = NULL;
+ virDevicePCIAddressPtr vf_bdf = NULL;
+ virDevicePCIAddressPtr *virt_fns = NULL;
if (virPCIGetDeviceAddressFromSysfsLink(vf_sysfs_device_link,
&vf_bdf) < 0)
@@ -2625,7 +2625,7 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
}
for (i = 0; i < num_virt_fns; i++) {
- if (virPCIDeviceAddressIsEqual(vf_bdf, virt_fns[i])) {
+ if (virDevicePCIAddressIsEqual(vf_bdf, virt_fns[i])) {
*vf_index = i;
ret = 0;
break;
@@ -2658,7 +2658,7 @@ virPCIGetSysfsFile(char *virPCIDeviceName, char
**pci_sysfs_device_link)
}
int
-virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddressPtr addr,
+virDevicePCIAddressGetSysfsFile(virDevicePCIAddressPtr addr,
char **pci_sysfs_device_link)
{
if (virAsprintf(pci_sysfs_device_link,
@@ -2713,14 +2713,14 @@ int
virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
char **pfname, int *vf_index)
{
- virPCIDeviceAddressPtr pf_config_address = NULL;
+ virDevicePCIAddressPtr pf_config_address = NULL;
char *pf_sysfs_device_path = NULL;
int ret = -1;
if (virPCIGetPhysicalFunction(vf_sysfs_device_path, &pf_config_address) <
0)
return ret;
- if (virPCIDeviceAddressGetSysfsFile(pf_config_address,
+ if (virDevicePCIAddressGetSysfsFile(pf_config_address,
&pf_sysfs_device_path) < 0) {
VIR_FREE(pf_config_address);
@@ -2745,7 +2745,7 @@ static const char *unsupported = N_("not supported on
non-linux platforms");
int
virPCIGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
- virPCIDeviceAddressPtr *pf ATTRIBUTE_UNUSED)
+ virDevicePCIAddressPtr *pf ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
return -1;
@@ -2753,7 +2753,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path
ATTRIBUTE_UNUSED,
int
virPCIGetVirtualFunctions(const char *sysfs_path ATTRIBUTE_UNUSED,
- virPCIDeviceAddressPtr **virtual_functions ATTRIBUTE_UNUSED,
+ virDevicePCIAddressPtr **virtual_functions ATTRIBUTE_UNUSED,
size_t *num_virtual_functions ATTRIBUTE_UNUSED,
unsigned int *max_virtual_functions ATTRIBUTE_UNUSED)
{
@@ -2779,7 +2779,7 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link
ATTRIBUTE_UNUSED,
}
int
-virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddressPtr dev ATTRIBUTE_UNUSED,
+virDevicePCIAddressGetSysfsFile(virDevicePCIAddressPtr dev ATTRIBUTE_UNUSED,
char **pci_sysfs_device_link ATTRIBUTE_UNUSED)
{
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 82f45ec4175f..8ae916c562d7 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -30,16 +30,17 @@
typedef struct _virPCIDevice virPCIDevice;
typedef virPCIDevice *virPCIDevicePtr;
-typedef struct _virPCIDeviceAddress virPCIDeviceAddress;
-typedef virPCIDeviceAddress *virPCIDeviceAddressPtr;
typedef struct _virPCIDeviceList virPCIDeviceList;
typedef virPCIDeviceList *virPCIDeviceListPtr;
-struct _virPCIDeviceAddress {
+typedef struct _virDevicePCIAddress virDevicePCIAddress;
+typedef virDevicePCIAddress *virDevicePCIAddressPtr ;
+struct _virDevicePCIAddress {
unsigned int domain;
unsigned int bus;
unsigned int slot;
unsigned int function;
+ int multi; /* virTristateSwitch */
};
typedef enum {
@@ -113,7 +114,7 @@ bool virPCIDeviceGetManaged(virPCIDevice *dev);
void virPCIDeviceSetStubDriver(virPCIDevicePtr dev,
virPCIStubDriver driver);
virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevicePtr dev);
-virPCIDeviceAddressPtr virPCIDeviceGetAddress(virPCIDevicePtr dev);
+virDevicePCIAddressPtr virPCIDeviceGetAddress(virPCIDevicePtr dev);
int virPCIDeviceSetUsedBy(virPCIDevice *dev,
const char *drv_name,
const char *dom_name);
@@ -168,16 +169,16 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev,
virPCIDeviceFileActor actor,
void *opaque);
-typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddress *addr,
+typedef int (*virDevicePCIAddressActor)(virDevicePCIAddressPtr addr,
void *opaque);
-int virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
- virPCIDeviceAddressActor actor,
+int virDevicePCIAddressIOMMUGroupIterate(virDevicePCIAddressPtr orig,
+ virDevicePCIAddressActor actor,
void *opaque);
virPCIDeviceListPtr virPCIDeviceGetIOMMUGroupList(virPCIDevicePtr dev);
-int virPCIDeviceAddressGetIOMMUGroupAddresses(virPCIDeviceAddressPtr devAddr,
- virPCIDeviceAddressPtr
**iommuGroupDevices,
+int virDevicePCIAddressGetIOMMUGroupAddresses(virDevicePCIAddressPtr devAddr,
+ virDevicePCIAddressPtr
**iommuGroupDevices,
size_t *nIommuGroupDevices);
-int virPCIDeviceAddressGetIOMMUGroupNum(virPCIDeviceAddressPtr addr);
+int virDevicePCIAddressGetIOMMUGroupNum(virDevicePCIAddressPtr addr);
char *virPCIDeviceGetIOMMUGroupDev(virPCIDevicePtr dev);
int virPCIDeviceIsAssignable(virPCIDevicePtr dev,
@@ -185,10 +186,10 @@ int virPCIDeviceIsAssignable(virPCIDevicePtr dev,
int virPCIDeviceWaitForCleanup(virPCIDevicePtr dev, const char *matcher);
int virPCIGetPhysicalFunction(const char *vf_sysfs_path,
- virPCIDeviceAddressPtr *pf);
+ virDevicePCIAddressPtr *pf);
int virPCIGetVirtualFunctions(const char *sysfs_path,
- virPCIDeviceAddressPtr **virtual_functions,
+ virDevicePCIAddressPtr **virtual_functions,
size_t *num_virtual_functions,
unsigned int *max_virtual_functions);
@@ -198,7 +199,7 @@ int virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
const char *vf_sysfs_device_link,
int *vf_index);
-int virPCIDeviceAddressGetSysfsFile(virPCIDeviceAddressPtr addr,
+int virDevicePCIAddressGetSysfsFile(virDevicePCIAddressPtr addr,
char **pci_sysfs_device_link);
int virPCIGetNetName(char *device_link_sysfs_path, char **netname);
@@ -214,7 +215,7 @@ int virPCIGetAddrString(unsigned int domain,
char **pciConfigAddr)
ATTRIBUTE_NONNULL(5) ATTRIBUTE_RETURN_CHECK;
-int virPCIDeviceAddressParse(char *address, virPCIDeviceAddressPtr bdf);
+int virDevicePCIAddressParse(char *address, virDevicePCIAddressPtr bdf);
int virPCIGetVirtualFunctionInfo(const char *vf_sysfs_device_path,
char **pfname, int *vf_index);