c480ed
From da3574e1bcbc4779b516e8bf14f56abf2a19885d Mon Sep 17 00:00:00 2001
c480ed
Message-Id: <da3574e1bcbc4779b516e8bf14f56abf2a19885d@dist-git>
c480ed
From: Pavel Hrdina <phrdina@redhat.com>
c480ed
Date: Mon, 1 Jul 2019 17:07:07 +0200
c480ed
Subject: [PATCH] vircgroup: rename controllers to legacy
c480ed
MIME-Version: 1.0
c480ed
Content-Type: text/plain; charset=UTF-8
c480ed
Content-Transfer-Encoding: 8bit
c480ed
c480ed
With the introduction of cgroup v2 there are new names used with
c480ed
cgroups based on which version is used:
c480ed
c480ed
    - legacy: cgroup v1
c480ed
    - unified: cgroup v2
c480ed
    - hybrid: cgroup v1 and cgroup v2
c480ed
c480ed
Let's use 'legacy' instead of 'cgroupv1' or 'controllers' in our code.
c480ed
c480ed
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
(cherry picked from commit 65ba48d26745450e5079f171052caa7309c99fdf)
c480ed
c480ed
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1689297
c480ed
c480ed
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
c480ed
Message-Id: <b9853bf7cd21097e0248448362f6178e31ab6279.1561993100.git.phrdina@redhat.com>
c480ed
Reviewed-by: Ján Tomko <jtomko@redhat.com>
c480ed
---
c480ed
 src/util/vircgroup.c     |   6 +-
c480ed
 src/util/vircgrouppriv.h |   2 +-
c480ed
 src/util/vircgroupv1.c   | 140 +++++++++++++++++++--------------------
c480ed
 tests/vircgrouptest.c    |  14 ++--
c480ed
 4 files changed, 81 insertions(+), 81 deletions(-)
c480ed
c480ed
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
c480ed
index b159bda1bb..349c388e0a 100644
c480ed
--- a/src/util/vircgroup.c
c480ed
+++ b/src/util/vircgroup.c
c480ed
@@ -1246,9 +1246,9 @@ virCgroupFree(virCgroupPtr *group)
c480ed
         return;
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
-        VIR_FREE((*group)->controllers[i].mountPoint);
c480ed
-        VIR_FREE((*group)->controllers[i].linkPoint);
c480ed
-        VIR_FREE((*group)->controllers[i].placement);
c480ed
+        VIR_FREE((*group)->legacy[i].mountPoint);
c480ed
+        VIR_FREE((*group)->legacy[i].linkPoint);
c480ed
+        VIR_FREE((*group)->legacy[i].placement);
c480ed
     }
c480ed
 
c480ed
     VIR_FREE((*group)->path);
c480ed
diff --git a/src/util/vircgrouppriv.h b/src/util/vircgrouppriv.h
c480ed
index ee6aeedbb5..c50a25f195 100644
c480ed
--- a/src/util/vircgrouppriv.h
c480ed
+++ b/src/util/vircgrouppriv.h
c480ed
@@ -50,7 +50,7 @@ struct _virCgroup {
c480ed
 
c480ed
     virCgroupBackendPtr backend;
c480ed
 
c480ed
-    virCgroupV1Controller controllers[VIR_CGROUP_CONTROLLER_LAST];
c480ed
+    virCgroupV1Controller legacy[VIR_CGROUP_CONTROLLER_LAST];
c480ed
 };
c480ed
 
