cgroups: s/container_full_path/path_con/g

parent f0c8014d
...@@ -444,7 +444,7 @@ static int cgroup_tree_remove(struct hierarchy **hierarchies, const char *path_p ...@@ -444,7 +444,7 @@ static int cgroup_tree_remove(struct hierarchy **hierarchies, const char *path_p
else else
TRACE("Removed cgroup tree %d(%s)", h->dfd_base, path_prune); TRACE("Removed cgroup tree %d(%s)", h->dfd_base, path_prune);
free_equal(h->container_limit_path, h->container_full_path); free_equal(h->container_limit_path, h->path_con);
} }
return 0; return 0;
...@@ -802,7 +802,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf, ...@@ -802,7 +802,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
if (payload) { if (payload) {
h->dfd_con = move_fd(fd_final); h->dfd_con = move_fd(fd_final);
h->container_full_path = move_ptr(path); h->path_con = move_ptr(path);
if (fd_limit < 0) if (fd_limit < 0)
h->dfd_lim = h->dfd_con; h->dfd_lim = h->dfd_con;
...@@ -812,7 +812,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf, ...@@ -812,7 +812,7 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf,
if (limit_path) if (limit_path)
h->container_limit_path = move_ptr(limit_path); h->container_limit_path = move_ptr(limit_path);
else else
h->container_limit_path = h->container_full_path; h->container_limit_path = h->path_con;
} else { } else {
h->dfd_mon = move_fd(fd_final); h->dfd_mon = move_fd(fd_final);
} }
...@@ -830,7 +830,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune, ...@@ -830,7 +830,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune,
if (h->dfd_lim < 0) if (h->dfd_lim < 0)
prune = false; prune = false;
free_equal(h->container_full_path, h->container_limit_path); free_equal(h->path_con, h->container_limit_path);
close_equal(h->dfd_con, h->dfd_lim); close_equal(h->dfd_con, h->dfd_lim);
} else { } else {
/* Check whether we actually created the cgroup to prune. */ /* Check whether we actually created the cgroup to prune. */
...@@ -1125,7 +1125,7 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx ...@@ -1125,7 +1125,7 @@ __cgfsng_ops static bool cgfsng_payload_create(struct cgroup_ops *ops, struct lx
true)) true))
continue; continue;
DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->container_full_path ?: "(null)"); DEBUG("Failed to create cgroup \"%s\"", ops->hierarchies[i]->path_con ?: "(null)");
for (int j = 0; j <= i; j++) for (int j = 0; j <= i; j++)
cgroup_tree_prune_leaf(ops->hierarchies[j], cgroup_tree_prune_leaf(ops->hierarchies[j],
limit_cgroup, true); limit_cgroup, true);
...@@ -1242,9 +1242,9 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops, ...@@ -1242,9 +1242,9 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops,
ret = lxc_writeat(h->dfd_con, "cgroup.procs", pidstr, len); ret = lxc_writeat(h->dfd_con, "cgroup.procs", pidstr, len);
if (ret != 0) if (ret != 0)
return log_error_errno(false, errno, "Failed to enter cgroup \"%s\"", h->container_full_path); return log_error_errno(false, errno, "Failed to enter cgroup \"%s\"", h->path_con);
TRACE("Moved container into %s cgroup via %d", h->container_full_path, h->dfd_con); TRACE("Moved container into %s cgroup via %d", h->path_con, h->dfd_con);
} }
return true; return true;
...@@ -1896,7 +1896,7 @@ static bool cg_legacy_freeze(struct cgroup_ops *ops) ...@@ -1896,7 +1896,7 @@ static bool cg_legacy_freeze(struct cgroup_ops *ops)
if (!h) if (!h)
return ret_set_errno(-1, ENOENT); return ret_set_errno(-1, ENOENT);
return lxc_write_openat(h->container_full_path, "freezer.state", return lxc_write_openat(h->path_con, "freezer.state",
"FROZEN", STRLITERALLEN("FROZEN")); "FROZEN", STRLITERALLEN("FROZEN"));
} }
...@@ -1943,13 +1943,13 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout, ...@@ -1943,13 +1943,13 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout,
if (!h) if (!h)
return ret_set_errno(-1, ENOENT); return ret_set_errno(-1, ENOENT);
if (!h->container_full_path) if (!h->path_con)
return ret_set_errno(-1, EEXIST); return ret_set_errno(-1, EEXIST);
if (timeout != 0) { if (timeout != 0) {
__do_free char *events_file = NULL; __do_free char *events_file = NULL;
events_file = must_make_path(h->container_full_path, "cgroup.events", NULL); events_file = must_make_path(h->path_con, "cgroup.events", NULL);
fd = open(events_file, O_RDONLY | O_CLOEXEC); fd = open(events_file, O_RDONLY | O_CLOEXEC);
if (fd < 0) if (fd < 0)
return log_error_errno(-1, errno, "Failed to open cgroup.events file"); return log_error_errno(-1, errno, "Failed to open cgroup.events file");
...@@ -1966,7 +1966,7 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout, ...@@ -1966,7 +1966,7 @@ static int cg_unified_freeze_do(struct cgroup_ops *ops, int timeout,
return log_error_errno(-1, errno, "Failed to add cgroup.events fd handler to mainloop"); return log_error_errno(-1, errno, "Failed to add cgroup.events fd handler to mainloop");
} }
ret = lxc_write_openat(h->container_full_path, "cgroup.freeze", state_string, 1); ret = lxc_write_openat(h->path_con, "cgroup.freeze", state_string, 1);
if (ret < 0) if (ret < 0)
return log_error_errno(-1, errno, "Failed to open cgroup.freeze file"); return log_error_errno(-1, errno, "Failed to open cgroup.freeze file");
...@@ -2002,7 +2002,7 @@ static int cg_legacy_unfreeze(struct cgroup_ops *ops) ...@@ -2002,7 +2002,7 @@ static int cg_legacy_unfreeze(struct cgroup_ops *ops)
if (!h) if (!h)
return ret_set_errno(-1, ENOENT); return ret_set_errno(-1, ENOENT);
return lxc_write_openat(h->container_full_path, "freezer.state", return lxc_write_openat(h->path_con, "freezer.state",
"THAWED", STRLITERALLEN("THAWED")); "THAWED", STRLITERALLEN("THAWED"));
} }
...@@ -2039,7 +2039,7 @@ static const char *cgfsng_get_cgroup_do(struct cgroup_ops *ops, ...@@ -2039,7 +2039,7 @@ static const char *cgfsng_get_cgroup_do(struct cgroup_ops *ops,
if (limiting) if (limiting)
path = h->container_limit_path; path = h->container_limit_path;
else else
path = h->container_full_path; path = h->path_con;
if (!path) if (!path)
return NULL; return NULL;
...@@ -2675,7 +2675,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename, ...@@ -2675,7 +2675,7 @@ static int cg_legacy_set_data(struct cgroup_ops *ops, const char *filename,
return log_error_errno(-ENOENT, ENOENT, "Failed to setup limits for the \"%s\" controller. The controller seems to be unused by \"cgfsng\" cgroup driver or not enabled on the cgroup hierarchy", controller); return log_error_errno(-ENOENT, ENOENT, "Failed to setup limits for the \"%s\" controller. The controller seems to be unused by \"cgfsng\" cgroup driver or not enabled on the cgroup hierarchy", controller);
if (is_cpuset) { if (is_cpuset) {
int ret = lxc_write_openat(h->container_full_path, filename, value, strlen(value)); int ret = lxc_write_openat(h->path_con, filename, value, strlen(value));
if (ret) if (ret)
return ret; return ret;
} }
...@@ -2837,7 +2837,7 @@ __cgfsng_ops static bool cgfsng_devices_activate(struct cgroup_ops *ops, struct ...@@ -2837,7 +2837,7 @@ __cgfsng_ops static bool cgfsng_devices_activate(struct cgroup_ops *ops, struct
unified = ops->unified; unified = ops->unified;
if (!unified || !unified->bpf_device_controller || if (!unified || !unified->bpf_device_controller ||
!unified->container_full_path || !unified->path_con ||
lxc_list_empty(&(conf->bpf_devices).device_item)) lxc_list_empty(&(conf->bpf_devices).device_item))
return true; return true;
......
...@@ -88,7 +88,7 @@ void cgroup_exit(struct cgroup_ops *ops) ...@@ -88,7 +88,7 @@ void cgroup_exit(struct cgroup_ops *ops)
free((*it)->at_mnt); free((*it)->at_mnt);
free((*it)->at_base); free((*it)->at_base);
free_equal((*it)->container_full_path, free_equal((*it)->path_con,
(*it)->container_limit_path); (*it)->container_limit_path);
close_equal((*it)->dfd_con, (*it)->dfd_lim); close_equal((*it)->dfd_con, (*it)->dfd_lim);
......
...@@ -61,12 +61,12 @@ typedef enum { ...@@ -61,12 +61,12 @@ typedef enum {
* is created. This will be either the caller's cgroup (if not root), or * is created. This will be either the caller's cgroup (if not root), or
* init's cgroup (if root). * init's cgroup (if root).
* *
* @container_full_path * @path_con
* - The full path to the container's cgroup. * - The full path to the container's cgroup.
* *
* @container_limit_path * @container_limit_path
* - The full path to the container's limiting cgroup. May simply point to * - The full path to the container's limiting cgroup. May simply point to
* container_full_path. * path_con.
* *
* @version * @version
* - legacy hierarchy * - legacy hierarchy
...@@ -83,7 +83,6 @@ struct hierarchy { ...@@ -83,7 +83,6 @@ struct hierarchy {
*/ */
char **cgroup2_chown; char **cgroup2_chown;
char **controllers; char **controllers;
char *container_full_path;
char *container_limit_path; char *container_limit_path;
cgroupfs_type_magic_t fs_type; cgroupfs_type_magic_t fs_type;
...@@ -91,8 +90,9 @@ struct hierarchy { ...@@ -91,8 +90,9 @@ struct hierarchy {
unsigned int bpf_device_controller:1; unsigned int bpf_device_controller:1;
unsigned int freezer_controller:1; unsigned int freezer_controller:1;
/* File descriptor for the container's cgroup @container_full_path. */ /* File descriptor for the container's cgroup @path_con. */
int dfd_con; int dfd_con;
char *path_con;
/* /*
* File descriptor for the container's limiting cgroup * File descriptor for the container's limiting cgroup
......
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