[PATCH] qemu: update qemuCgroupControllerActive signature

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

 



Clang warned about a dead assignment.  In the process, I noticed
that we are only using the function for a bool value.  I audited
all other callers in qemu_{migration,cgroup,driver,hotplug), and
all were making the call in a bool context.

* src/qemu/qemu_cgroup.c (qemuSetupCgroup): Delete dead
assignment.
(qemuCgroupControllerActive): Change return type to bool.
* src/qemu/qemu_cgroup.h (qemuCgroupControllerActive): Likewise.
---
 src/qemu/qemu_cgroup.c |   14 +++++++-------
 src/qemu/qemu_cgroup.h |    4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 7e88a67..ac1c016 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -43,16 +43,16 @@ static const char *const defaultDeviceACL[] = {
 #define DEVICE_PTY_MAJOR 136
 #define DEVICE_SND_MAJOR 116

-int qemuCgroupControllerActive(struct qemud_driver *driver,
-                               int controller)
+bool qemuCgroupControllerActive(struct qemud_driver *driver,
+                                int controller)
 {
     if (driver->cgroup == NULL)
-        return 0;
+        return false;
     if (!virCgroupMounted(driver->cgroup, controller))
-        return 0;
+        return false;
     if (driver->cgroupControllers & (1 << controller))
-        return 1;
-    return 0;
+        return true;
+    return false;
 }

 static int
@@ -312,7 +312,7 @@ int qemuSetupCgroup(struct qemud_driver *driver,
     if (vm->def->mem.hard_limit != 0 ||
         vm->def->mem.soft_limit != 0 ||
         vm->def->mem.swap_hard_limit != 0) {
-        if ((rc = qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY))) {
+        if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_MEMORY)) {
             if (vm->def->mem.hard_limit != 0) {
                 rc = virCgroupSetMemoryHardLimit(cgroup, vm->def->mem.hard_limit);
                 if (rc != 0) {
diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h
index 299bd2d..e8abfb4 100644
--- a/src/qemu/qemu_cgroup.h
+++ b/src/qemu/qemu_cgroup.h
@@ -34,8 +34,8 @@ struct _qemuCgroupData {
 };
 typedef struct _qemuCgroupData qemuCgroupData;

-int qemuCgroupControllerActive(struct qemud_driver *driver,
-                               int controller);
+bool qemuCgroupControllerActive(struct qemud_driver *driver,
+                                int controller);
 int qemuSetupDiskCgroup(struct qemud_driver *driver,
                         virDomainObjPtr vm,
                         virCgroupPtr cgroup,
-- 
1.7.4.4

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