BPF List
 help / color / mirror / Atom feed
From: Hengqi Chen <hengqi.chen@gmail.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	yhs@fb.com, john.fastabend@gmail.com, kafai@fb.com,
	songliubraving@fb.com, hengqi.chen@gmail.com
Subject: [PATCH bpf-next 3/5 v2] tools/resolve_btfids: Switch to new btf__type_cnt API
Date: Fri, 22 Oct 2021 21:06:21 +0800	[thread overview]
Message-ID: <20211022130623.1548429-4-hengqi.chen@gmail.com> (raw)
In-Reply-To: <20211022130623.1548429-1-hengqi.chen@gmail.com>

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>
---
 tools/bpf/resolve_btfids/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/bpf/resolve_btfids/main.c b/tools/bpf/resolve_btfids/main.c
index 716e6ad1864b..a59cb0ee609c 100644
--- a/tools/bpf/resolve_btfids/main.c
+++ b/tools/bpf/resolve_btfids/main.c
@@ -502,12 +502,12 @@ static int symbols_resolve(struct object *obj)
 	}

 	err = -1;
-	nr_types = btf__get_nr_types(btf);
+	nr_types = btf__type_cnt(btf);

 	/*
 	 * Iterate all the BTF types and search for collected symbol IDs.
 	 */
-	for (type_id = 1; type_id <= nr_types; type_id++) {
+	for (type_id = 1; type_id < nr_types; type_id++) {
 		const struct btf_type *type;
 		struct rb_root *root;
 		struct btf_id *id;
--
2.30.2

  parent reply	other threads:[~2021-10-22 13:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-22 13:06 [PATCH bpf-next 0/5 v2] libbpf: Add btf__type_cnt() and btf__raw_data() APIs Hengqi Chen
2021-10-22 13:06 ` [PATCH bpf-next 1/5 " Hengqi Chen
2021-10-22 13:06 ` [PATCH bpf-next 2/5 v2] perf bpf: Switch to new btf__raw_data API Hengqi Chen
2021-10-22 13:06 ` Hengqi Chen [this message]
2021-10-22 13:06 ` [PATCH bpf-next 4/5 v2] bpftool: Switch to new btf__type_cnt API Hengqi Chen
2021-10-22 13:06 ` [PATCH bpf-next 5/5 v2] selftests/bpf: Switch to new btf__type_cnt/btf__raw_data APIs Hengqi Chen
2021-10-22 23:39 ` [PATCH bpf-next 0/5 v2] libbpf: Add btf__type_cnt() and btf__raw_data() APIs Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211022130623.1548429-4-hengqi.chen@gmail.com \
    --to=hengqi.chen@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox