conf: expose lxc_clear_cgroup2_devices()

parent d6c06927
...@@ -3710,17 +3710,9 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key, int version) ...@@ -3710,17 +3710,9 @@ int lxc_clear_cgroups(struct lxc_conf *c, const char *key, int version)
return 0; 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; lxc_clear_cgroup2_devices(&conf->bpf_devices);
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);
} }
int lxc_clear_limits(struct lxc_conf *c, const char *key) int lxc_clear_limits(struct lxc_conf *c, const char *key)
...@@ -3960,7 +3952,7 @@ void lxc_conf_free(struct lxc_conf *conf) ...@@ -3960,7 +3952,7 @@ void lxc_conf_free(struct lxc_conf *conf)
lxc_clear_config_keepcaps(conf); lxc_clear_config_keepcaps(conf);
lxc_clear_cgroups(conf, "lxc.cgroup", CGROUP_SUPER_MAGIC); lxc_clear_cgroups(conf, "lxc.cgroup", CGROUP_SUPER_MAGIC);
lxc_clear_cgroups(conf, "lxc.cgroup2", CGROUP2_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_hooks(conf, "lxc.hook");
lxc_clear_mount_entries(conf); lxc_clear_mount_entries(conf);
lxc_clear_idmaps(conf); lxc_clear_idmaps(conf);
......
...@@ -570,4 +570,17 @@ static inline void put_lxc_rootfs(struct lxc_rootfs *rootfs, bool unpin) ...@@ -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 */ #endif /* __LXC_CONF_H */
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