c480ed
 int virCgroupSetValueStr(virCgroupPtr group,
c480ed
diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c
c480ed
index 0ba8757348..482615f3c8 100644
c480ed
--- a/src/util/vircgroupv1.c
c480ed
+++ b/src/util/vircgroupv1.c
c480ed
@@ -127,10 +127,10 @@ virCgroupV1ValidateMachineGroup(virCgroupPtr group,
c480ed
         if (i == VIR_CGROUP_CONTROLLER_SYSTEMD)
c480ed
             continue;
c480ed
 
c480ed
-        if (!group->controllers[i].placement)
c480ed
+        if (!group->legacy[i].placement)
c480ed
             continue;
c480ed
 
c480ed
-        tmp = strrchr(group->controllers[i].placement, '/');
c480ed
+        tmp = strrchr(group->legacy[i].placement, '/');
c480ed
         if (!tmp)
c480ed
             return false;
c480ed
 
c480ed
@@ -139,7 +139,7 @@ virCgroupV1ValidateMachineGroup(virCgroupPtr group,
c480ed
             i == VIR_CGROUP_CONTROLLER_CPUSET) {
c480ed
             if (STREQ(tmp, "/emulator"))
c480ed
                 *tmp = '\0';
c480ed
-            tmp = strrchr(group->controllers[i].placement, '/');
c480ed
+            tmp = strrchr(group->legacy[i].placement, '/');
c480ed
             if (!tmp)
c480ed
                 return false;
c480ed
         }
c480ed
@@ -171,15 +171,15 @@ virCgroupV1CopyMounts(virCgroupPtr group,
c480ed
 {
c480ed
     size_t i;
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
-        if (!parent->controllers[i].mountPoint)
c480ed
+        if (!parent->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
-        if (VIR_STRDUP(group->controllers[i].mountPoint,
c480ed
-                       parent->controllers[i].mountPoint) < 0)
c480ed
+        if (VIR_STRDUP(group->legacy[i].mountPoint,
c480ed
+                       parent->legacy[i].mountPoint) < 0)
c480ed
             return -1;
c480ed
 
c480ed
-        if (VIR_STRDUP(group->controllers[i].linkPoint,
c480ed
-                       parent->controllers[i].linkPoint) < 0)
c480ed
+        if (VIR_STRDUP(group->legacy[i].linkPoint,
c480ed
+                       parent->legacy[i].linkPoint) < 0)
c480ed
             return -1;
c480ed
     }
c480ed
     return 0;
c480ed
@@ -193,14 +193,14 @@ virCgroupV1CopyPlacement(virCgroupPtr group,
c480ed
 {
c480ed
     size_t i;
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
         if (i == VIR_CGROUP_CONTROLLER_SYSTEMD)
c480ed
             continue;
c480ed
 
c480ed
         if (path[0] == '/') {
c480ed
-            if (VIR_STRDUP(group->controllers[i].placement, path) < 0)
c480ed
+            if (VIR_STRDUP(group->legacy[i].placement, path) < 0)
c480ed
                 return -1;
c480ed
         } else {
c480ed
             /*
c480ed
@@ -208,10 +208,10 @@ virCgroupV1CopyPlacement(virCgroupPtr group,
c480ed
              * parent == "/libvirt.service" + path == "" => "/libvirt.service"
c480ed
              * parent == "/libvirt.service" + path == "foo" => "/libvirt.service/foo"
c480ed
              */
c480ed
-            if (virAsprintf(&group->controllers[i].placement,
c480ed
+            if (virAsprintf(&group->legacy[i].placement,
c480ed
                             "%s%s%s",
c480ed
-                            parent->controllers[i].placement,
c480ed
-                            (STREQ(parent->controllers[i].placement, "/") ||
c480ed
+                            parent->legacy[i].placement,
c480ed
+                            (STREQ(parent->legacy[i].placement, "/") ||
c480ed
                              STREQ(path, "") ? "" : "/"),
c480ed
                             path) < 0)
c480ed
                 return -1;
c480ed
@@ -320,7 +320,7 @@ virCgroupV1DetectMounts(virCgroupPtr group,
c480ed
              * once. We need to save the results of the last one,
c480ed
              * and we need to be careful to release the memory used
c480ed
              * by previous processing. */
c480ed
-            virCgroupV1ControllerPtr controller = &group->controllers[i];
c480ed
+            virCgroupV1ControllerPtr controller = &group->legacy[i];
c480ed
 
c480ed
             VIR_FREE(controller->mountPoint);
c480ed
             VIR_FREE(controller->linkPoint);
c480ed
@@ -350,19 +350,19 @@ virCgroupV1DetectPlacement(virCgroupPtr group,
c480ed
         const char *typestr = virCgroupV1ControllerTypeToString(i);
c480ed
 
c480ed
         if (virCgroupV1MountOptsMatchController(controllers, typestr) &&
c480ed
-            group->controllers[i].mountPoint != NULL &&
c480ed
-            group->controllers[i].placement == NULL) {
c480ed
+            group->legacy[i].mountPoint != NULL &&
c480ed
+            group->legacy[i].placement == NULL) {
c480ed
             /*
c480ed
              * selfpath == "/" + path="" -> "/"
c480ed
              * selfpath == "/libvirt.service" + path == "" -> "/libvirt.service"
c480ed
              * selfpath == "/libvirt.service" + path == "foo" -> "/libvirt.service/foo"
c480ed
              */
c480ed
             if (i == VIR_CGROUP_CONTROLLER_SYSTEMD) {
c480ed
-                if (VIR_STRDUP(group->controllers[i].placement,
c480ed
+                if (VIR_STRDUP(group->legacy[i].placement,
c480ed
                                selfpath) < 0)
c480ed
                     return -1;
c480ed
             } else {
c480ed
-                if (virAsprintf(&group->controllers[i].placement,
c480ed
+                if (virAsprintf(&group->legacy[i].placement,
c480ed
                                 "%s%s%s", selfpath,
c480ed
                                 (STREQ(selfpath, "/") ||
c480ed
                                  STREQ(path, "") ? "" : "/"),
c480ed
@@ -383,22 +383,22 @@ virCgroupV1ValidatePlacement(virCgroupPtr group,
c480ed
     size_t i;
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
-        if (!group->controllers[i].placement) {
c480ed
+        if (!group->legacy[i].placement) {
c480ed
             virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                            _("Could not find placement for v1 controller %s at %s"),
c480ed
                            virCgroupV1ControllerTypeToString(i),
c480ed
-                           group->controllers[i].placement);
c480ed
+                           group->legacy[i].placement);
c480ed
             return -1;
c480ed
         }
c480ed
 
c480ed
         VIR_DEBUG("Detected mount/mapping %zu:%s at %s in %s for pid %lld",
c480ed
                   i,
c480ed
                   virCgroupV1ControllerTypeToString(i),
c480ed
-                  group->controllers[i].mountPoint,
c480ed
-                  group->controllers[i].placement,
c480ed
+                  group->legacy[i].mountPoint,
c480ed
+                  group->legacy[i].placement,
c480ed
                   (long long) pid);
c480ed
     }
c480ed
 
c480ed
@@ -411,7 +411,7 @@ virCgroupV1StealPlacement(virCgroupPtr group)
c480ed
 {
c480ed
     char *ret = NULL;
c480ed
 
c480ed
-    VIR_STEAL_PTR(ret, group->controllers[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
c480ed
+    VIR_STEAL_PTR(ret, group->legacy[VIR_CGROUP_CONTROLLER_SYSTEMD].placement);
c480ed
 
c480ed
     return ret;
c480ed
 }
c480ed
@@ -430,7 +430,7 @@ virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
         for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
             if (((1 << i) & controllers)) {
c480ed
                 /* Remove non-existent controllers  */
c480ed
-                if (!group->controllers[i].mountPoint) {
c480ed
+                if (!group->legacy[i].mountPoint) {
c480ed
                     VIR_DEBUG("Requested controller '%s' not mounted, ignoring",
c480ed
                               virCgroupV1ControllerTypeToString(i));
c480ed
                     controllers &= ~(1 << i);
c480ed
@@ -441,9 +441,9 @@ virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
             VIR_DEBUG("Controller '%s' wanted=%s, mount='%s'",
c480ed
                       virCgroupV1ControllerTypeToString(i),
c480ed
                       (1 << i) & controllers ? "yes" : "no",
c480ed
-                      NULLSTR(group->controllers[i].mountPoint));
c480ed
+                      NULLSTR(group->legacy[i].mountPoint));
c480ed
             if (!((1 << i) & controllers) &&
c480ed
-                group->controllers[i].mountPoint) {
c480ed
+                group->legacy[i].mountPoint) {
c480ed
                 /* Check whether a request to disable a controller
c480ed
                  * clashes with co-mounting of controllers */
c480ed
                 for (j = 0; j < VIR_CGROUP_CONTROLLER_LAST; j++) {
c480ed
@@ -452,8 +452,8 @@ virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
                     if (!((1 << j) & controllers))
c480ed
                         continue;
c480ed
 
c480ed
-                    if (STREQ_NULLABLE(group->controllers[i].mountPoint,
c480ed
-                                       group->controllers[j].mountPoint)) {
c480ed
+                    if (STREQ_NULLABLE(group->legacy[i].mountPoint,
c480ed
+                                       group->legacy[j].mountPoint)) {
c480ed
                         virReportSystemError(EINVAL,
c480ed
                                              _("V1 controller '%s' is not wanted, but '%s' is co-mounted"),
c480ed
                                              virCgroupV1ControllerTypeToString(i),
c480ed
@@ -461,7 +461,7 @@ virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
                         return -1;
c480ed
                     }
c480ed
                 }
c480ed
-                VIR_FREE(group->controllers[i].mountPoint);
c480ed
+                VIR_FREE(group->legacy[i].mountPoint);
c480ed
             }
c480ed
         }
c480ed
     } else {
c480ed
@@ -470,8 +470,8 @@ virCgroupV1DetectControllers(virCgroupPtr group,
c480ed
         for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
             VIR_DEBUG("Controller '%s' present=%s",
c480ed
                       virCgroupV1ControllerTypeToString(i),
c480ed
-                      group->controllers[i].mountPoint ? "yes" : "no");
c480ed
-            if (group->controllers[i].mountPoint == NULL)
c480ed
+                      group->legacy[i].mountPoint ? "yes" : "no");
c480ed
+            if (group->legacy[i].mountPoint == NULL)
c480ed
                 continue;
c480ed
             controllers |= (1 << i);
c480ed
         }
c480ed
@@ -485,7 +485,7 @@ static bool
c480ed
 virCgroupV1HasController(virCgroupPtr group,
c480ed
                          int controller)
c480ed
 {
c480ed
-    return group->controllers[controller].mountPoint != NULL;
c480ed
+    return group->legacy[controller].mountPoint != NULL;
c480ed
 }
c480ed
 
c480ed
 
c480ed
@@ -499,9 +499,9 @@ virCgroupV1GetAnyController(virCgroupPtr group)
c480ed
          * of '/' to avoid doing bad stuff to the root
c480ed
          * cgroup
c480ed
          */
c480ed
-        if (group->controllers[i].mountPoint &&
c480ed
-            group->controllers[i].placement &&
c480ed
-            STRNEQ(group->controllers[i].placement, "/")) {
c480ed
+        if (group->legacy[i].mountPoint &&
c480ed
+            group->legacy[i].placement &&
c480ed
+            STRNEQ(group->legacy[i].placement, "/")) {
c480ed
             return i;
c480ed
         }
c480ed
     }
c480ed
@@ -516,14 +516,14 @@ virCgroupV1PathOfController(virCgroupPtr group,
c480ed
                             const char *key,
c480ed
                             char **path)
c480ed
 {
c480ed
-    if (group->controllers[controller].mountPoint == NULL) {
c480ed
+    if (group->legacy[controller].mountPoint == NULL) {
c480ed
         virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                        _("v1 controller '%s' is not mounted"),
c480ed
                        virCgroupV1ControllerTypeToString(controller));
c480ed
         return -1;
c480ed
     }
c480ed
 
c480ed
-    if (group->controllers[controller].placement == NULL) {
c480ed
+    if (group->legacy[controller].placement == NULL) {
c480ed
         virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                        _("v1 controller '%s' is not enabled for group"),
c480ed
                        virCgroupV1ControllerTypeToString(controller));
c480ed
@@ -531,8 +531,8 @@ virCgroupV1PathOfController(virCgroupPtr group,
c480ed
     }
c480ed
 
c480ed
     if (virAsprintf(path, "%s%s/%s",
c480ed
-                    group->controllers[controller].mountPoint,
c480ed
-                    group->controllers[controller].placement,
c480ed
+                    group->legacy[controller].mountPoint,
c480ed
+                    group->legacy[controller].placement,
c480ed
                     key ? key : "") < 0)
c480ed
         return -1;
c480ed
 
c480ed
@@ -618,7 +618,7 @@ virCgroupV1MakeGroup(virCgroupPtr parent,
c480ed
         }
c480ed
 
c480ed
         /* Skip over controllers that aren't mounted */
c480ed
-        if (!group->controllers[i].mountPoint) {
c480ed
+        if (!group->legacy[i].mountPoint) {
c480ed
             VIR_DEBUG("Skipping unmounted controller %s",
c480ed
                       virCgroupV1ControllerTypeToString(i));
c480ed
             continue;
c480ed
@@ -639,7 +639,7 @@ virCgroupV1MakeGroup(virCgroupPtr parent,
c480ed
                  * treat blkio as unmounted if mkdir fails. */
c480ed
                 if (i == VIR_CGROUP_CONTROLLER_BLKIO) {
c480ed
                     VIR_DEBUG("Ignoring mkdir failure with blkio controller. Kernel probably too old");
c480ed
-                    VIR_FREE(group->controllers[i].mountPoint);
c480ed
+                    VIR_FREE(group->legacy[i].mountPoint);
c480ed
                     continue;
c480ed
                 } else {
c480ed
                     virReportSystemError(errno,
c480ed
@@ -649,7 +649,7 @@ virCgroupV1MakeGroup(virCgroupPtr parent,
c480ed
                 }
c480ed
             }
c480ed
             if (i == VIR_CGROUP_CONTROLLER_CPUSET &&
c480ed
-                group->controllers[i].mountPoint != NULL &&
c480ed
+                group->legacy[i].mountPoint != NULL &&
c480ed
                 virCgroupV1CpuSetInherit(parent, group) < 0) {
c480ed
                 return -1;
c480ed
             }
c480ed
@@ -659,7 +659,7 @@ virCgroupV1MakeGroup(virCgroupPtr parent,
c480ed
              */
c480ed
             if ((flags & VIR_CGROUP_MEM_HIERACHY) &&
c480ed
                 i == VIR_CGROUP_CONTROLLER_MEMORY &&
c480ed
-                group->controllers[i].mountPoint != NULL &&
c480ed
+                group->legacy[i].mountPoint != NULL &&
c480ed
                 virCgroupV1SetMemoryUseHierarchy(group) < 0) {
c480ed
                 return -1;
c480ed
             }
c480ed
@@ -682,7 +682,7 @@ virCgroupV1Remove(virCgroupPtr group)
c480ed
         VIR_AUTOFREE(char *) grppath = NULL;
c480ed
 
c480ed
         /* Skip over controllers not mounted */
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
         /* We must never rmdir() in systemd's hierarchy */
c480ed
@@ -691,7 +691,7 @@ virCgroupV1Remove(virCgroupPtr group)
c480ed
 
c480ed
         /* Don't delete the root group, if we accidentally
c480ed
            ended up in it for some reason */
c480ed
-        if (STREQ(group->controllers[i].placement, "/"))
c480ed
+        if (STREQ(group->legacy[i].placement, "/"))
c480ed
             continue;
c480ed
 
c480ed
         if (virCgroupV1PathOfController(group,
c480ed
@@ -719,7 +719,7 @@ virCgroupV1AddTask(virCgroupPtr group,
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
         /* Skip over controllers not mounted */
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
         /* We must never add tasks in systemd's hierarchy
c480ed
@@ -766,17 +766,17 @@ virCgroupV1IdentifyRoot(virCgroupPtr group)
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
         char *tmp;
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
-        if (!(tmp = strrchr(group->controllers[i].mountPoint, '/'))) {
c480ed
+        if (!(tmp = strrchr(group->legacy[i].mountPoint, '/'))) {
c480ed
             virReportError(VIR_ERR_INTERNAL_ERROR,
c480ed
                            _("Could not find directory separator in %s"),
c480ed
-                           group->controllers[i].mountPoint);
c480ed
+                           group->legacy[i].mountPoint);
c480ed
             return NULL;
c480ed
         }
c480ed
 
c480ed
-        if (VIR_STRNDUP(ret, group->controllers[i].mountPoint,
c480ed
-                        tmp - group->controllers[i].mountPoint) < 0)
c480ed
+        if (VIR_STRNDUP(ret, group->legacy[i].mountPoint,
c480ed
+                        tmp - group->legacy[i].mountPoint) < 0)
c480ed
             return NULL;
c480ed
         return ret;
c480ed
     }
c480ed
@@ -820,44 +820,44 @@ virCgroupV1BindMount(virCgroupPtr group,
c480ed
     }
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
-        if (!group->controllers[i].mountPoint)
c480ed
+        if (!group->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
-        if (!virFileExists(group->controllers[i].mountPoint)) {
c480ed
+        if (!virFileExists(group->legacy[i].mountPoint)) {
c480ed
             VIR_AUTOFREE(char *) src = NULL;
c480ed
             if (virAsprintf(&src, "%s%s",
c480ed
                             oldroot,
c480ed
-                            group->controllers[i].mountPoint) < 0)
c480ed
+                            group->legacy[i].mountPoint) < 0)
c480ed
                 return -1;
c480ed
 
c480ed
             VIR_DEBUG("Create mount point '%s'",
c480ed
-                      group->controllers[i].mountPoint);
c480ed
-            if (virFileMakePath(group->controllers[i].mountPoint) < 0) {
c480ed
+                      group->legacy[i].mountPoint);
c480ed
+            if (virFileMakePath(group->legacy[i].mountPoint) < 0) {
c480ed
                 virReportSystemError(errno,
c480ed
                                      _("Unable to create directory %s"),
c480ed
-                                     group->controllers[i].mountPoint);
c480ed
+                                     group->legacy[i].mountPoint);
c480ed
                 return -1;
c480ed
             }
c480ed
 
c480ed
-            if (mount(src, group->controllers[i].mountPoint, "none", MS_BIND,
c480ed
+            if (mount(src, group->legacy[i].mountPoint, "none", MS_BIND,
c480ed
                       NULL) < 0) {
c480ed
                 virReportSystemError(errno,
c480ed
                                      _("Failed to bind cgroup '%s' on '%s'"),
c480ed
-                                     src, group->controllers[i].mountPoint);
c480ed
+                                     src, group->legacy[i].mountPoint);
c480ed
                 return -1;
c480ed
             }
c480ed
         }
c480ed
 
c480ed
-        if (group->controllers[i].linkPoint) {
c480ed
+        if (group->legacy[i].linkPoint) {
c480ed
             VIR_DEBUG("Link mount point '%s' to '%s'",
c480ed
-                      group->controllers[i].mountPoint,
c480ed
-                      group->controllers[i].linkPoint);
c480ed
-            if (symlink(group->controllers[i].mountPoint,
c480ed
-                        group->controllers[i].linkPoint) < 0) {
c480ed
+                      group->legacy[i].mountPoint,
c480ed
+                      group->legacy[i].linkPoint);
c480ed
+            if (symlink(group->legacy[i].mountPoint,
c480ed
+                        group->legacy[i].linkPoint) < 0) {
c480ed
                 virReportSystemError(errno,
c480ed
                                      _("Unable to symlink directory %s to %s"),
c480ed
-                                     group->controllers[i].mountPoint,
c480ed
-                                     group->controllers[i].linkPoint);
c480ed
+                                     group->legacy[i].mountPoint,
c480ed
+                                     group->legacy[i].linkPoint);
c480ed
                 return -1;
c480ed
             }
c480ed
         }
c480ed
@@ -885,11 +885,11 @@ virCgroupV1SetOwner(virCgroupPtr cgroup,
c480ed
         if (!((1 << i) & controllers))
c480ed
             continue;
c480ed
 
c480ed
-        if (!cgroup->controllers[i].mountPoint)
c480ed
+        if (!cgroup->legacy[i].mountPoint)
c480ed
             continue;
c480ed
 
c480ed
-        if (virAsprintf(&base, "%s%s", cgroup->controllers[i].mountPoint,
c480ed
-                        cgroup->controllers[i].placement) < 0)
c480ed
+        if (virAsprintf(&base, "%s%s", cgroup->legacy[i].mountPoint,
c480ed
+                        cgroup->legacy[i].placement) < 0)
c480ed
             goto cleanup;
c480ed
 
c480ed
         if (virDirOpen(&dh, base) < 0)
c480ed
diff --git a/tests/vircgrouptest.c b/tests/vircgrouptest.c
c480ed
index 588a6e824d..c4bf987ca1 100644
c480ed
--- a/tests/vircgrouptest.c
c480ed
+++ b/tests/vircgrouptest.c
c480ed
@@ -56,25 +56,25 @@ static int validateCgroup(virCgroupPtr cgroup,
c480ed
 
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
         if (STRNEQ_NULLABLE(expectMountPoint[i],
c480ed
-                            cgroup->controllers[i].mountPoint)) {
c480ed
+                            cgroup->legacy[i].mountPoint)) {
c480ed
             fprintf(stderr, "Wrong mount '%s', expected '%s' for '%s'\n",
c480ed
-                    cgroup->controllers[i].mountPoint,
c480ed
+                    cgroup->legacy[i].mountPoint,
c480ed
                     expectMountPoint[i],
c480ed
                     virCgroupControllerTypeToString(i));
c480ed
             return -1;
c480ed
         }
c480ed
         if (STRNEQ_NULLABLE(expectLinkPoint[i],
c480ed
-                            cgroup->controllers[i].linkPoint)) {
c480ed
+                            cgroup->legacy[i].linkPoint)) {
c480ed
             fprintf(stderr, "Wrong link '%s', expected '%s' for '%s'\n",
c480ed
-                    cgroup->controllers[i].linkPoint,
c480ed
+                    cgroup->legacy[i].linkPoint,
c480ed
                     expectLinkPoint[i],
c480ed
                     virCgroupControllerTypeToString(i));
c480ed
             return -1;
c480ed
         }
c480ed
         if (STRNEQ_NULLABLE(expectPlacement[i],
c480ed
-                            cgroup->controllers[i].placement)) {
c480ed
+                            cgroup->legacy[i].placement)) {
c480ed
             fprintf(stderr, "Wrong placement '%s', expected '%s' for '%s'\n",
c480ed
-                    cgroup->controllers[i].placement,
c480ed
+                    cgroup->legacy[i].placement,
c480ed
                     expectPlacement[i],
c480ed
                     virCgroupControllerTypeToString(i));
c480ed
             return -1;
c480ed
@@ -174,7 +174,7 @@ testCgroupDetectMounts(const void *args)
c480ed
     for (i = 0; i < VIR_CGROUP_CONTROLLER_LAST; i++) {
c480ed
         virBufferAsprintf(&buf, "%-12s %s\n",
c480ed
                           virCgroupControllerTypeToString(i),
c480ed
-                          NULLSTR(group->controllers[i].mountPoint));
c480ed
+                          NULLSTR(group->legacy[i].mountPoint));
c480ed
     }
c480ed
     if (virBufferCheckError(&buf) < 0)
c480ed
         goto cleanup;
c480ed
-- 
c480ed
2.22.0
c480ed