]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: expose lxc_clear_cgroup2_devices()
authorChristian Brauner <christian.brauner@ubuntu.com>
Fri, 19 Feb 2021 10:24:49 +0000 (11:24 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Fri, 19 Feb 2021 14:23:26 +0000 (15:23 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c
src/lxc/conf.h

index 899d28543f80efad5cd3702c0f144e7b08161511..22b66267f41209d52eaf7f015eaa2a8e6c03002e 100644 (file)
@@ -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);
index ceae29fea5390e5fbbe9806e98a9b0c5c667737b..6026344146c4fa38363a736a0350e5f176650b93 100644 (file)
@@ -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 */