[libvirt PATCH v3 47/51] device_conf: Use virXMLPropTristateXXX in virPCIDeviceAddressParseXML

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/device_conf.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 0dd60985e9..8d0540bb02 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -214,7 +214,6 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
     g_autofree char *bus      = virXMLPropString(node, "bus");
     g_autofree char *slot     = virXMLPropString(node, "slot");
     g_autofree char *function = virXMLPropString(node, "function");
-    g_autofree char *multi    = virXMLPropString(node, "multifunction");
 
     memset(addr, 0, sizeof(*addr));
 
@@ -246,16 +245,9 @@ virPCIDeviceAddressParseXML(xmlNodePtr node,
         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 (virXMLPropTristateSwitch(node, "multifunction", false, &addr->multi) < 0)
+        return -1;
+
     if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
         return -1;
 
-- 
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