[PATCH 4/4] conf: Remove do-nothing validation functions

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

 



There are three address validation routines that do nothing:
  virDomainDeviceDriveAddressIsValid()
  virDomainDeviceUSBAddressIsValid()
  virDomainDeviceVirtioSerialAddressIsValid()

Remove them, and replace their call sites with "1" which is what they
currently return. In some cases this means we can remove an entire
if block.

Signed-off-by: Michael Ellerman <michael@xxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c |   36 ++----------------------------------
 src/conf/domain_conf.h |    3 ---
 2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5e36270..4d04f35 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1759,10 +1759,10 @@ int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
         return virDomainDevicePCIAddressIsValid(&info->addr.pci);
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
-        return virDomainDeviceDriveAddressIsValid(&info->addr.drive);
+        return 1;
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
-        return virDomainDeviceUSBAddressIsValid(&info->addr.usb);
+        return 1;
     }
 
     return 0;
@@ -1778,24 +1778,6 @@ int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr)
 }
 
 
-int virDomainDeviceDriveAddressIsValid(virDomainDeviceDriveAddressPtr addr ATTRIBUTE_UNUSED)
-{
-    /*return addr->controller || addr->bus || addr->unit;*/
-    return 1; /* 0 is valid for all fields, so any successfully parsed addr is valid */
-}
-
-int virDomainDeviceUSBAddressIsValid(virDomainDeviceUSBAddressPtr addr ATTRIBUTE_UNUSED)
-{
-    return 1; /* FIXME.. any successfully parsed addr is valid */
-}
-
-int virDomainDeviceVirtioSerialAddressIsValid(
-    virDomainDeviceVirtioSerialAddressPtr addr ATTRIBUTE_UNUSED)
-{
-    return 1; /* 0 is valid for all fields, so any successfully parsed addr is valid */
-}
-
-
 static int
 virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
 {
@@ -1806,7 +1788,6 @@ virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
     return 0;
 }
 
-
 void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
 {
     VIR_FREE(info->alias);
@@ -2091,12 +2072,6 @@ virDomainDeviceDriveAddressParseXML(xmlNodePtr node,
         goto cleanup;
     }
 
-    if (!virDomainDeviceDriveAddressIsValid(addr)) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("Insufficient specification for drive address"));
-        goto cleanup;
-    }
-
     ret = 0;
 
 cleanup:
@@ -2143,13 +2118,6 @@ virDomainDeviceVirtioSerialAddressParseXML(
         goto cleanup;
     }
 
-    if (!virDomainDeviceVirtioSerialAddressIsValid(addr)) {
-        virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("Insufficient specification for "
-                               "virtio serial address"));
-        goto cleanup;
-    }
-
     ret = 0;
 
 cleanup:
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 3d5d4f8..0e14a26 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1702,9 +1702,6 @@ void virDomainDeviceDefFree(virDomainDeviceDefPtr def);
 int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
                                   int type);
 int virDomainDevicePCIAddressIsValid(virDomainDevicePCIAddressPtr addr);
-int virDomainDeviceDriveAddressIsValid(virDomainDeviceDriveAddressPtr addr);
-int virDomainDeviceVirtioSerialAddressIsValid(virDomainDeviceVirtioSerialAddressPtr addr);
-int virDomainDeviceUSBAddressIsValid(virDomainDeviceUSBAddressPtr addr);
 void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info);
 void virDomainDefClearPCIAddresses(virDomainDefPtr def);
 void virDomainDefClearDeviceAliases(virDomainDefPtr def);
-- 
1.7.7.3

--
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]