From: Christian Brauner Date: Mon, 15 Feb 2021 10:57:31 +0000 (+0100) Subject: cgroups: pass handler to cgroup mount() method X-Git-Tag: lxc-5.0.0~287^2~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab8cd5d9e2841cb632e64b1680fdef03c9c4e112;p=thirdparty%2Flxc.git cgroups: pass handler to cgroup mount() method Signed-off-by: Christian Brauner --- diff --git a/src/lxc/cgroups/cgfsng.c b/src/lxc/cgroups/cgfsng.c index 691744159..d5883351b 100644 --- a/src/lxc/cgroups/cgfsng.c +++ b/src/lxc/cgroups/cgfsng.c @@ -1867,11 +1867,12 @@ static inline int cg_mount_cgroup_full(int type, struct hierarchy *h, } __cgfsng_ops static bool cgfsng_mount(struct cgroup_ops *ops, - struct lxc_conf *conf, int type) + struct lxc_handler *handler, int type) { __do_close int dfd_mnt_cgroupfs = -EBADF, fd_fs = -EBADF; __do_free char *cgroup_root = NULL; bool has_cgns = false, wants_force_mount = false; + struct lxc_conf *conf = handler->conf; struct lxc_rootfs *rootfs = &conf->rootfs; const char *rootfs_mnt = get_rootfs_mnt(rootfs); int ret; diff --git a/src/lxc/cgroups/cgroup.h b/src/lxc/cgroups/cgroup.h index f8de2b17f..67c52e509 100644 --- a/src/lxc/cgroups/cgroup.h +++ b/src/lxc/cgroups/cgroup.h @@ -172,7 +172,7 @@ struct cgroup_ops { bool (*chown)(struct cgroup_ops *ops, struct lxc_conf *conf); bool (*attach)(struct cgroup_ops *ops, const struct lxc_conf *conf, const char *name, const char *lxcpath, pid_t pid); - bool (*mount)(struct cgroup_ops *ops, struct lxc_conf *conf, int type); + bool (*mount)(struct cgroup_ops *ops, struct lxc_handler *handler, int type); bool (*devices_activate)(struct cgroup_ops *ops, struct lxc_handler *handler); bool (*monitor_delegate_controllers)(struct cgroup_ops *ops); diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 1758252f6..78f3f01b3 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -704,7 +704,7 @@ static int lxc_mount_auto_mounts(struct lxc_handler *handler, int flags) if (flags & LXC_AUTO_CGROUP_FORCE) cg_flags |= LXC_AUTO_CGROUP_FORCE; - if (!handler->cgroup_ops->mount(handler->cgroup_ops, conf, cg_flags)) + if (!handler->cgroup_ops->mount(handler->cgroup_ops, handler, cg_flags)) return log_error_errno(-1, errno, "Failed to mount \"/sys/fs/cgroup\""); }