[libvirt PATCH 14/14] conf: Use virTristateXXX in virPCIDeviceAddress

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

 



Signed-off-by: Tim Wiederhake <twiederh@xxxxxxxxxx>
---
 src/conf/device_conf.c | 16 +++++++++-------
 src/util/virpci.h      |  2 +-
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 714ac50762..0dd60985e9 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -246,13 +246,15 @@ 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);
-        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 (!virPCIDeviceAddressIsEmpty(addr) && !virPCIDeviceAddressIsValid(addr, true))
         return -1;
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 9b37a12883..2c86642ea7 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -65,7 +65,7 @@ struct _virPCIDeviceAddress {
     unsigned int bus;
     unsigned int slot;
     unsigned int function;
-    int multi; /* virTristateSwitch */
+    virTristateSwitch multi;
     int extFlags; /* enum virPCIDeviceAddressExtensionFlags */
     virZPCIDeviceAddress zpci;
     /* Don't forget to update virPCIDeviceAddressCopy if needed. */
-- 
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