[libvirt PATCH 06/38] domain_conf: Use virXMLProp(OnOff|YesNo) 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 | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 3a4b01ad1e..e1b2baf621 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;
 
     virDomainDeviceInfoClear(info);
@@ -6673,18 +6671,17 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt,
     }
 
     if (rom) {
-        if ((romenabled = virXMLPropString(rom, "enabled")) &&
-            ((info->romenabled = virTristateBoolTypeFromString(romenabled)) <= 0)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unknown rom enabled value '%s'"), romenabled);
+        virTristateBool romenabled = VIR_TRISTATE_BOOL_ABSENT;
+        virTristateSwitch rombar = VIR_TRISTATE_SWITCH_ABSENT;
+
+        if (virXMLPropYesNo(rom, "enabled", &romenabled) < 0)
             goto cleanup;
-        }
-        if ((rombar = virXMLPropString(rom, "bar")) &&
-            ((info->rombar = virTristateSwitchTypeFromString(rombar)) <= 0)) {
-            virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                           _("unknown rom bar value '%s'"), rombar);
+
+        if (virXMLPropOnOff(rom, "bar", &rombar) < 0)
             goto cleanup;
-        }
+
+        info->romenabled = romenabled;
+        info->rombar = rombar;
         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