diff options
author | Hengqi Chen <hengqi.chen@gmail.com> | 2021-10-22 21:06:22 +0800 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-10-22 16:09:14 -0700 |
commit | 58fc155b0e4bbd69584b7a241ab01d55ee7cfde6 (patch) | |
tree | 661fe8c7b5ccd91f68bab231fe3c91d6dea56117 /tools/bpf/bpftool/gen.c | |
parent | 2d8f09fafc6351d77f724c208c8168d2512d5478 (diff) | |
download | linux-58fc155b0e4bbd69584b7a241ab01d55ee7cfde6.tar.gz linux-58fc155b0e4bbd69584b7a241ab01d55ee7cfde6.tar.xz |
bpftool: Switch to new btf__type_cnt API
Replace the call to btf__get_nr_types with new API btf__type_cnt.
The old API will be deprecated in libbpf v0.7+. No functionality
change.
Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20211022130623.1548429-5-hengqi.chen@gmail.com
Diffstat (limited to 'tools/bpf/bpftool/gen.c')
-rw-r--r-- | tools/bpf/bpftool/gen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c index c446405ab73f..5c18351290f0 100644 --- a/tools/bpf/bpftool/gen.c +++ b/tools/bpf/bpftool/gen.c @@ -211,7 +211,7 @@ static int codegen_datasec_def(struct bpf_object *obj, static int codegen_datasecs(struct bpf_object *obj, const char *obj_name) { struct btf *btf = bpf_object__btf(obj); - int n = btf__get_nr_types(btf); + int n = btf__type_cnt(btf); struct btf_dump *d; struct bpf_map *map; const struct btf_type *sec; @@ -233,7 +233,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name) continue; sec = NULL; - for (i = 1; i <= n; i++) { + for (i = 1; i < n; i++) { const struct btf_type *t = btf__type_by_id(btf, i); const char *name; |