bpf: Change func bpf_iter_unreg_target() signature
authorYonghong Song <yhs@fb.com>
Wed, 13 May 2020 18:02:20 +0000 (11:02 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 13 May 2020 19:30:50 +0000 (12:30 -0700)
Change func bpf_iter_unreg_target() parameter from target
name to target reg_info, similar to bpf_iter_reg_target().

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200513180220.2949737-1-yhs@fb.com
include/linux/bpf.h
kernel/bpf/bpf_iter.c
net/ipv6/route.c

index 6fa773e2d1bfbf483c061893b94cf123195080dd..534174eca86b6f8a84b4a974d13adf7137877ad6 100644 (file)
@@ -1154,7 +1154,7 @@ struct bpf_iter_meta {
 };
 
 int bpf_iter_reg_target(const struct bpf_iter_reg *reg_info);
-void bpf_iter_unreg_target(const char *target);
+void bpf_iter_unreg_target(const struct bpf_iter_reg *reg_info);
 bool bpf_iter_prog_supported(struct bpf_prog *prog);
 int bpf_iter_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);
 int bpf_iter_new_fd(struct bpf_link *link);
index 051fb8cab62a196ed27de4864e3023d0ca4fe016..644f8626b2c0e282b44b5018749279cd6c6dee09 100644 (file)
@@ -257,14 +257,14 @@ int bpf_iter_reg_target(const struct bpf_iter_reg *reg_info)
        return 0;
 }
 
-void bpf_iter_unreg_target(const char *target)
+void bpf_iter_unreg_target(const struct bpf_iter_reg *reg_info)
 {
        struct bpf_iter_target_info *tinfo;
        bool found = false;
 
        mutex_lock(&targets_mutex);
        list_for_each_entry(tinfo, &targets, list) {
-               if (!strcmp(target, tinfo->reg_info->target)) {
+               if (reg_info == tinfo->reg_info) {
                        list_del(&tinfo->list);
                        kfree(tinfo);
                        found = true;
index 6ad2fa51a23a1597098918789ae24dbc2613a95d..22bf4e36c093c2ed02287af9141f50ccaf000399 100644 (file)
@@ -6412,7 +6412,7 @@ static int __init bpf_iter_register(void)
 
 static void bpf_iter_unregister(void)
 {
-       bpf_iter_unreg_target("ipv6_route");
+       bpf_iter_unreg_target(&ipv6_route_reg_info);
 }
 #endif
 #endif