From bb221ad14f7d796860650c17a33ac8031953b47e Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Mon, 10 Sep 2018 15:47:59 +0200 Subject: [PATCH] cgroups: s/base_cgroup/container_base_path/g Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 18 +++++++++--------- src/lxc/cgroups/cgroup.c | 2 +- src/lxc/cgroups/cgroup.h | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index ddecceaa5..835a881c1 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -573,7 +573,7 @@ static bool cg_legacy_handle_cpuset_hierarchy(struct hierarchy *h, char *cgname) if (slash) *slash = '\0'; - cgpath = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL); + cgpath = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL); if (slash) *slash = '/'; @@ -810,7 +810,7 @@ static char **cg_unified_get_controllers(const char *file) } static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char *mountpoint, - char *base_cgroup, int type) + char *container_base_path, int type) { struct hierarchy *new; int newentry; @@ -818,7 +818,7 @@ static struct hierarchy *add_hierarchy(struct hierarchy ***h, char **clist, char new = must_alloc(sizeof(*new)); new->controllers = clist; new->mountpoint = mountpoint; - new->base_cgroup = base_cgroup; + new->container_base_path = container_base_path; new->container_full_path = NULL; new->version = type; @@ -1015,7 +1015,7 @@ static void lxc_cgfsng_print_hierarchies(struct cgroup_ops *ops) int j; char **cit; - TRACE(" %d: base_cgroup: %s", i, (*it)->base_cgroup ? (*it)->base_cgroup : "(null)"); + TRACE(" %d: base_cgroup: %s", i, (*it)->container_base_path ? (*it)->container_base_path : "(null)"); TRACE(" mountpoint: %s", (*it)->mountpoint ? (*it)->mountpoint : "(null)"); TRACE(" controllers:"); for (j = 0, cit = (*it)->controllers; cit && *cit; cit++, j++) @@ -1167,7 +1167,7 @@ static bool cg_unified_create_cgroup(struct hierarchy *h, char *cgname) if (parts_len > 0) parts_len--; - cgroup = must_make_path(h->mountpoint, h->base_cgroup, NULL); + cgroup = must_make_path(h->mountpoint, h->container_base_path, NULL); for (i = 0; i < parts_len; i++) { int ret; char *target; @@ -1196,7 +1196,7 @@ static bool create_path_for_hierarchy(struct hierarchy *h, char *cgname) { int ret; - h->container_full_path = must_make_path(h->mountpoint, h->base_cgroup, cgname, NULL); + h->container_full_path = must_make_path(h->mountpoint, h->container_base_path, cgname, NULL); if (dir_exists(h->container_full_path)) { ERROR("The cgroup \"%s\" already existed", h->container_full_path); return false; @@ -1498,7 +1498,7 @@ static int cg_legacy_mount_controllers(int type, struct hierarchy *h, INFO("Remounted %s read-only", controllerpath); } - sourcepath = must_make_path(h->mountpoint, h->base_cgroup, + sourcepath = must_make_path(h->mountpoint, h->container_base_path, container_cgroup, NULL); if (type == LXC_AUTO_CGROUP_RO) flags |= MS_RDONLY; @@ -1669,7 +1669,7 @@ __cgfsng_ops__ static bool cgfsng_mount(struct cgroup_ops *ops, continue; } - path2 = must_make_path(controllerpath, h->base_cgroup, + path2 = must_make_path(controllerpath, h->container_base_path, ops->container_cgroup, NULL); ret = mkdir_p(path2, 0755); if (ret < 0) { @@ -1762,7 +1762,7 @@ __cgfsng_ops__ static bool cgfsng_escape(const struct cgroup_ops *ops, char *fullpath; fullpath = must_make_path(ops->hierarchies[i]->mountpoint, - ops->hierarchies[i]->base_cgroup, + ops->hierarchies[i]->container_base_path, "cgroup.procs", NULL); ret = lxc_write_to_file(fullpath, "0", 2, false, 0666); if (ret != 0) { diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c index 5c6523bc9..517bb4b3c 100644 --- a/src/lxc/cgroups/cgroup.c +++ b/src/lxc/cgroups/cgroup.c @@ -85,7 +85,7 @@ void cgroup_exit(struct cgroup_ops *ops) free((*it)->controllers); free((*it)->mountpoint); - free((*it)->base_cgroup); + free((*it)->container_base_path); free((*it)->container_full_path); free(*it); } diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index 4c1e94c23..9aba1842b 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -57,7 +57,7 @@ typedef enum { * depending on whether this is a hybrid cgroup layout (mix of legacy and * unified hierarchies) or a pure unified cgroup layout. * - * @base_cgroup + * @container_base_path * - The cgroup under which the container cgroup path * is created. This will be either the caller's cgroup (if not root), or * init's cgroup (if root). @@ -76,7 +76,7 @@ typedef enum { struct hierarchy { char **controllers; char *mountpoint; - char *base_cgroup; + char *container_base_path; char *container_full_path; int version; }; -- 2.47.2