libbpf: Deprecate forgotten btf__get_map_kv_tids()
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 3 Feb 2022 22:50:17 +0000 (14:50 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 4 Feb 2022 00:07:16 +0000 (01:07 +0100)
btf__get_map_kv_tids() is in the same group of APIs as
btf_ext__reloc_func_info()/btf_ext__reloc_line_info() which were only
used by BCC. It was missed to be marked as deprecated in [0]. Fixing
that to complete [1].

  [0] https://patchwork.kernel.org/project/netdevbpf/patch/20220201014610.3522985-1-davemarchevsky@fb.com/
  [1] Closes: https://github.com/libbpf/libbpf/issues/277

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20220203225017.1795946-1-andrii@kernel.org
tools/lib/bpf/btf.h
tools/lib/bpf/libbpf.c

index b10729fd830c9c00ccb4a709f63f0f9aa04ecc5c..951ac74757948fd473a7ab18273f06b21c54d3a6 100644 (file)
@@ -150,6 +150,7 @@ LIBBPF_API void btf__set_fd(struct btf *btf, int fd);
 LIBBPF_API const void *btf__raw_data(const struct btf *btf, __u32 *size);
 LIBBPF_API const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
 LIBBPF_API const char *btf__str_by_offset(const struct btf *btf, __u32 offset);
+LIBBPF_DEPRECATED_SINCE(0, 7, "this API is not necessary when BTF-defined maps are used")
 LIBBPF_API int btf__get_map_kv_tids(const struct btf *btf, const char *map_name,
                                    __u32 expected_key_size,
                                    __u32 expected_value_size,
index 81605de8654ec88c62c0cd7c1792680b6a740786..904cdf83002b86a6c544bad6b656e21590774384 100644 (file)
@@ -4202,9 +4202,12 @@ static int bpf_map_find_btf_info(struct bpf_object *obj, struct bpf_map *map)
 
        if (!bpf_map__is_internal(map)) {
                pr_warn("Use of BPF_ANNOTATE_KV_PAIR is deprecated, use BTF-defined maps in .maps section instead\n");
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
                ret = btf__get_map_kv_tids(obj->btf, map->name, def->key_size,
                                           def->value_size, &key_type_id,
                                           &value_type_id);
+#pragma GCC diagnostic pop
        } else {
                /*
                 * LLVM annotates global data differently in BTF, that is,