[PATCH v2 10/10] Remove unused functions that release addresses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since address sets are now recalculated on demand instead of being
cached, there's no need for functions that release addresses.
---
 src/conf/domain_addr.c   | 100 -----------------------------------------------
 src/conf/domain_addr.h   |  16 --------
 src/libvirt_private.syms |   3 --
 3 files changed, 119 deletions(-)

diff --git a/src/conf/domain_addr.c b/src/conf/domain_addr.c
index e09b409..5368aa0 100644
--- a/src/conf/domain_addr.c
+++ b/src/conf/domain_addr.c
@@ -497,39 +497,6 @@ virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
 }
 
 
-int
-virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
-                               virPCIDeviceAddressPtr addr)
-{
-    addrs->buses[addr->bus].slots[addr->slot] &= ~(1 << addr->function);
-    return 0;
-}
-
-int
-virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
-                               virPCIDeviceAddressPtr addr)
-{
-    /* permit any kind of connection type in validation, since we
-     * already had it, and are giving it back.
-     */
-    virDomainPCIConnectFlags flags = VIR_PCI_CONNECT_TYPES_MASK;
-    int ret = -1;
-    char *addrStr = NULL;
-
-    if (!(addrStr = virDomainPCIAddressAsString(addr)))
-        goto cleanup;
-
-    if (!virDomainPCIAddressValidate(addrs, addr, addrStr, flags, false))
-        goto cleanup;
-
-    addrs->buses[addr->bus].slots[addr->slot] = 0;
-    ret = 0;
- cleanup:
-    VIR_FREE(addrStr);
-    return ret;
-}
-
-
 virDomainPCIAddressSetPtr
 virDomainPCIAddressSetAlloc(unsigned int nbuses)
 {
@@ -781,29 +748,6 @@ virDomainCCWAddressValidate(virDomainDefPtr def ATTRIBUTE_UNUSED,
     return virDomainCCWAddressAssign(info, data, false);
 }
 
-int
-virDomainCCWAddressReleaseAddr(virDomainCCWAddressSetPtr addrs,
-                               virDomainDeviceInfoPtr dev)
-{
-    char *addr;
-    int ret;
-
-    addr = virDomainCCWAddressAsString(&(dev->addr.ccw));
-    if (!addr)
-        return -1;
-
-    if ((ret = virHashRemoveEntry(addrs->defined, addr)) == 0 &&
-        dev->addr.ccw.cssid == addrs->next.cssid &&
-        dev->addr.ccw.ssid == addrs->next.ssid &&
-        dev->addr.ccw.devno < addrs->next.devno) {
-        addrs->next.devno = dev->addr.ccw.devno;
-        addrs->next.assigned = false;
-    }
-
-    VIR_FREE(addr);
-
-    return ret;
-}
 
 void virDomainCCWAddressSetFree(virDomainCCWAddressSetPtr addrs)
 {
@@ -1239,50 +1183,6 @@ virDomainVirtioSerialAddrReserve(virDomainDefPtr def ATTRIBUTE_UNUSED,
     return ret;
 }
 
-/* virDomainVirtioSerialAddrRelease
- *
- * Release the virtio serial address of the device
- */
-int
-virDomainVirtioSerialAddrRelease(virDomainVirtioSerialAddrSetPtr addrs,
-                                 virDomainDeviceInfoPtr info)
-{
-    virBitmapPtr map;
-    char *str = NULL;
-    int ret = -1;
-    ssize_t i;
-
-    if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_SERIAL ||
-        info->addr.vioserial.port == 0)
-        return 0;
-
-    VIR_DEBUG("Releasing virtio serial %u %u", info->addr.vioserial.controller,
-              info->addr.vioserial.port);
-
-    i = virDomainVirtioSerialAddrFindController(addrs, info->addr.vioserial.controller);
-    if (i < 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("virtio serial controller %u is missing"),
-                       info->addr.vioserial.controller);
-        goto cleanup;
-    }
-
-    map = addrs->controllers[i]->ports;
-    if (virBitmapClearBit(map, info->addr.vioserial.port) < 0) {
-        virReportError(VIR_ERR_XML_ERROR,
-                       _("virtio serial controller %u does not have port %u"),
-                       info->addr.vioserial.controller,
-                       info->addr.vioserial.port);
-        goto cleanup;
-    }
-
-    ret = 0;
-
- cleanup:
-    VIR_FREE(str);
-    return ret;
-}
-
 
 bool
 virDomainUSBAddressPortIsValid(unsigned int *port)
