Skip to content

Commit

Permalink
cgroups: s/cgfd_con/dfd_con/g
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Feb 26, 2021
1 parent 9e1d2b7 commit 946d7ee
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
18 changes: 9 additions & 9 deletions src/lxc/cgroups/cgfsng.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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);

Expand All @@ -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)
Expand Down Expand Up @@ -1240,11 +1240,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;
Expand Down Expand Up @@ -1304,7 +1304,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);

Expand Down Expand Up @@ -1379,7 +1379,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);
}

/*
Expand All @@ -1397,7 +1397,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;
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/cgroups/cgroup.c
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/lxc/cgroups/cgroup.h
Expand Up @@ -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;

Expand Down Expand Up @@ -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, ...) \
Expand Down
2 changes: 1 addition & 1 deletion src/lxc/commands.c
Expand Up @@ -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));
Expand Down

0 comments on commit 946d7ee

Please sign in to comment.