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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent a4e04834
...@@ -3380,8 +3380,7 @@ static int __cgroup_attach_many(const struct lxc_conf *conf, const char *name, ...@@ -3380,8 +3380,7 @@ static int __cgroup_attach_many(const struct lxc_conf *conf, const char *name,
ssize_t pidstr_len; ssize_t pidstr_len;
char pidstr[INTTYPE_TO_STRLEN(pid_t)]; char pidstr[INTTYPE_TO_STRLEN(pid_t)];
ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, NULL, true, ret = lxc_cmd_get_cgroup_ctx(name, lxcpath, sizeof(struct cgroup_ctx), ctx);
sizeof(struct cgroup_ctx), ctx);
if (ret < 0) if (ret < 0)
return ret_errno(ENOSYS); return ret_errno(ENOSYS);
......
...@@ -629,7 +629,6 @@ static int lxc_cmd_get_seccomp_notify_fd_callback(int fd, struct lxc_cmd_req *re ...@@ -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, 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) size_t size_ret_ctx, struct cgroup_ctx *ret_ctx)
{ {
struct lxc_cmd_rr cmd = { struct lxc_cmd_rr cmd = {
...@@ -644,9 +643,6 @@ int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath, ...@@ -644,9 +643,6 @@ int lxc_cmd_get_cgroup_ctx(const char *name, const char *lxcpath,
}; };
int ret, stopped; int ret, stopped;
if (batch && !is_empty_string(controller))
return ret_errno(EINVAL);
ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL); ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
if (ret < 0) if (ret < 0)
return log_debug_errno(-1, errno, "Failed to process cgroup context command"); return log_debug_errno(-1, errno, "Failed to process cgroup context command");
......
...@@ -125,7 +125,6 @@ __hidden extern int lxc_cmd_console_log(const char *name, const char *lxcpath, ...@@ -125,7 +125,6 @@ __hidden extern int lxc_cmd_console_log(const char *name, const char *lxcpath,
struct lxc_console_log *log); 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_seccomp_notify_fd(const char *name, const char *lxcpath);
__hidden extern int lxc_cmd_get_cgroup_ctx(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, size_t size_ret_ctx,
struct cgroup_ctx *ret_ctx); struct cgroup_ctx *ret_ctx);
__hidden extern int lxc_cmd_seccomp_notify_add_listener(const char *name, const char *lxcpath, int fd, __hidden extern int lxc_cmd_seccomp_notify_add_listener(const char *name, const char *lxcpath, int fd,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment