From: Christian Brauner Date: Sun, 21 Feb 2021 10:14:53 +0000 (+0100) Subject: cgroups: s/cgfd_con/dfd_con/g X-Git-Tag: lxc-5.0.0~274^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e33870e511c679130e742ad58d8674f27867f067;p=thirdparty%2Flxc.git cgroups: s/cgfd_con/dfd_con/g Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index c7ad6f389..efa7afbf3 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -401,7 +401,7 @@ static int cgroup_hierarchy_add(struct cgroup_ops *ops, int dfd_mnt, char *mnt, if (!new) return ret_errno(ENOMEM); - new->cgfd_con = -EBADF; + new->dfd_con = -EBADF; new->cgfd_limit = -EBADF; new->cgfd_mon = -EBADF; @@ -801,11 +801,11 @@ static bool cgroup_tree_create(struct cgroup_ops *ops, struct lxc_conf *conf, return syserrno(false, "Failed to create %s cgroup %d(%s)", payload ? "payload" : "monitor", h->dfd_base, cgroup_limit_dir); if (payload) { - h->cgfd_con = move_fd(fd_final); + h->dfd_con = move_fd(fd_final); h->container_full_path = move_ptr(path); if (fd_limit < 0) - h->cgfd_limit = h->cgfd_con; + h->cgfd_limit = h->dfd_con; else h->cgfd_limit = move_fd(fd_limit); @@ -831,7 +831,7 @@ static void cgroup_tree_prune_leaf(struct hierarchy *h, const char *path_prune, prune = false; free_equal(h->container_full_path, h->container_limit_path); - close_equal(h->cgfd_con, h->cgfd_limit); + close_equal(h->dfd_con, h->cgfd_limit); } else { /* Check whether we actually created the cgroup to prune. */ if (h->cgfd_mon < 0) @@ -1242,11 +1242,11 @@ __cgfsng_ops static bool cgfsng_payload_enter(struct cgroup_ops *ops, (handler->clone_flags & CLONE_INTO_CGROUP)) continue; - ret = lxc_writeat(h->cgfd_con, "cgroup.procs", pidstr, len); + ret = lxc_writeat(h->dfd_con, "cgroup.procs", pidstr, len); if (ret != 0) return log_error_errno(false, errno, "Failed to enter cgroup \"%s\"", h->container_full_path); - TRACE("Moved container into %s cgroup via %d", h->container_full_path, h->cgfd_con); + TRACE("Moved container into %s cgroup via %d", h->container_full_path, h->dfd_con); } return true; @@ -1306,7 +1306,7 @@ static int chown_cgroup_wrapper(void *data) destuid = 0; for (int i = 0; arg->hierarchies[i]; i++) { - int dirfd = arg->hierarchies[i]->cgfd_con; + int dirfd = arg->hierarchies[i]->dfd_con; (void)fchowmodat(dirfd, "", destuid, nsgid, 0775); @@ -1381,7 +1381,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops) * lot of them. */ if (!is_unified_hierarchy(h)) - close_prot_errno_disarm(h->cgfd_con); + close_prot_errno_disarm(h->dfd_con); } /* @@ -1399,7 +1399,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops) * for our container which means we check here. */ if (pure_unified_layout(ops) && - !faccessat(ops->unified->cgfd_con, "cgroup.freeze", F_OK, + !faccessat(ops->unified->dfd_con, "cgroup.freeze", F_OK, AT_SYMLINK_NOFOLLOW)) { TRACE("Unified hierarchy supports freezer"); ops->unified->freezer_controller = 1; diff --git a/src/lxc/cgroups/cgroup.c b/src/lxc/cgroups/cgroup.c index 957f7667f..d523b5845 100644 --- a/src/lxc/cgroups/cgroup.c +++ b/src/lxc/cgroups/cgroup.c @@ -91,7 +91,7 @@ void cgroup_exit(struct cgroup_ops *ops) free_equal((*it)->container_full_path, (*it)->container_limit_path); - close_equal((*it)->cgfd_con, (*it)->cgfd_limit); + close_equal((*it)->dfd_con, (*it)->cgfd_limit); if ((*it)->cgfd_mon >= 0) close((*it)->cgfd_mon); diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index ace48edb7..3ad83e003 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -92,12 +92,12 @@ struct hierarchy { unsigned int freezer_controller:1; /* File descriptor for the container's cgroup @container_full_path. */ - int cgfd_con; + int dfd_con; /* * File descriptor for the container's limiting cgroup * @container_limit_path. - * Will be equal to @cgfd_con if no limiting cgroup has been requested. + * Will be equal to @dfd_con if no limiting cgroup has been requested. */ int cgfd_limit; @@ -233,7 +233,7 @@ static inline int cgroup_unified_fd(const struct cgroup_ops *ops) if (!ops->unified) return -EBADF; - return ops->unified->cgfd_con; + return ops->unified->dfd_con; } #define make_cgroup_path(__hierarchy, __first, ...) \ diff --git a/src/lxc/commands.c b/src/lxc/commands.c index 5ff185380..5de8c5468 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -1519,7 +1519,7 @@ static int lxc_cmd_get_cgroup2_fd_callback_do(int fd, struct lxc_cmd_req *req, return lxc_cmd_rsp_send(fd, &rsp); send_fd = limiting_cgroup ? ops->unified->cgfd_limit - : ops->unified->cgfd_con; + : ops->unified->dfd_con; rsp.ret = 0; ret = lxc_abstract_unix_send_fds(fd, &send_fd, 1, &rsp, sizeof(rsp));