btf: Make btf_set_contains take a const pointer
bsearch doesn't modify the contents of the array, so we can take a const pointer. Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Acked-by: Andrii Nakryiko <andriin@fb.com> Link: https://lore.kernel.org/bpf/20200921121227.255763-2-lmb@cloudflare.com
This commit is contained in:
parent
31f23a6a18
commit
2af30f115d
|
@ -1905,6 +1905,6 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type t,
|
|||
void *addr1, void *addr2);
|
||||
|
||||
struct btf_id_set;
|
||||
bool btf_id_set_contains(struct btf_id_set *set, u32 id);
|
||||
bool btf_id_set_contains(const struct btf_id_set *set, u32 id);
|
||||
|
||||
#endif /* _LINUX_BPF_H */
|
||||
|
|
|
@ -4772,7 +4772,7 @@ static int btf_id_cmp_func(const void *a, const void *b)
|
|||
return *pa - *pb;
|
||||
}
|
||||
|
||||
bool btf_id_set_contains(struct btf_id_set *set, u32 id)
|
||||
bool btf_id_set_contains(const struct btf_id_set *set, u32 id)
|
||||
{
|
||||
return bsearch(&id, set->ids, set->cnt, sizeof(u32), btf_id_cmp_func) != NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue