From: Christian Brauner Date: Fri, 19 Feb 2021 10:24:49 +0000 (+0100) Subject: conf: expose lxc_clear_cgroup2_devices() X-Git-Tag: lxc-5.0.0~275^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7744f125e65de7a5f70511049b89ecd844bd5e1;p=thirdparty%2Flxc.git conf: expose lxc_clear_cgroup2_devices() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 899d28543..22b66267f 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -3710,17 +3710,9 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key, int version) return 0; } -static void lxc_clear_devices(struct lxc_conf *conf) +static inline void lxc_clear_cgroups_devices(struct lxc_conf *conf) { - struct lxc_list *list = &(conf->bpf_devices).device_item; - struct lxc_list *it, *next; - - lxc_list_for_each_safe(it, list, next) { - lxc_list_del(it); - free(it); - } - - lxc_list_init(&(conf->bpf_devices).device_item); + lxc_clear_cgroup2_devices(&conf->bpf_devices); } int lxc_clear_limits(struct lxc_conf *c, const char *key) @@ -3960,7 +3952,7 @@ void lxc_conf_free(struct lxc_conf *conf) lxc_clear_config_keepcaps(conf); lxc_clear_cgroups(conf, "lxc.cgroup", CGROUP_SUPER_MAGIC); lxc_clear_cgroups(conf, "lxc.cgroup2", CGROUP2_SUPER_MAGIC); - lxc_clear_devices(conf); + lxc_clear_cgroups_devices(conf); lxc_clear_hooks(conf, "lxc.hook"); lxc_clear_mount_entries(conf); lxc_clear_idmaps(conf); diff --git a/src/lxc/conf.h b/src/lxc/conf.h index ceae29fea..602634414 100644 --- a/src/lxc/conf.h +++ b/src/lxc/conf.h @@ -570,4 +570,17 @@ static inline void put_lxc_rootfs(struct lxc_rootfs *rootfs, bool unpin) } } +static inline void lxc_clear_cgroup2_devices(struct bpf_devices *bpf_devices) +{ + struct lxc_list *list = &bpf_devices->device_item; + struct lxc_list *it, *next; + + lxc_list_for_each_safe (it, list, next) { + lxc_list_del(it); + free(it); + } + + lxc_list_init(&bpf_devices->device_item); +} + #endif /* __LXC_CONF_H */