conf: Use virTristateXXX in virDomainLoaderDef

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:37 +02:00 committed by Peter Krempa
parent f940ec5f36
commit 2259b8d1fd
2 changed files with 18 additions and 12 deletions

View File

@ -19221,18 +19221,24 @@ virDomainLoaderDefParseXML(xmlNodePtr node,
VIR_FREE(loader->path);
}
if (readonly_str &&
(loader->readonly = virTristateBoolTypeFromString(readonly_str)) <= 0) {
virReportError(VIR_ERR_XML_DETAIL,
_("unknown readonly value: %s"), readonly_str);
return -1;
if (readonly_str) {
int value;
if ((value = virTristateBoolTypeFromString(readonly_str)) <= 0) {
virReportError(VIR_ERR_XML_DETAIL,
_("unknown readonly value: %s"), readonly_str);
return -1;
}
loader->readonly = value;
}
if (secure_str &&
(loader->secure = virTristateBoolTypeFromString(secure_str)) <= 0) {
virReportError(VIR_ERR_XML_DETAIL,
_("unknown secure value: %s"), secure_str);
return -1;
if (secure_str) {
int value;
if ((value = virTristateBoolTypeFromString(secure_str)) <= 0) {
virReportError(VIR_ERR_XML_DETAIL,
_("unknown secure value: %s"), secure_str);
return -1;
}
loader->secure = value;
}
if (type_str) {

View File

@ -2146,9 +2146,9 @@ VIR_ENUM_DECL(virDomainLoader);
struct _virDomainLoaderDef {
char *path;
int readonly; /* enum virTristateBool */
virTristateBool readonly;
virDomainLoader type;
int secure; /* enum virTristateBool */
virTristateBool secure;
char *nvram; /* path to non-volatile RAM */
char *templt; /* user override of path to master nvram */
};