aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lib
diff options
context:
space:
mode:
authorJakub Kicinski <jakub.kicinski@netronome.com>2018-08-02 22:30:27 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-02 22:45:14 -0400
commit6534770d6f176093b50896961107b2d545ef38f0 (patch)
tree23bc62d42783174ae3cfcf6e3e3b281895f7af3b /tools/lib
parent6b431d50d2a8acd1c418b998b856a055252ebc3a (diff)
tools: bpf: fix BTF code added twice to different trees
commit 38d5d3b3d5db ("bpf: Introduce BPF_ANNOTATE_KV_PAIR") added to the bpf and net trees what commit 92b57121ca79 ("bpf: btf: export btf types and name by offset from lib") has already added to bpf-next/net-next, but in slightly different location. Remove the duplicates (to fix build of libbpf). Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/btf.c17
-rw-r--r--tools/lib/bpf/btf.h1
2 files changed, 0 insertions, 18 deletions
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 1622a309f169..09ecf8162f7a 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -37,14 +37,6 @@ struct btf {
37 int fd; 37 int fd;
38}; 38};
39 39
40static const char *btf_name_by_offset(const struct btf *btf, __u32 offset)
41{
42 if (offset < btf->hdr->str_len)
43 return &btf->strings[offset];
44 else
45 return NULL;
46}
47
48static int btf_add_type(struct btf *btf, struct btf_type *t) 40static int btf_add_type(struct btf *btf, struct btf_type *t)
49{ 41{
50 if (btf->types_size - btf->nr_types < 2) { 42 if (btf->types_size - btf->nr_types < 2) {
@@ -401,12 +393,3 @@ const char *btf__name_by_offset(const struct btf *btf, __u32 offset)
401 else 393 else
402 return NULL; 394 return NULL;
403} 395}
404
405const struct btf_type *btf__type_by_id(const struct btf *btf,
406 __u32 type_id)
407{
408 if (type_id > btf->nr_types)
409 return NULL;
410
411 return btf->types[type_id];
412}
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index dd8a86eab8ca..43c658ccfc2b 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -22,6 +22,5 @@ __s64 btf__resolve_size(const struct btf *btf, __u32 type_id);
22int btf__resolve_type(const struct btf *btf, __u32 type_id); 22int btf__resolve_type(const struct btf *btf, __u32 type_id);
23int btf__fd(const struct btf *btf); 23int btf__fd(const struct btf *btf);
24const char *btf__name_by_offset(const struct btf *btf, __u32 offset); 24const char *btf__name_by_offset(const struct btf *btf, __u32 offset);
25const struct btf_type *btf__type_by_id(const struct btf *btf, __u32 type_id);
26 25
27#endif 26#endif