[PATCH 1/2] domain_conf: refactor virDomainDeviceAddressIsValid to boolean

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/conf/device_conf.c |  4 ++--
 src/conf/device_conf.h |  2 +-
 src/conf/domain_conf.c | 16 ++++++++--------
 src/conf/domain_conf.h |  4 ++--
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index b3b04e1..61c73dc 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -39,11 +39,11 @@ VIR_ENUM_IMPL(virInterfaceState,
               "down", "lowerlayerdown",
               "testing", "dormant", "up")
 
-int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr)
+bool virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr)
 {
     /* PCI bus has 32 slots and 8 functions per slot */
     if (addr->slot >= 32 || addr->function >= 8)
-        return 0;
+        return false;
     return addr->domain || addr->bus || addr->slot;
 }
 
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index f067a35..1808c26 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -62,7 +62,7 @@ struct _virInterfaceLink {
     unsigned int speed;      /* link speed in Mbits per second */
 };
 
-int virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr);
+bool virDevicePCIAddressIsValid(virDevicePCIAddressPtr addr);
 
 int virDevicePCIAddressParseXML(xmlNodePtr node,
                                 virDevicePCIAddressPtr addr);
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c25c74b..712ba37 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2493,7 +2493,7 @@ void virDomainObjListRemoveLocked(virDomainObjListPtr doms,
     virHashRemoveEntry(doms->objs, uuidstr);
 }
 
-static int
+static bool
 virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr)
 {
     return addr->cssid <= VIR_DOMAIN_DEVICE_CCW_MAX_CSSID &&
@@ -2501,31 +2501,31 @@ virDomainDeviceCCWAddressIsValid(virDomainDeviceCCWAddressPtr addr)
         addr->devno <= VIR_DOMAIN_DEVICE_CCW_MAX_DEVNO;
 }
 
-int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
-                                  int type)
+bool virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
+                                   int type)
 {
     if (info->type != type)
-        return 0;
+        return false;
 
     switch (info->type) {
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI:
         return virDevicePCIAddressIsValid(&info->addr.pci);
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE:
-        return 1;
+        return true;
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390:
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_MMIO:
-        return 1;
+        return true;
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW:
         return virDomainDeviceCCWAddressIsValid(&info->addr.ccw);
 
     case VIR_DOMAIN_DEVICE_ADDRESS_TYPE_USB:
-        return 1;
+        return true;
     }
 
-    return 0;
+    return false;
 }
 
 virDomainDeviceInfoPtr
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index bffc0a5..d7c9bf8 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2208,8 +2208,8 @@ virDomainDeviceDefPtr virDomainDeviceDefCopy(virDomainDeviceDefPtr src,
                                              const virDomainDef *def,
                                              virCapsPtr caps,
                                              virDomainXMLOptionPtr xmlopt);
-int virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
-                                  int type);
+bool virDomainDeviceAddressIsValid(virDomainDeviceInfoPtr info,
+                                   int type);
 virDomainDeviceInfoPtr virDomainDeviceGetInfo(virDomainDeviceDefPtr device);
 int virDomainDeviceInfoCopy(virDomainDeviceInfoPtr dst,
                             virDomainDeviceInfoPtr src);
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




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