[libvirt PATCH v2 19/51] domain_conf: Use virXMLPropTristateXXX in virDomainDeviceInfoParseXML

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c8411bdf40..91dc00edad 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6620,8 +6620,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
     xmlNodePtr boot = NULL;
     xmlNodePtr rom = NULL;
     int ret = -1;
-    g_autofree char *romenabled = NULL;
-    g_autofree char *rombar = NULL;
     g_autofree char *aliasStr = NULL;
     VIR_XPATH_NODE_AUTORESTORE(ctxt)
 
@@ -6649,18 +6647,13 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
 
     if ((flags & VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) &&
         (rom = virXPathNode("./rom", ctxt))) {
-        if ((romenabled = virXPathString("string(./rom/@enabled)", ctxt)) &&
-            ((info->romenabled = virTristateBoolTypeFromString(romenabled)) <= 0)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unknown rom enabled value '%s'"), romenabled);
+
+        if (virXMLPropTristateBool(rom, "enabled", false, &info->romenabled) < 0)
             goto cleanup;
-        }
-        if ((rombar = virXPathString("string(./rom/@bar)", ctxt)) &&
-            ((info->rombar = virTristateSwitchTypeFromString(rombar)) <= 0)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unknown rom bar value '%s'"), rombar);
+
+        if (virXMLPropTristateSwitch(rom, "bar", false, &info->rombar) < 0)
             goto cleanup;
-        }
+
         info->romfile = virXMLPropString(rom, "file");
 
         if (info->romenabled == VIR_TRISTATE_BOOL_NO &&
-- 
2.26.2




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

  Powered by Linux