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

[libvirt] [PATCH 1/8] Cleanup: Change datatype of hostdev->managed to boolean



---
 src/conf/domain_conf.c  | 2 +-
 src/conf/domain_conf.h  | 2 +-
 src/qemu/qemu_command.c | 4 ++--
 src/util/virpci.c       | 6 +++---
 src/util/virpci.h       | 2 +-
 src/xenxs/xen_sxpr.c    | 2 +-
 src/xenxs/xen_xm.c      | 2 +-
 7 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index cf955c7..bb9d9f5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3658,7 +3658,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
      */
     if ((managed = virXMLPropString(node, "managed"))!= NULL) {
         if (STREQ(managed, "yes"))
-            def->managed = 1;
+            def->managed = true;
     }
 
     /* @type is passed in from the caller rather than read from the
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9ecea85..0df92ef 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -442,7 +442,7 @@ struct _virDomainHostdevDef {
     virDomainDeviceDef parent; /* higher level Def containing this */
     int mode; /* enum virDomainHostdevMode */
     int startupPolicy; /* enum virDomainStartupPolicy */
-    unsigned int managed : 1;
+    bool managed;
     unsigned int missing : 1;
     bool readonly; /* readonly is only used for scsi hostdev */
     union {
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 41a2dfd..3ba989d 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -8558,7 +8558,7 @@ qemuParseCommandLinePCI(const char *val)
     }
 
     def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
-    def->managed = 1;
+    def->managed = true;
     def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
     def->source.subsys.u.pci.bus = bus;
     def->source.subsys.u.pci.slot = slot;
@@ -8619,7 +8619,7 @@ qemuParseCommandLineUSB(const char *val)
     }
 
     def->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
-    def->managed = 0;
+    def->managed = false;
     def->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB;
     if (*end == '.') {
         def->source.subsys.u.usb.bus = first;
diff --git a/src/util/virpci.c b/src/util/virpci.c
index a0da1cd..805a633 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -65,7 +65,7 @@ struct _virPCIDevice {
     unsigned      pci_pm_cap_pos;
     unsigned      has_flr : 1;
     unsigned      has_pm_reset : 1;
-    unsigned      managed : 1;
+    bool          managed;
 
     /* used by reattach function */
     unsigned      unbind_from_stub : 1;
@@ -1453,9 +1453,9 @@ virPCIDeviceGetName(virPCIDevicePtr dev)
     return dev->name;
 }
 
-void virPCIDeviceSetManaged(virPCIDevicePtr dev, unsigned managed)
+void virPCIDeviceSetManaged(virPCIDevicePtr dev, bool managed)
 {
-    dev->managed = !!managed;
+    dev->managed = managed;
 }
 
 unsigned virPCIDeviceGetManaged(virPCIDevicePtr dev)
diff --git a/src/util/virpci.h b/src/util/virpci.h
index cf2aecd..9ea721a 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -61,7 +61,7 @@ int virPCIDeviceReset(virPCIDevicePtr dev,
                       virPCIDeviceListPtr inactiveDevs);
 
 void virPCIDeviceSetManaged(virPCIDevice *dev,
-                            unsigned managed);
+                            bool managed);
 unsigned virPCIDeviceGetManaged(virPCIDevice *dev);
 void virPCIDeviceSetUsedBy(virPCIDevice *dev,
                            const char *used_by);
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index cc4225b..7ed1482 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -1087,7 +1087,7 @@ xenParseSxprPCI(virDomainDefPtr def,
            goto error;
 
         dev->mode = VIR_DOMAIN_HOSTDEV_MODE_SUBSYS;
-        dev->managed = 0;
+        dev->managed = false;
         dev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
         dev->source.subsys.u.pci.domain = domainID;
         dev->source.subsys.u.pci.bus = busID;
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 34103b9..14e26c3 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -875,7 +875,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
             if (!(hostdev = virDomainHostdevDefAlloc()))
                goto cleanup;
 
-            hostdev->managed = 0;
+            hostdev->managed = false;
             hostdev->source.subsys.type = VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI;
             hostdev->source.subsys.u.pci.domain = domainID;
             hostdev->source.subsys.u.pci.bus = busID;
-- 
1.8.1.4


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