diff --git a/src/bhyve/bhyve_device.c b/src/bhyve/bhyve_device.c index fe1c567be3..3eb2956580 100644 --- a/src/bhyve/bhyve_device.c +++ b/src/bhyve/bhyve_device.c @@ -40,7 +40,7 @@ bhyveCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, { int ret = -1; virDomainPCIAddressSetPtr addrs = opaque; - virDevicePCIAddressPtr addr = &info->addr.pci; + virPCIDeviceAddressPtr addr = &info->addr.pci; if (addr->domain == 0 && addr->bus == 0) { if (addr->slot == 0) { @@ -88,7 +88,7 @@ bhyveAssignDevicePCISlots(virDomainDefPtr def, virDomainPCIAddressSetPtr addrs) { size_t i; - virDevicePCIAddress lpc_addr; + virPCIDeviceAddress lpc_addr; /* explicitly reserve slot 1 for LPC-ISA bridge */ memset(&lpc_addr, 0, sizeof(lpc_addr)); diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 4e15d38463..9d9f6a7915 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -55,7 +55,7 @@ VIR_ENUM_IMPL(virNetDevFeature, "rdma", "txudptnl") -int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr, +int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr, bool report) { if (addr->domain > 0xFFFF) { @@ -102,8 +102,8 @@ int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr, int -virDevicePCIAddressParseXML(xmlNodePtr node, - virDevicePCIAddressPtr addr) +virPCIDeviceAddressParseXML(xmlNodePtr node, + virPCIDeviceAddressPtr addr) { char *domain, *slot, *bus, *function, *multi; int ret = -1; @@ -152,7 +152,7 @@ virDevicePCIAddressParseXML(xmlNodePtr node, goto cleanup; } - if (!virDevicePCIAddressIsValid(addr, true)) + if (!virPCIDeviceAddressIsValid(addr, true)) goto cleanup; ret = 0; @@ -167,8 +167,8 @@ virDevicePCIAddressParseXML(xmlNodePtr node, } int -virDevicePCIAddressFormat(virBufferPtr buf, - virDevicePCIAddress addr, +virPCIDeviceAddressFormat(virBufferPtr buf, + virPCIDeviceAddress addr, bool includeTypeInAddr) { virBufferAsprintf(buf, "
domain == addr2->domain && addr1->bus == addr2->bus && diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index 85ce40f683..fc0f4abb36 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 { @@ -81,18 +72,18 @@ typedef enum { VIR_ENUM_DECL(virNetDevFeature) -int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr, +int virPCIDeviceAddressIsValid(virPCIDeviceAddressPtr addr, bool report); -int virDevicePCIAddressParseXML(xmlNodePtr node, - virDevicePCIAddressPtr addr); +int virPCIDeviceAddressParseXML(xmlNodePtr node, + virPCIDeviceAddressPtr addr); -int virDevicePCIAddressFormat(virBufferPtr buf, - virDevicePCIAddress addr, +int virPCIDeviceAddressFormat(virBufferPtr buf, + virPCIDeviceAddress addr, bool includeTypeInAddr); -bool virDevicePCIAddressEqual(virDevicePCIAddress *addr1, - virDevicePCIAddress *addr2); +bool virPCIDeviceAddressEqual(virPCIDeviceAddress *addr1, + virPCIDeviceAddress *addr2); int virInterfaceLinkParseXML(xmlNodePtr node, virInterfaceLinkPtr lnk); diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index c0afa21e05..acd8ce6ed3 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -88,7 +88,7 @@ virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model) } bool -virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr, +virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr, const char *addrStr, virDomainPCIConnectFlags busFlags, virDomainPCIConnectFlags devFlags, @@ -163,7 +163,7 @@ virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr, */ bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, const char *addrStr, virDomainPCIConnectFlags flags, bool fromConfig) @@ -315,7 +315,7 @@ virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus, */ int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags) { int add; @@ -351,7 +351,7 @@ virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs, char * -virDomainPCIAddressAsString(virDevicePCIAddressPtr addr) +virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr) { char *str; @@ -369,7 +369,7 @@ virDomainPCIAddressAsString(virDevicePCIAddressPtr addr) */ bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) { return !!addrs->buses[addr->bus].slots[addr->slot]; } @@ -386,7 +386,7 @@ virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, */ int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, bool reserveEntireSlot, bool fromConfig) @@ -448,7 +448,7 @@ virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags) { return virDomainPCIAddressReserveAddr(addrs, addr, flags, true, false); @@ -499,7 +499,7 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) { addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function); return 0; @@ -507,7 +507,7 @@ virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, int virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) { /* permit any kind of connection type in validation, since we * already had it, and are giving it back. @@ -563,13 +563,13 @@ virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs) int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr next_addr, + virPCIDeviceAddressPtr next_addr, virDomainPCIConnectFlags flags) { /* default to starting the search for a free slot from * the first slot of domain 0 bus 0... */ - virDevicePCIAddress a = { 0, 0, 0, 0, false }; + virPCIDeviceAddress a = { 0, 0, 0, 0, false }; char *addrStr = NULL; if (addrs->nbuses == 0) { @@ -666,7 +666,7 @@ virDomainPCIAddressReserveNextSlot(virDomainPCIAddressSetPtr addrs, virDomainDeviceInfoPtr dev, virDomainPCIConnectFlags flags) { - virDevicePCIAddress addr; + virPCIDeviceAddress addr; if (virDomainPCIAddressGetNextSlot(addrs, &addr, flags) < 0) return -1; diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index 5b5de8a31c..f3eda89d5c 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -79,7 +79,7 @@ typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr; struct _virDomainPCIAddressSet { virDomainPCIAddressBus *buses; size_t nbuses; - virDevicePCIAddress lastaddr; + virPCIDeviceAddress lastaddr; virDomainPCIConnectFlags lastFlags; bool dryRun; /* on a dry run, new buses are auto-added and addresses aren't saved in device infos */ @@ -87,14 +87,14 @@ struct _virDomainPCIAddressSet { typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet; typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr; -char *virDomainPCIAddressAsString(virDevicePCIAddressPtr addr) +char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1); virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses); void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs); -bool virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr, +bool virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr, const char *addrStr, virDomainPCIConnectFlags busFlags, virDomainPCIConnectFlags devFlags, @@ -103,7 +103,7 @@ bool virDomainPCIAddressFlagsCompatible(virDevicePCIAddressPtr addr, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); bool virDomainPCIAddressValidate(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, const char *addrStr, virDomainPCIConnectFlags flags, bool fromConfig) @@ -115,23 +115,23 @@ int virDomainPCIAddressBusSetModel(virDomainPCIAddressBusPtr bus, ATTRIBUTE_NONNULL(1); bool virDomainPCIAddressSlotInUse(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressSetGrow(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressReserveAddr(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags, bool reserveEntireSlot, bool fromConfig) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressReserveSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr, + virPCIDeviceAddressPtr addr, virDomainPCIConnectFlags flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); @@ -140,15 +140,15 @@ int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs, - virDevicePCIAddressPtr next_addr, + virPCIDeviceAddressPtr next_addr, virDomainPCIConnectFlags flags) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 23ff887129..4853f74189 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3113,7 +3113,7 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info, switch (info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: - return virDevicePCIAddressIsValid(&info->addr.pci, false); + return virPCIDeviceAddressIsValid(&info->addr.pci, false); case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE: return 1; @@ -5043,7 +5043,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, switch ((virDomainDeviceAddressType) info->type) { case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI: - if (virDevicePCIAddressParseXML(address, &info->addr.pci) < 0) + if (virPCIDeviceAddressParseXML(address, &info->addr.pci) < 0) goto cleanup; break; @@ -5113,7 +5113,7 @@ virDomainDeviceInfoParseXML(xmlNodePtr node, static int virDomainParseLegacyDeviceAddress(char *devaddr, - virDevicePCIAddressPtr pci) + virPCIDeviceAddressPtr pci) { char *tmp; @@ -5317,10 +5317,10 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node, while (cur != NULL) { if (cur->type == XML_ELEMENT_NODE) { if (xmlStrEqual(cur->name, BAD_CAST "address")) { - virDevicePCIAddressPtr addr = + virPCIDeviceAddressPtr addr = &def->source.subsys.u.pci.addr; - if (virDevicePCIAddressParseXML(cur, addr) < 0) + if (virPCIDeviceAddressParseXML(cur, addr) < 0) goto out; } else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && xmlStrEqual(cur->name, BAD_CAST "state")) { @@ -13263,7 +13263,7 @@ virDomainDiskControllerMatch(int controller_type, int disk_bus) int virDomainDiskIndexByAddress(virDomainDefPtr def, - virDevicePCIAddressPtr pci_address, + virPCIDeviceAddressPtr pci_address, unsigned int bus, unsigned int target, unsigned int unit) { @@ -13278,7 +13278,7 @@ virDomainDiskIndexByAddress(virDomainDefPtr def, for (i = 0; i < def->ndisks; i++) { vdisk = def->disks[i]; if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - virDevicePCIAddressEqual(&vdisk->info.addr.pci, pci_address)) + virPCIDeviceAddressEqual(&vdisk->info.addr.pci, pci_address)) return i; if (vdisk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) { virDomainDeviceDriveAddressPtr drive = &vdisk->info.addr.drive; @@ -13295,7 +13295,7 @@ virDomainDiskIndexByAddress(virDomainDefPtr def, virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def, - virDevicePCIAddressPtr pci_address, + virPCIDeviceAddressPtr pci_address, unsigned int bus, unsigned int target, unsigned int unit) @@ -13465,7 +13465,7 @@ virDomainNetFindIdx(virDomainDefPtr def, virDomainNetDefPtr net) return -1; } if (PCIAddrSpecified) { - if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci, + if (virPCIDeviceAddressEqual(&def->nets[i]->info.addr.pci, &net->info.addr.pci)) { /* exit early if the pci address was specified and * it matches, as this guarantees no duplicates. @@ -13509,7 +13509,7 @@ virDomainHasNet(virDomainDefPtr def, virDomainNetDefPtr net) continue; if (PCIAddrSpecified) { - if (virDevicePCIAddressEqual(&def->nets[i]->info.addr.pci, + if (virPCIDeviceAddressEqual(&def->nets[i]->info.addr.pci, &net->info.addr.pci)) return true; } else { @@ -13686,7 +13686,7 @@ virDomainControllerFindByType(virDomainDefPtr def, int virDomainControllerFindByPCIAddress(virDomainDefPtr def, - virDevicePCIAddressPtr addr) + virPCIDeviceAddressPtr addr) { size_t i; @@ -13694,7 +13694,7 @@ virDomainControllerFindByPCIAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info = &def->controllers[i]->info; if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && - virDevicePCIAddressEqual(&info->addr.pci, addr)) + virPCIDeviceAddressEqual(&info->addr.pci, addr)) return i; } @@ -19747,7 +19747,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - if (virDevicePCIAddressFormat(buf, pcisrc->addr, + if (virPCIDeviceAddressFormat(buf, pcisrc->addr, includeTypeInAddr) != 0) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("PCI address Formatting failed")); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b9fe109562..2cb9fa305d 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -348,7 +348,7 @@ struct _virDomainDeviceInfo { char *alias; int type; /* virDomainDeviceAddressType */ union { - virDevicePCIAddress pci; + virPCIDeviceAddress pci; virDomainDeviceDriveAddress drive; virDomainDeviceVirtioSerialAddress vioserial; virDomainDeviceCcidAddress ccid; @@ -456,7 +456,7 @@ struct _virDomainHostdevSubsysUSB { typedef struct _virDomainHostdevSubsysPCI virDomainHostdevSubsysPCI; typedef virDomainHostdevSubsysPCI *virDomainHostdevSubsysPCIPtr; struct _virDomainHostdevSubsysPCI { - virDevicePCIAddress addr; /* host address */ + virPCIDeviceAddress addr; /* host address */ int backend; /* enum virDomainHostdevSubsysPCIBackendType */ }; @@ -2780,11 +2780,11 @@ int virDomainDefCompatibleDevice(virDomainDefPtr def, void virDomainRNGDefFree(virDomainRNGDefPtr def); int virDomainDiskIndexByAddress(virDomainDefPtr def, - virDevicePCIAddressPtr pci_controller, + virPCIDeviceAddressPtr pci_controller, unsigned int bus, unsigned int target, unsigned int unit); virDomainDiskDefPtr virDomainDiskByAddress(virDomainDefPtr def, - virDevicePCIAddressPtr pci_controller, + virPCIDeviceAddressPtr pci_controller, unsigned int bus, unsigned int target, unsigned int unit); @@ -2855,7 +2855,7 @@ void virDomainControllerInsertPreAlloced(virDomainDefPtr def, int virDomainControllerFind(const virDomainDef *def, int type, int idx); int virDomainControllerFindByType(virDomainDefPtr def, int type); int virDomainControllerFindByPCIAddress(virDomainDefPtr def, - virDevicePCIAddressPtr addr); + virPCIDeviceAddressPtr addr); virDomainControllerDefPtr virDomainControllerRemove(virDomainDefPtr def, size_t i); const char *virDomainControllerAliasFind(const virDomainDef *def, int type, int idx) diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c index e6915ffde7..c574b01b71 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -1974,13 +1974,13 @@ virNetworkForwardDefParseXML(const char *networkName, switch (def->ifs[i].type) { case VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI: { - virDevicePCIAddressPtr addr = &def->ifs[i].device.pci; + virPCIDeviceAddressPtr addr = &def->ifs[i].device.pci; - if (virDevicePCIAddressParseXML(forwardAddrNodes[i], addr) < 0) + if (virPCIDeviceAddressParseXML(forwardAddrNodes[i], addr) < 0) goto cleanup; for (j = 0; j < i; j++) { - if (virDevicePCIAddressEqual(addr, &def->ifs[j].device.pci)) { + if (virPCIDeviceAddressEqual(addr, &def->ifs[j].device.pci)) { virReportError(VIR_ERR_XML_ERROR, _("PCI device '%04x:%02x:%02x.%x' can " "only be listed once in network %s"), @@ -2797,7 +2797,7 @@ virNetworkDefFormatBuf(virBufferPtr buf, virBufferAddLit(buf, "/>\n"); } else { if (def->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI) { - if (virDevicePCIAddressFormat(buf, + if (virPCIDeviceAddressFormat(buf, def->forward.ifs[i].device.pci, true) < 0) goto error; diff --git a/src/conf/network_conf.h b/src/conf/network_conf.h index b72257b970..0d34dfe626 100644 --- a/src/conf/network_conf.h +++ b/src/conf/network_conf.h @@ -169,7 +169,7 @@ typedef virNetworkForwardIfDef *virNetworkForwardIfDefPtr; struct _virNetworkForwardIfDef { int type; union { - virDevicePCIAddress pci; /*PCI Address of device */ + virPCIDeviceAddress pci; /*PCI Address of device */ /* when USB devices are supported a new variable to be added here */ char *dev; /* name of device */ }device; diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c index a76f785edd..e7e4bbd390 100644 --- a/src/conf/node_device_conf.c +++ b/src/conf/node_device_conf.c @@ -1164,8 +1164,8 @@ virNodeDevCapPCIDevIommuGroupParseXML(xmlXPathContextPtr ctxt, goto cleanup; for (i = 0; i < nAddrNodes; i++) { - virDevicePCIAddress addr = { 0, 0, 0, 0, 0 }; - if (virDevicePCIAddressParseXML(addrNodes[i], &addr) < 0) + virPCIDeviceAddress addr = { 0, 0, 0, 0, 0 }; + if (virPCIDeviceAddressParseXML(addrNodes[i], &addr) < 0) goto cleanup; if (VIR_ALLOC(pciAddr) < 0) goto cleanup; diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index daf8f99285..3c83226912 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -603,7 +603,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, if (virXPathNode("./adapter/parentaddr", ctxt)) { xmlNodePtr addrnode = virXPathNode("./adapter/parentaddr/address", ctxt); - virDevicePCIAddressPtr addr = + virPCIDeviceAddressPtr addr = &source->adapter.data.scsi_host.parentaddr; if (!addrnode) { @@ -612,7 +612,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; } source->adapter.data.scsi_host.has_parent = true; - if (virDevicePCIAddressParseXML(addrnode, addr) < 0) + if (virPCIDeviceAddressParseXML(addrnode, addr) < 0) goto cleanup; if ((virXPathInt("string(./adapter/parentaddr/@unique_id)", ctxt, @@ -1103,14 +1103,14 @@ virStoragePoolSourceFormat(virBufferPtr buf, virBufferAsprintf(buf, " name='%s'/>\n", src->adapter.data.scsi_host.name); } else { - virDevicePCIAddress addr; + virPCIDeviceAddress addr; virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferAsprintf(buf, "\n", src->adapter.data.scsi_host.unique_id); virBufferAdjustIndent(buf, 2); addr = src->adapter.data.scsi_host.parentaddr; - ignore_value(virDevicePCIAddressFormat(buf, addr, false)); + ignore_value(virPCIDeviceAddressFormat(buf, addr, false)); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, -2); @@ -2315,7 +2315,7 @@ getSCSIHostNumber(virStoragePoolSourceAdapter adapter, char *name = NULL; if (adapter.data.scsi_host.has_parent) { - virDevicePCIAddress addr = adapter.data.scsi_host.parentaddr; + virPCIDeviceAddress addr = adapter.data.scsi_host.parentaddr; unsigned int unique_id = adapter.data.scsi_host.unique_id; if (!(name = virGetSCSIHostNameByParentaddr(addr.domain, @@ -2419,9 +2419,9 @@ static bool matchSCSIAdapterParent(virStoragePoolObjPtr pool, virStoragePoolDefPtr def) { - virDevicePCIAddressPtr pooladdr = + virPCIDeviceAddressPtr pooladdr = &pool->def->source.adapter.data.scsi_host.parentaddr; - virDevicePCIAddressPtr defaddr = + virPCIDeviceAddressPtr defaddr = &def->source.adapter.data.scsi_host.parentaddr; int pool_unique_id = pool->def->source.adapter.data.scsi_host.unique_id; diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 31b45be04f..54116a690c 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -186,7 +186,7 @@ struct _virStoragePoolSourceAdapter { union { struct { char *name; - virDevicePCIAddress parentaddr; /* host address */ + virPCIDeviceAddress parentaddr; /* host address */ int unique_id; bool has_parent; } scsi_host; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 5030ec3a15..a057a1e830 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -76,14 +76,14 @@ virCPUModeTypeToString; # conf/device_conf.h -virDevicePCIAddressEqual; -virDevicePCIAddressFormat; -virDevicePCIAddressIsValid; -virDevicePCIAddressParseXML; virInterfaceLinkFormat; virInterfaceLinkParseXML; virInterfaceStateTypeFromString; virInterfaceStateTypeToString; +virPCIDeviceAddressEqual; +virPCIDeviceAddressFormat; +virPCIDeviceAddressIsValid; +virPCIDeviceAddressParseXML; # conf/domain_addr.h diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index 29c5febc76..45248d5d6a 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -4457,7 +4457,7 @@ networkNotifyActualDevice(virDomainDefPtr dom, for (i = 0; i < netdef->forward.nifs; i++) { if (netdef->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI && - virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr, + virPCIDeviceAddressEqual(&hostdev->source.subsys.u.pci.addr, &netdef->forward.ifs[i].device.pci)) { dev = &netdef->forward.ifs[i]; break; @@ -4616,7 +4616,7 @@ networkReleaseActualDevice(virDomainDefPtr dom, for (i = 0; i < netdef->forward.nifs; i++) { if (netdef->forward.ifs[i].type == VIR_NETWORK_FORWARD_HOSTDEV_DEVICE_PCI && - virDevicePCIAddressEqual(&hostdev->source.subsys.u.pci.addr, + virPCIDeviceAddressEqual(&hostdev->source.subsys.u.pci.addr, &netdef->forward.ifs[i].device.pci)) { dev = &netdef->forward.ifs[i]; break; diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index 0610f75e52..c55f304d5a 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1770,7 +1770,7 @@ qemuAgentGetFSInfo(qemuAgentPtr mon, virDomainFSInfoPtr **info, virJSONValuePtr reply = NULL; virJSONValuePtr data; virDomainFSInfoPtr *info_ret = NULL; - virDevicePCIAddress pci_address; + virPCIDeviceAddress pci_address; cmd = qemuAgentMakeCommand("guest-get-fsinfo", NULL); if (!cmd) diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index f4d55334ef..c651dce6d7 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -423,7 +423,7 @@ qemuDomainCollectPCIAddress(virDomainDefPtr def ATTRIBUTE_UNUSED, { virDomainPCIAddressSetPtr addrs = opaque; int ret = -1; - virDevicePCIAddressPtr addr = &info->addr.pci; + virPCIDeviceAddressPtr addr = &info->addr.pci; bool entireSlot; /* flags may be changed from default below */ virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE | @@ -620,7 +620,7 @@ qemuDomainValidateDevicePCISlotsPIIX3(virDomainDefPtr def, { int ret = -1; size_t i; - virDevicePCIAddress tmp_addr; + virPCIDeviceAddress tmp_addr; bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); char *addrStr = NULL; virDomainPCIConnectFlags flags = (VIR_PCI_CONNECT_HOTPLUGGABLE @@ -754,7 +754,7 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def, { int ret = -1; size_t i; - virDevicePCIAddress tmp_addr; + virPCIDeviceAddress tmp_addr; bool qemuDeviceVideoUsable = virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VIDEO_PRIMARY); char *addrStr = NULL; virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPE_PCIE_DEVICE; @@ -1021,7 +1021,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, { size_t i, j; virDomainPCIConnectFlags flags = 0; /* initialize to quiet gcc warning */ - virDevicePCIAddress tmp_addr; + virPCIDeviceAddress tmp_addr; /* PCI controllers */ for (i = 0; i < def->ncontrollers; i++) { @@ -1120,7 +1120,7 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, /* USB2 needs special handling to put all companions in the same slot */ if (IS_USB2_CONTROLLER(def->controllers[i])) { - virDevicePCIAddress addr = { 0, 0, 0, 0, false }; + virPCIDeviceAddress addr = { 0, 0, 0, 0, false }; bool foundAddr = false; memset(&tmp_addr, 0, sizeof(tmp_addr)); @@ -1545,7 +1545,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, for (i = 0; i < def->ncontrollers; i++) { virDomainControllerDefPtr cont = def->controllers[i]; int idx = cont->idx; - virDevicePCIAddressPtr addr; + virPCIDeviceAddressPtr addr; virDomainPCIControllerOptsPtr options; if (cont->type != VIR_DOMAIN_CONTROLLER_TYPE_PCI) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 3c9cd3537f..03e5309507 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2309,7 +2309,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, virDomainDeviceInfoCopy(&newdev->info, &olddev->info) < 0) { goto cleanup; } - if (!virDevicePCIAddressEqual(&olddev->info.addr.pci, + if (!virPCIDeviceAddressEqual(&olddev->info.addr.pci, &newdev->info.addr.pci)) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", _("cannot modify network device guest PCI address")); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index d4909d8188..871ebe0bb4 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -675,13 +675,13 @@ int qemuMonitorGetChardevInfo(qemuMonitorPtr mon, int qemuMonitorAttachPCIDiskController(qemuMonitorPtr mon, const char *bus, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *guestAddr); typedef struct _qemuMonitorPCIAddress qemuMonitorPCIAddress; struct _qemuMonitorPCIAddress { unsigned int vendor; unsigned int product; - virDevicePCIAddress addr; + virPCIDeviceAddress addr; }; int qemuMonitorGetAllPCIAddresses(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 81247f4cf9..1587a036f6 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -170,20 +170,20 @@ int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon, const char *tlsSubject); int qemuMonitorJSONAddPCIHostDevice(qemuMonitorPtr mon, - virDevicePCIAddress *hostAddr, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *hostAddr, + virPCIDeviceAddress *guestAddr); int qemuMonitorJSONAddPCIDisk(qemuMonitorPtr mon, const char *path, const char *bus, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *guestAddr); int qemuMonitorJSONAddPCINetwork(qemuMonitorPtr mon, const char *nicstr, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *guestAddr); int qemuMonitorJSONRemovePCIDevice(qemuMonitorPtr mon, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *guestAddr); int qemuMonitorJSONSendFileHandle(qemuMonitorPtr mon, const char *fdname, @@ -209,7 +209,7 @@ int qemuMonitorJSONGetChardevInfo(qemuMonitorPtr mon, int qemuMonitorJSONAttachPCIDiskController(qemuMonitorPtr mon, const char *bus, - virDevicePCIAddress *guestAddr); + virPCIDeviceAddress *guestAddr); int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon, qemuMonitorPCIAddress **addrs); diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 7c7d7d0da9..be993f19d4 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -640,7 +640,7 @@ getAdapterName(virStoragePoolSourceAdapter adapter) if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { if (adapter.data.scsi_host.has_parent) { - virDevicePCIAddress addr = adapter.data.scsi_host.parentaddr; + virPCIDeviceAddress addr = adapter.data.scsi_host.parentaddr; unsigned int unique_id = adapter.data.scsi_host.unique_id; if (!(name = virGetSCSIHostNameByParentaddr(addr.domain, diff --git a/src/util/virpci.c b/src/util/virpci.c index f7921f86d6..3f1252d42b 100644 --- a/src/util/virpci.c +++ b/src/util/virpci.c @@ -2517,7 +2517,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path, int ret = -1; size_t i; char *device_link = NULL; - virPCIDeviceAddress *config_addr = NULL; + virPCIDeviceAddressPtr config_addr = NULL; char *totalvfs_file = NULL, *totalvfs_str = NULL; *virtual_functions = NULL; diff --git a/src/util/virpci.h b/src/util/virpci.h index 82f45ec417..5c63eab736 100644 --- a/src/util/virpci.h +++ b/src/util/virpci.h @@ -40,6 +40,7 @@ struct _virPCIDeviceAddress { unsigned int bus; unsigned int slot; unsigned int function; + int multi; /* virTristateSwitch */ }; typedef enum { @@ -168,7 +169,7 @@ int virPCIDeviceFileIterate(virPCIDevicePtr dev, virPCIDeviceFileActor actor, void *opaque); -typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddress *addr, +typedef int (*virPCIDeviceAddressActor)(virPCIDeviceAddressPtr addr, void *opaque); int virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig, virPCIDeviceAddressActor actor, diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index cf7cdd034c..4dd6b417f7 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -2167,7 +2167,7 @@ xenDaemonAttachDeviceFlags(virConnectPtr conn, if (xenFormatSxprOnePCI(dev->data.hostdev, &buf, 0) < 0) goto cleanup; - virDevicePCIAddress PCIAddr; + virPCIDeviceAddress PCIAddr; PCIAddr = dev->data.hostdev->source.subsys.u.pci.addr; if (virAsprintf(&target, "PCI device: %.4x:%.2x:%.2x",