diff --git a/src/conf/domain_addr.h b/src/conf/domain_addr.h
index 4584e0a..87865e6 100644
--- a/src/conf/domain_addr.h
+++ b/src/conf/domain_addr.h
@@ -139,14 +139,6 @@ int virDomainPCIAddressEnsureAddr(virDomainPCIAddressSetPtr addrs,
                                   virDomainDeviceInfoPtr dev)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
-int virDomainPCIAddressReleaseAddr(virDomainPCIAddressSetPtr addrs,
-                                   virPCIDeviceAddressPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
-int virDomainPCIAddressReleaseSlot(virDomainPCIAddressSetPtr addrs,
-                                   virPCIDeviceAddressPtr addr)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
 int virDomainPCIAddressGetNextSlot(virDomainPCIAddressSetPtr addrs,
                                    virPCIDeviceAddressPtr next_addr,
                                    virDomainPCIConnectFlags flags)
@@ -180,9 +172,6 @@ int virDomainCCWAddressValidate(virDomainDefPtr def,
                                 void *data)
     ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 
-int virDomainCCWAddressReleaseAddr(virDomainCCWAddressSetPtr addrs,
-                                   virDomainDeviceInfoPtr dev)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 virDomainCCWAddressSetPtr virDomainCCWAddressSetCreate(void);
 
 struct _virDomainVirtioSerialController {
@@ -235,11 +224,6 @@ virDomainVirtioSerialAddrReserve(virDomainDefPtr def,
                                  void *data)
     ATTRIBUTE_NONNULL(3) ATTRIBUTE_NONNULL(4);
 
-int
-virDomainVirtioSerialAddrRelease(virDomainVirtioSerialAddrSetPtr addrs,
-                                 virDomainDeviceInfoPtr info)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
-
 bool
 virDomainUSBAddressPortIsValid(unsigned int *port)
     ATTRIBUTE_NONNULL(1);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 6b54812..f020e2f 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -87,7 +87,6 @@ virPCIDeviceAddressParseXML;
 # conf/domain_addr.h
 virDomainCCWAddressAllocate;
 virDomainCCWAddressAssign;
-virDomainCCWAddressReleaseAddr;
 virDomainCCWAddressSetCreate;
 virDomainCCWAddressSetFree;
 virDomainCCWAddressValidate;
@@ -97,7 +96,6 @@ virDomainPCIAddressBusSetModel;
 virDomainPCIAddressEnsureAddr;
 virDomainPCIAddressFlagsCompatible;
 virDomainPCIAddressGetNextSlot;
-virDomainPCIAddressReleaseSlot;
 virDomainPCIAddressReserveAddr;
 virDomainPCIAddressReserveNextSlot;
 virDomainPCIAddressReserveSlot;
@@ -122,7 +120,6 @@ virDomainUSBAddressSetFree;
 virDomainVirtioSerialAddrAssign;
 virDomainVirtioSerialAddrAutoAssign;
 virDomainVirtioSerialAddrIsComplete;
-virDomainVirtioSerialAddrRelease;
 virDomainVirtioSerialAddrReserve;
 virDomainVirtioSerialAddrSetAddControllers;
 virDomainVirtioSerialAddrSetCreate;
-- 
2.7.4 (Apple Git-66)

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]