[libvirt] [PATCH] pci: Use bool return type for some virPCIDeviceGet*() functions

Andrea Bolognani abologna at redhat.com
Thu Jan 28 08:21:43 UTC 2016


The affected functions are:

  virPCIDeviceGetManaged()
  virPCIDeviceGetUnbindFromStub()
  virPCIDeviceGetRemoveSlot()
  virPCIDeviceGetReprobe()

Change their return type from unsigned int to bool: the corresponding
members in struct _virPCIDevice are defined as bool, and even the
corresponding virPCIDeviceSet*() functions take a bool value as input
so there's no point in these functions having unsigned int as return
type.

Suggested-by: John Ferlan <jferlan at redhat.com>
---
 src/util/virpci.c | 8 ++++----
 src/util/virpci.h | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/util/virpci.c b/src/util/virpci.c
index 505c1f3..6554351 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -1693,7 +1693,7 @@ void virPCIDeviceSetManaged(virPCIDevicePtr dev, bool managed)
     dev->managed = managed;
 }
 
-unsigned int
+bool
 virPCIDeviceGetManaged(virPCIDevicePtr dev)
 {
     return dev->managed;
@@ -1711,7 +1711,7 @@ virPCIDeviceGetStubDriver(virPCIDevicePtr dev)
     return dev->stubDriver;
 }
 
-unsigned int
+bool
 virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev)
 {
     return dev->unbind_from_stub;
@@ -1723,7 +1723,7 @@ virPCIDeviceSetUnbindFromStub(virPCIDevicePtr dev, bool unbind)
     dev->unbind_from_stub = unbind;
 }
 
-unsigned int
+bool
 virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev)
 {
     return dev->remove_slot;
@@ -1735,7 +1735,7 @@ virPCIDeviceSetRemoveSlot(virPCIDevicePtr dev, bool remove_slot)
     dev->remove_slot = remove_slot;
 }
 
-unsigned int
+bool
 virPCIDeviceGetReprobe(virPCIDevicePtr dev)
 {
     return dev->reprobe;
diff --git a/src/util/virpci.h b/src/util/virpci.h
index d1ac942..5529b24 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -99,7 +99,7 @@ int virPCIDeviceReset(virPCIDevicePtr dev,
 
 void virPCIDeviceSetManaged(virPCIDevice *dev,
                             bool managed);
-unsigned int virPCIDeviceGetManaged(virPCIDevice *dev);
+bool virPCIDeviceGetManaged(virPCIDevice *dev);
 void virPCIDeviceSetStubDriver(virPCIDevicePtr dev,
                                virPCIStubDriver driver);
 virPCIStubDriver virPCIDeviceGetStubDriver(virPCIDevicePtr dev);
@@ -110,13 +110,13 @@ int virPCIDeviceSetUsedBy(virPCIDevice *dev,
 void virPCIDeviceGetUsedBy(virPCIDevice *dev,
                            const char **drv_name,
                            const char **dom_name);
-unsigned int virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev);
+bool virPCIDeviceGetUnbindFromStub(virPCIDevicePtr dev);
 void  virPCIDeviceSetUnbindFromStub(virPCIDevice *dev,
                                     bool unbind);
-unsigned int virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev);
+bool virPCIDeviceGetRemoveSlot(virPCIDevicePtr dev);
 void virPCIDeviceSetRemoveSlot(virPCIDevice *dev,
                                bool remove_slot);
-unsigned int virPCIDeviceGetReprobe(virPCIDevicePtr dev);
+bool virPCIDeviceGetReprobe(virPCIDevicePtr dev);
 void virPCIDeviceSetReprobe(virPCIDevice *dev,
                             bool reprobe);
 void virPCIDeviceReattachInit(virPCIDevice *dev);
-- 
2.5.0




More information about the libvir-list mailing list