conf: Use virTristateXXX in virPCIDeviceAddress

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-04-07 13:48:41 +02:00 committed by Peter Krempa
parent 975e2cb39d
commit 876f994db1
2 changed files with 10 additions and 8 deletions

View File

@ -246,13 +246,15 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
return -1;
}
if (multi &&
((addr->multi = virTristateSwitchTypeFromString(multi)) <= 0)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unknown value '%s' for <address> 'multifunction' attribute"),
multi);
return -1;
if (multi) {
int value;
if ((value = virTristateSwitchTypeFromString(multi)) <= 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Unknown value '%s' for <address> 'multifunction' attribute"),
multi);
return -1;
}
addr->multi = value;
}
if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
return -1;

View File

@ -61,7 +61,7 @@ struct _virPCIDeviceAddress {
unsigned int bus;
unsigned int slot;
unsigned int function;
int multi; /* virTristateSwitch */
virTristateSwitch multi;
int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
virZPCIDeviceAddress zpci;
/* Don't forget to update virPCIDeviceAddressCopy if needed. */