pciaddrs will be moved from hypervisors' private data to domainDef, so domain_conf has to be able to free it. --- src/conf/domain_addr.c | 11 ----------- src/conf/domain_addr.h | 41 ----------------------------------------- src/conf/domain_conf.c | 10 ++++++++++ src/conf/domain_conf.h | 41 +++++++++++++++++++++++++++++++++++++++++ src/libvirt_private.syms | 2 +- 5 files changed, 52 insertions(+), 53 deletions(-) diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c index 93eebf2..09cbc73 100644 --- a/src/conf/domain_addr.c +++ b/src/conf/domain_addr.c @@ -550,17 +550,6 @@ virDomainPCIAddressSetAlloc(unsigned int nbuses) } -void -virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs) -{ - if (!addrs) - return; - - VIR_FREE(addrs->buses); - VIR_FREE(addrs); -} - - int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs, virPCIDeviceAddressPtr next_addr, diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h index cda1e3f..e767f34 100644 --- a/src/conf/domain_addr.h +++ b/src/conf/domain_addr.h @@ -26,22 +26,8 @@ # include "domain_conf.h" -# define VIR_PCI_ADDRESS_SLOT_LAST 31 # define VIR_PCI_ADDRESS_FUNCTION_LAST 7 -typedef enum { - VIR_PCI_CONNECT_HOTPLUGGABLE = 1 << 0, /* is hotplug needed/supported */ - - /* kinds of devices as a bitmap so they can be combined (some PCI - * controllers permit connecting multiple types of devices) - */ - VIR_PCI_CONNECT_TYPE_PCI_DEVICE = 1 << 1, - VIR_PCI_CONNECT_TYPE_PCIE_DEVICE = 1 << 2, - VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT = 1 << 3, - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT = 1 << 4, - VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT = 1 << 5, -} virDomainPCIConnectFlags; - /* a combination of all bits that describe the type of connections * allowed, e.g. PCI, PCIe, switch */ @@ -62,38 +48,11 @@ typedef enum { virDomainPCIConnectFlags virDomainPCIControllerModelToConnectType(virDomainControllerModelPCI model); -typedef struct { - virDomainControllerModelPCI model; - /* flags and min/max can be computed from model, but - * having them ready makes life easier. - */ - virDomainPCIConnectFlags flags; - size_t minSlot, maxSlot; /* usually 0,0 or 0,31, or 1,31 */ - /* Each bit in a slot represents one function on that slot. If the - * bit is set, that function is in use by a device. - */ - uint8_t slots[VIR_PCI_ADDRESS_SLOT_LAST + 1]; -} virDomainPCIAddressBus; -typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr; - -struct _virDomainPCIAddressSet { - virDomainPCIAddressBus *buses; - size_t nbuses; - virPCIDeviceAddress lastaddr; - virDomainPCIConnectFlags lastFlags; - bool dryRun; /* on a dry run, new buses are auto-added - and addresses aren't saved in device infos */ -}; -typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet; -typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr; - char *virDomainPCIAddressAsString(virPCIDeviceAddressPtr addr) ATTRIBUTE_NONNULL(1); virDomainPCIAddressSetPtr virDomainPCIAddressSetAlloc(unsigned int nbuses); -void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs); - bool virDomainPCIAddressFlagsCompatible(virPCIDeviceAddressPtr addr, const char *addrStr, virDomainPCIConnectFlags busFlags, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 12448dd..5f31a97 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2544,6 +2544,16 @@ void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs) VIR_FREE(addrs); } +void +virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs) +{ + if (!addrs) + return; + + VIR_FREE(addrs->buses); + VIR_FREE(addrs); +} + void virDomainDefFree(virDomainDefPtr def) { size_t i; diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 28fdb98..887e061 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2111,6 +2111,46 @@ struct _virDomainCCWAddressSet { typedef struct _virDomainCCWAddressSet virDomainCCWAddressSet; typedef virDomainCCWAddressSet *virDomainCCWAddressSetPtr; +typedef enum { + VIR_PCI_CONNECT_HOTPLUGGABLE = 1 << 0, /* is hotplug needed/supported */ + + /* kinds of devices as a bitmap so they can be combined (some PCI + * controllers permit connecting multiple types of devices) + */ + VIR_PCI_CONNECT_TYPE_PCI_DEVICE = 1 << 1, + VIR_PCI_CONNECT_TYPE_PCIE_DEVICE = 1 << 2, + VIR_PCI_CONNECT_TYPE_PCIE_ROOT_PORT = 1 << 3, + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_UPSTREAM_PORT = 1 << 4, + VIR_PCI_CONNECT_TYPE_PCIE_SWITCH_DOWNSTREAM_PORT = 1 << 5, +} virDomainPCIConnectFlags; + +# define VIR_PCI_ADDRESS_SLOT_LAST 31 + +typedef struct { + virDomainControllerModelPCI model; + /* flags and min/max can be computed from model, but + * having them ready makes life easier. + */ + virDomainPCIConnectFlags flags; + size_t minSlot, maxSlot; /* usually 0,0 or 0,31, or 1,31 */ + /* Each bit in a slot represents one function on that slot. If the + * bit is set, that function is in use by a device. + */ + uint8_t slots[VIR_PCI_ADDRESS_SLOT_LAST + 1]; +} virDomainPCIAddressBus; +typedef virDomainPCIAddressBus *virDomainPCIAddressBusPtr; + +struct _virDomainPCIAddressSet { + virDomainPCIAddressBus *buses; + size_t nbuses; + virPCIDeviceAddress lastaddr; + virDomainPCIConnectFlags lastFlags; + bool dryRun; /* on a dry run, new buses are auto-added + and addresses aren't saved in device infos */ +}; +typedef struct _virDomainPCIAddressSet virDomainPCIAddressSet; +typedef virDomainPCIAddressSet *virDomainPCIAddressSetPtr; + typedef struct _virDomainPowerManagement virDomainPowerManagement; typedef virDomainPowerManagement *virDomainPowerManagementPtr; @@ -2554,6 +2594,7 @@ void virDomainTPMDefFree(virDomainTPMDefPtr def); void virDomainVirtioSerialControllerFree(virDomainVirtioSerialControllerPtr cont); void virDomainVirtioSerialAddrSetFree(virDomainVirtioSerialAddrSetPtr addrs); void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs); +void virDomainPCIAddressSetFree(virDomainPCIAddressSetPtr addrs); typedef int (*virDomainDeviceInfoCallback)(virDomainDefPtr def, virDomainDeviceDefPtr dev, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 75c8f70..a8109d7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -107,7 +107,6 @@ virDomainPCIAddressReserveNextSlot; virDomainPCIAddressReserveSlot; virDomainPCIAddressSetAlloc; virDomainPCIAddressSetCreate; -virDomainPCIAddressSetFree; virDomainPCIAddressSetGrow; virDomainPCIAddressSlotInUse; virDomainPCIAddressValidate; @@ -427,6 +426,7 @@ virDomainOSTypeToString; virDomainParseMemory; virDomainPausedReasonTypeFromString; virDomainPausedReasonTypeToString; +virDomainPCIAddressSetFree; virDomainPMSuspendedReasonTypeFromString; virDomainPMSuspendedReasonTypeToString; virDomainRedirdevBusTypeFromString; -- 2.7.4 (Apple Git-66) -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list