[libvirt PATCH 11/25] vircgroup: introduce virCgroupValidatePlacement helper

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

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 src/util/vircgroup.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index b5f38210fb..55fa49a398 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -393,6 +393,23 @@ virCgroupDetectPlacement(virCgroupPtr group,
 }
 
 
+static int
+virCgroupValidatePlacement(virCgroupPtr group,
+                           pid_t pid)
+{
+    size_t i;
+
+    for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
+        if (group->backends[i] &&
+            group->backends[i]->validatePlacement(group, pid) < 0) {
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+
 static int
 virCgroupDetect(virCgroupPtr group,
                 pid_t pid,
@@ -430,12 +447,8 @@ virCgroupDetect(virCgroupPtr group,
         return -1;
 
     /* Check that for every mounted controller, we found our placement */
-    for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
-        if (group->backends[i] &&
-            group->backends[i]->validatePlacement(group, pid) < 0) {
-            return -1;
-        }
-    }
+    if (virCgroupValidatePlacement(group, pid) < 0)
+        return -1;
 
     for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
         if (group->backends[i]) {
-- 
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