]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
cgroups: s/cgfd_con/dfd_con/g
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 21 Feb 2021 10:14:53 +0000 (11:14 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 21 Feb 2021 10:25:41 +0000 (11:25 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/cgroups/cgfsng.c
src/lxc/cgroups/cgroup.c
src/lxc/cgroups/cgroup.h
src/lxc/commands.c

index c7ad6f3894b06ac072e0015a83287aeb117889e1..efa7afbf3359af9885e8ed8d7b2f5a66fa2772f4 100644 (file)
@@ -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;
index 957f7667f93c9a40996eb39da5651bb161229f59..d523b584574beb8f05b1e3ca78a7b85e9eba0105 100644 (file)
@@ -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);
index ace48edb7de6768899197bc5705215189294d1ff..3ad83e00339eba2914952a252d2f69ca85bd5c5c 100644 (file)
@@ -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, ...)                    \
index 5ff185380d410501aed965903f67cc1202f43623..5de8c5468db35822d3b1fcda23f84eb33c2019a9 100644 (file)
@@ -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));