]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
vircgroup: introduce virCgroupCopyMounts helper
authorPavel Hrdina <phrdina@redhat.com>
Wed, 14 Oct 2020 09:12:46 +0000 (11:12 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Tue, 3 Nov 2020 20:26:32 +0000 (21:26 +0100)
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/util/vircgroup.c

index 3db20ed262a025616832cae2e7d6535cdae0f1cc..a30aec4e5ef4cf397cd2508bc388b11a17bee106 100644 (file)
@@ -239,6 +239,23 @@ virCgroupSetBackends(virCgroupPtr group)
 }
 
 
+static int
+virCgroupCopyMounts(virCgroupPtr group,
+                    virCgroupPtr parent)
+{
+    size_t i;
+
+    for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
+        if (group->backends[i] &&
+            group->backends[i]->copyMounts(group, parent) < 0) {
+            return -1;
+        }
+    }
+
+    return 0;
+}
+
+
 /*
  * Process /proc/mounts figuring out what controllers are
  * mounted and where
@@ -375,12 +392,8 @@ virCgroupDetect(virCgroupPtr group,
         return -1;
 
     if (parent) {
-        for (i = 0; i < VIR_CGROUP_BACKEND_TYPE_LAST; i++) {
-            if (group->backends[i] &&
-                group->backends[i]->copyMounts(group, parent) < 0) {
-                return -1;
-            }
-        }
+        if (virCgroupCopyMounts(group, parent) < 0)
+            return -1;
     } else {
         if (virCgroupDetectMounts(group) < 0)
             return -1;