conf: Remove do-nothing validation functions

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@ellerman.id.au>
This commit is contained in:
Michael Ellerman 2012-01-13 14:39:26 +11:00 committed by Eric Blake
parent 4b942fe860
commit bfbbc49638
2 changed files with 2 additions and 37 deletions

View File

@ -1766,10 +1766,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;
@ -1785,24 +1785,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)
{
@ -1813,7 +1795,6 @@ virDomainDeviceInfoIsSet(virDomainDeviceInfoPtr info, unsigned int flags)
return 0;
}
void virDomainDeviceInfoClear(virDomainDeviceInfoPtr info)
{
VIR_FREE(info->alias);
@ -2098,12 +2079,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:
@ -2150,13 +2125,6 @@ virDomainDeviceVirtioSerialAddressParseXML(
goto cleanup;
}
if (!virDomainDeviceVirtioSerialAddressIsValid(addr)) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Insufficient specification for "
"virtio serial address"));
goto cleanup;
}
ret = 0;
cleanup:

View File

@ -1713,9 +1713,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);