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(a)ellerman.id.au>
---
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 2897b4a..c01d07a 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -1750,10 +1750,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;
@@ -1769,24 +1769,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)
{
@@ -1797,7 +1779,6 @@ virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int
flags)
return 0;
}
-
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
{
VIR_FREE(info->alias);
@@ -2082,12 +2063,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:
@@ -2134,13 +2109,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 1f6e442..4b65792 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1701,9 +1701,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