[libvirt PATCH 34/38] device_conf: Use virXMLProp(OnOff|YesNo) in virPCIDeviceAddressParseXML

Tim Wiederhake twiederh at redhat.com
Thu Mar 18 08:01:13 UTC 2021


Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
---
 src/conf/device_conf.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 714ac50762..ee248648bd 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -214,7 +214,7 @@ 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");
+    virTristateSwitch multifunction = VIR_TRISTATE_SWITCH_ABSENT;
 
     memset(addr, 0, sizeof(*addr));
 
@@ -246,14 +246,10 @@ 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);
+    if (virXMLPropOnOff(node, "multifunction", &multifunction) < 0)
         return -1;
+    addr->multi = multifunction;
 
-    }
     if (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
         return -1;
 
-- 
2.26.2




More information about the libvir-list mailing list