cgroups: better helper naming

parent c468e4d4
......@@ -945,7 +945,7 @@ static void lxc_cgfsng_print_basecg_debuginfo(char *basecginfo, char **klist,
TRACE("named subsystem %d: %s", k, *it);
}
static int cgroup_rmdir(struct hierarchy **hierarchies,
static int cgroup_tree_remove(struct hierarchy **hierarchies,
const char *container_cgroup)
{
if (!container_cgroup || !hierarchies)
......@@ -976,7 +976,7 @@ struct generic_userns_exec_data {
char *path;
};
static int cgroup_rmdir_wrapper(void *data)
static int cgroup_tree_remove_wrapper(void *data)
{
struct generic_userns_exec_data *arg = data;
uid_t nsuid = (arg->conf->root_nsuid_map != NULL) ? 0 : arg->conf->init_uid;
......@@ -996,7 +996,7 @@ static int cgroup_rmdir_wrapper(void *data)
return log_error_errno(-1, errno, "Failed to setresuid(%d, %d, %d)",
(int)nsuid, (int)nsuid, (int)nsuid);
return cgroup_rmdir(arg->hierarchies, arg->container_cgroup);
return cgroup_tree_remove(arg->hierarchies, arg->container_cgroup);
}
__cgfsng_ops static void cgfsng_payload_destroy(struct cgroup_ops *ops,
......@@ -1035,10 +1035,10 @@ __cgfsng_ops static void cgfsng_payload_destroy(struct cgroup_ops *ops,
.hierarchies = ops->hierarchies,
.origuid = 0,
};
ret = userns_exec_1(handler->conf, cgroup_rmdir_wrapper, &wrap,
"cgroup_rmdir_wrapper");
ret = userns_exec_1(handler->conf, cgroup_tree_remove_wrapper,
&wrap, "cgroup_tree_remove_wrapper");
} else {
ret = cgroup_rmdir(ops->hierarchies, ops->container_cgroup);
ret = cgroup_tree_remove(ops->hierarchies, ops->container_cgroup);
}
if (ret < 0)
SYSWARN("Failed to destroy cgroups");
......@@ -1145,7 +1145,7 @@ static int mkdir_eexist_on_last(const char *dir, mode_t mode)
return 0;
}
static bool create_cgroup_tree(struct hierarchy *h, const char *cgroup_tree,
static bool cgroup_tree_create(struct hierarchy *h, const char *cgroup_tree,
const char *cgroup_leaf, bool payload)
{
__do_free char *path = NULL;
......@@ -1185,7 +1185,7 @@ static bool create_cgroup_tree(struct hierarchy *h, const char *cgroup_tree,
return true;
}
static void cgroup_remove_leaf(struct hierarchy *h, bool payload)
static void cgroup_tree_leaf_remove(struct hierarchy *h, bool payload)
{
__do_free char *full_path = NULL;
......@@ -1257,12 +1257,12 @@ __cgfsng_ops static inline bool cgfsng_monitor_create(struct cgroup_ops *ops,
sprintf(suffix, "-%d", idx);
for (i = 0; ops->hierarchies[i]; i++) {
if (create_cgroup_tree(ops->hierarchies[i], cgroup_tree, monitor_cgroup, false))
if (cgroup_tree_create(ops->hierarchies[i], cgroup_tree, monitor_cgroup, false))
continue;
ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->monitor_full_path ?: "(null)");
for (int j = 0; j < i; j++)
cgroup_remove_leaf(ops->hierarchies[j], false);
cgroup_tree_leaf_remove(ops->hierarchies[j], false);
idx++;
break;
......@@ -1336,12 +1336,12 @@ __cgfsng_ops static inline bool cgfsng_payload_create(struct cgroup_ops *ops,
sprintf(suffix, "-%d", idx);
for (i = 0; ops->hierarchies[i]; i++) {
if (create_cgroup_tree(ops->hierarchies[i], cgroup_tree, container_cgroup, true))
if (cgroup_tree_create(ops->hierarchies[i], cgroup_tree, container_cgroup, true))
continue;
ERROR("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)");
for (int j = 0; j < i; j++)
cgroup_remove_leaf(ops->hierarchies[j], true);
cgroup_tree_leaf_remove(ops->hierarchies[j], true);
idx++;
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment