From: Christian Brauner Date: Wed, 24 Feb 2021 08:47:40 +0000 (+0100) Subject: commands: simplify lxc_cmd_get_cgroup_ctx() X-Git-Tag: lxc-5.0.0~269^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bce2970f8071dcd2f0db71a8a94f1243073464db;p=thirdparty%2Flxc.git commands: simplify lxc_cmd_get_cgroup_ctx() Instead of allowing individual hierarchy fd retrieval through lxc_cmd_get_cgroup_ctx() let's add a dedicated method instead. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 59f024290..233367fa7 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -3382,8 +3382,7 @@ static int __cgroup_attach_many(const struct lxc_conf *conf, const char *name, ssize_t pidstr_len; char pidstr[INTTYPE_TO_STRLEN(pid_t)]; - ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, NULL, true, - sizeof(struct cgroup_ctx), ctx); + ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, sizeof(struct cgroup_ctx), ctx); if (ret < 0) return ret_errno(ENOSYS); diff --git a/src/lxc/commands.c b/src/lxc/commands.c index 4f0ea327f..c2ec510c6 100644 --- a/src/lxc/commands.c +++ b/src/lxc/commands.c @@ -629,7 +629,6 @@ static int lxc_cmd_get_seccomp_notify_fd_callback(int fd, struct lxc_cmd_req *re } int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath, - const char *controller, bool batch, size_t size_ret_ctx, struct cgroup_ctx *ret_ctx) { struct lxc_cmd_rr cmd = { @@ -644,9 +643,6 @@ int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath, }; int ret, stopped; - if (batch && !is_empty_string(controller)) - return ret_errno(EINVAL); - ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL); if (ret < 0) return log_debug_errno(-1, errno, "Failed to process cgroup context command"); diff --git a/src/lxc/commands.h b/src/lxc/commands.h index 42e917e5a..83eda38a5 100644 --- a/src/lxc/commands.h +++ b/src/lxc/commands.h @@ -125,7 +125,6 @@ __hidden extern int lxc_cmd_console_log(const char *name, const char *lxcpath, struct lxc_console_log *log); __hidden extern int lxc_cmd_get_seccomp_notify_fd(const char *name, const char *lxcpath); __hidden extern int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath, - const char *controller, bool batch, size_t size_ret_ctx, struct cgroup_ctx *ret_ctx); __hidden extern int lxc_cmd_seccomp_notify_add_listener(const char *name, const char *lxcpath, int fd,