From bfe2971ae41d2ed3694a7661e819251751b41064 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Tue, 2 Feb 2021 21:56:32 +0100 Subject: [PATCH] cgroups: remove unused conf argument Signed-off-by: Christian Brauner --- src/lxc/cgroups/cgfsng.c | 13 ++++++------- src/lxc/cgroups/cgroup.h | 16 ++++++---------- src/lxc/lxccontainer.c | 8 ++++---- 3 files changed, 16 insertions(+), 21 deletions(-) diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 78802ac76..638e2f3c1 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -3496,14 +3496,13 @@ struct cgroup_ops *cgfsng_ops_init(struct lxc_conf *conf) } /* Connects to command socket therefore isn't callable from command handler. */ -int cgroup_get(struct lxc_conf *conf, - const char *name, const char *lxcpath, +int cgroup_get(const char *name, const char *lxcpath, const char *filename, char *buf, size_t len) { __do_close int unified_fd = -EBADF; ssize_t ret; - if (!conf || is_empty_string(filename) || is_empty_string(name) || + if (is_empty_string(filename) || is_empty_string(name) || is_empty_string(lxcpath)) return ret_errno(EINVAL); @@ -3522,13 +3521,13 @@ int cgroup_get(struct lxc_conf *conf, } /* Connects to command socket therefore isn't callable from command handler. */ -int cgroup_set(struct lxc_conf *conf, const char *name, const char *lxcpath, +int cgroup_set(const char *name, const char *lxcpath, const char *filename, const char *value) { __do_close int unified_fd = -EBADF; ssize_t ret; - if (!conf || is_empty_string(filename) || is_empty_string(value) || + if (is_empty_string(filename) || is_empty_string(value) || is_empty_string(name) || is_empty_string(lxcpath)) return ret_errno(EINVAL); @@ -3593,7 +3592,7 @@ static int __cgroup_freeze(int unified_fd, return log_trace(0, "Container now %s", (state_num == 1) ? "frozen" : "unfrozen"); } -bool cgroup_freeze(struct lxc_conf *conf, const char *name, const char *lxcpath, int timeout) +bool cgroup_freeze(const char *name, const char *lxcpath, int timeout) { __do_close int unified_fd = -EBADF; int ret; @@ -3610,7 +3609,7 @@ bool cgroup_freeze(struct lxc_conf *conf, const char *name, const char *lxcpath, return ret == 0; } -bool cgroup_unfreeze(struct lxc_conf *conf, const char *name, const char *lxcpath, int timeout) +bool cgroup_unfreeze(const char *name, const char *lxcpath, int timeout) { __do_close int unified_fd = -EBADF; int ret; diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index 4566f5217..ac702aeb9 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -191,16 +191,12 @@ __hidden extern void prune_init_scope(char *cg); __hidden extern int cgroup_attach(const struct lxc_conf *conf, const char *name, const char *lxcpath, pid_t pid); -__hidden extern int cgroup_get(struct lxc_conf *conf, const char *name, - const char *lxcpath, const char *filename, - char *buf, size_t len); -__hidden extern int cgroup_set(struct lxc_conf *conf, const char *name, - const char *lxcpath, const char *filename, - const char *value); -__hidden extern bool cgroup_freeze(struct lxc_conf *conf, const char *name, - const char *lxcpath, int timeout); -__hidden extern bool cgroup_unfreeze(struct lxc_conf *conf, const char *name, - const char *lxcpath, int timeout); +__hidden extern int cgroup_get(const char *name, const char *lxcpath, + const char *filename, char *buf, size_t len); +__hidden extern int cgroup_set(const char *name, const char *lxcpath, + const char *filename, const char *value); +__hidden extern bool cgroup_freeze(const char *name, const char *lxcpath, int timeout); +__hidden extern bool cgroup_unfreeze(const char *name, const char *lxcpath, int timeout); static inline bool pure_unified_layout(const struct cgroup_ops *ops) { diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index c309319d6..6879a1765 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -515,7 +515,7 @@ static bool do_lxcapi_freeze(struct lxc_container *c) s = lxc_getstate(c->name, c->config_path); if (s != FROZEN) { - bret = cgroup_freeze(c->lxc_conf, c->name, c->config_path, -1); + bret = cgroup_freeze(c->name, c->config_path, -1); if (!bret && errno == ENOCGROUP2) bret = lxc_freeze(c->lxc_conf, c->name, c->config_path); } @@ -535,7 +535,7 @@ static bool do_lxcapi_unfreeze(struct lxc_container *c) s = lxc_getstate(c->name, c->config_path); if (s == FROZEN) { - bret = cgroup_unfreeze(c->lxc_conf, c->name, c->config_path, -1); + bret = cgroup_unfreeze(c->name, c->config_path, -1); if (!bret && errno == ENOCGROUP2) bret = lxc_unfreeze(c->lxc_conf, c->name, c->config_path); } @@ -3294,7 +3294,7 @@ static bool do_lxcapi_set_cgroup_item(struct lxc_container *c, const char *subsy if (is_stopped(c)) return false; - ret = cgroup_set(c->lxc_conf, c->name, c->config_path, subsys, value); + ret = cgroup_set(c->name, c->config_path, subsys, value); if (ret == ENOCGROUP2) { cgroup_ops = cgroup_init(c->lxc_conf); if (!cgroup_ops) @@ -3319,7 +3319,7 @@ static int do_lxcapi_get_cgroup_item(struct lxc_container *c, const char *subsys if (is_stopped(c)) return -1; - ret = cgroup_get(c->lxc_conf, c->name, c->config_path, subsys, retv, inlen); + ret = cgroup_get(c->name, c->config_path, subsys, retv, inlen); if (ret == ENOCGROUP2) { cgroup_ops = cgroup_init(c->lxc_conf); if (!cgroup_ops) -- 2.47.2