From: Yonghong Song <yhs@fb.com>
To: <bpf@vger.kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 2/9] libbpf: rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag
Date: Tue, 7 Sep 2021 16:01:00 -0700 [thread overview]
Message-ID: <20210907230100.1958061-1-yhs@fb.com> (raw)
In-Reply-To: <20210907230050.1957493-1-yhs@fb.com>
This patch renames functions btf_{hash,equal}_int() to
btf_{hash,equal}_int_tag() so they can be reused for
BTF_KIND_TAG support. There is no functionality change for
this patch.
Signed-off-by: Yonghong Song <yhs@fb.com>
---
tools/lib/bpf/btf.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c
index 77dc24d58302..7cb6ebf1be37 100644
--- a/tools/lib/bpf/btf.c
+++ b/tools/lib/bpf/btf.c
@@ -3256,8 +3256,8 @@ static bool btf_equal_common(struct btf_type *t1, struct btf_type *t2)
t1->size == t2->size;
}
-/* Calculate type signature hash of INT. */
-static long btf_hash_int(struct btf_type *t)
+/* Calculate type signature hash of INT or TAG. */
+static long btf_hash_int_tag(struct btf_type *t)
{
__u32 info = *(__u32 *)(t + 1);
long h;
@@ -3267,8 +3267,8 @@ static long btf_hash_int(struct btf_type *t)
return h;
}
-/* Check structural equality of two INTs. */
-static bool btf_equal_int(struct btf_type *t1, struct btf_type *t2)
+/* Check structural equality of two INTs or TAGs. */
+static bool btf_equal_int_tag(struct btf_type *t1, struct btf_type *t2)
{
__u32 info1, info2;
@@ -3535,7 +3535,7 @@ static int btf_dedup_prep(struct btf_dedup *d)
h = btf_hash_common(t);
break;
case BTF_KIND_INT:
- h = btf_hash_int(t);
+ h = btf_hash_int_tag(t);
break;
case BTF_KIND_ENUM:
h = btf_hash_enum(t);
@@ -3593,11 +3593,11 @@ static int btf_dedup_prim_type(struct btf_dedup *d, __u32 type_id)
return 0;
case BTF_KIND_INT:
- h = btf_hash_int(t);
+ h = btf_hash_int_tag(t);
for_each_dedup_cand(d, hash_entry, h) {
cand_id = (__u32)(long)hash_entry->value;
cand = btf_type_by_id(d->btf, cand_id);
- if (btf_equal_int(t, cand)) {
+ if (btf_equal_int_tag(t, cand)) {
new_id = cand_id;
break;
}
@@ -3881,7 +3881,7 @@ static int btf_dedup_is_equiv(struct btf_dedup *d, __u32 cand_id,
switch (cand_kind) {
case BTF_KIND_INT:
- return btf_equal_int(cand_type, canon_type);
+ return btf_equal_int_tag(cand_type, canon_type);
case BTF_KIND_ENUM:
if (d->opts.dont_resolve_fwds)
--
2.30.2
next prev parent reply other threads:[~2021-09-07 23:01 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-07 23:00 [PATCH bpf-next 0/9] bpf: add support for new btf kind BTF_KIND_TAG Yonghong Song
2021-09-07 23:00 ` [PATCH bpf-next 1/9] bpf: " Yonghong Song
2021-09-09 5:09 ` Andrii Nakryiko
2021-09-10 15:55 ` Yonghong Song
2021-09-07 23:01 ` Yonghong Song [this message]
2021-09-09 5:10 ` [PATCH bpf-next 2/9] libbpf: rename btf_{hash,equal}_int to btf_{hash,equal}_int_tag Andrii Nakryiko
2021-09-07 23:01 ` [PATCH bpf-next 3/9] libbpf: add support for BTF_KIND_TAG Yonghong Song
2021-09-09 5:26 ` Andrii Nakryiko
2021-09-10 16:04 ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 4/9] bpftool: " Yonghong Song
2021-09-09 5:28 ` Andrii Nakryiko
2021-09-09 5:33 ` Andrii Nakryiko
2021-09-10 16:38 ` Yonghong Song
2021-09-10 18:05 ` Andrii Nakryiko
2021-09-10 16:04 ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 5/9] selftests/bpf: test libbpf API function btf__add_tag() Yonghong Song
2021-09-09 5:35 ` Andrii Nakryiko
2021-09-10 16:39 ` Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 6/9] selftests/bpf: add BTF_KIND_TAG unit tests Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 7/9] selftests/bpf: test BTF_KIND_TAG for deduplication Yonghong Song
2021-09-07 23:01 ` [PATCH bpf-next 8/9] selftests/bpf: add a test with a bpf program with btf_tag attributes Yonghong Song
2021-09-09 5:39 ` Andrii Nakryiko
2021-09-07 23:01 ` [PATCH bpf-next 9/9] docs/bpf: add documentation for BTF_KIND_TAG Yonghong Song
2021-09-09 5:42 ` Andrii Nakryiko
2021-09-10 16:40 ` Yonghong Song
2021-09-10 18:05 ` Andrii Nakryiko
2021-09-09 22:45 ` [PATCH bpf-next 0/9] bpf: add support for new btf kind BTF_KIND_TAG Jose E. Marchesi
2021-09-09 23:30 ` Yonghong Song
2021-09-10 2:19 ` Jose E. Marchesi
2021-09-10 7:04 ` Yonghong Song
2021-09-10 8:31 ` Jose E. Marchesi
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=20210907230100.1958061-1-yhs@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@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