mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: longlong yan <yanlonglong@kylinos.cn>
To: andrii@kernel.org, eddyz87@gmail.com, ast@kernel.org,
	daniel@iogearbox.net, memxor@gmail.com, martin.lau@linux.dev,
	song@kernel.org, bpf@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: longlong yan <yanlonglong@kylinos.cn>
Subject: [PATCH] libarena: use ARRAY_SIZE macro in test_rbtree.bpf.c
Date: Fri, 17 Jul 2026 14:47:19 +0800	[thread overview]
Message-ID: <20260717064719.1032-1-yanlonglong@kylinos.cn> (raw)

The ARRAY_SIZE macro is more compact and more formal in linux source.

Fixes: 6c3e8a4d4765 ("selftests/bpf: libarena: Add rbtree data structure")
Signed-off-by: longlong yan <yanlonglong@kylinos.cn>
---
 .../selftests/bpf/libarena/selftests/test_rbtree.bpf.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c b/tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c
index 856c484a009a..f6e15f77cdf5 100644
--- a/tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c
+++ b/tools/testing/selftests/bpf/libarena/selftests/test_rbtree.bpf.c
@@ -275,7 +275,7 @@ clean_up_noalloc_tree(struct rbtree __arena *rbtree)
 
 int insert_many(enum rbtree_alloc alloc, enum rbtree_insert_mode insert)
 {
-	const size_t numkeys = sizeof(keys) / sizeof(keys[0]);
+	const size_t numkeys = ARRAY_SIZE(keys);
 	node_ctx nodec;
 	u64 key, value;
 	int ret;
@@ -373,7 +373,7 @@ __weak int test_rbtree_remove_one(void)
 
 static __always_inline int remove_many_verify_all_present(struct rbtree __arena *rbtree)
 {
-	const size_t numkeys = sizeof(morekeys) / sizeof(morekeys[0]);
+	const size_t numkeys = ARRAY_SIZE(morekeys);
 	u64 value;
 	int ret;
 	int i;
@@ -394,7 +394,7 @@ static __always_inline int remove_many_verify_all_present(struct rbtree __arena
 
 static __always_inline int remove_many_verify_remaining(struct rbtree __arena *rbtree)
 {
-	const size_t numkeys = sizeof(morekeys) / sizeof(morekeys[0]);
+	const size_t numkeys = ARRAY_SIZE(morekeys);
 	u64 value;
 	int ret;
 	int i;
@@ -434,7 +434,7 @@ static __always_inline int remove_many_verify_remaining(struct rbtree __arena *r
 
 static __noinline int remove_many_alloc(struct rbtree __arena *rbtree)
 {
-	const size_t numkeys = sizeof(morekeys) / sizeof(morekeys[0]);
+	const size_t numkeys = ARRAY_SIZE(morekeys);
 	u64 value;
 	int ret;
 	int i;
@@ -482,7 +482,7 @@ static __noinline int remove_many_alloc(struct rbtree __arena *rbtree)
 
 static __noinline int remove_many_noalloc(struct rbtree __arena *rbtree)
 {
-	const size_t numkeys = sizeof(morekeys) / sizeof(morekeys[0]);
+	const size_t numkeys = ARRAY_SIZE(morekeys);
 	node_ctx first = NULL, last = NULL;
 	u64 value;
 	int ret;
-- 
2.43.0


             reply	other threads:[~2026-07-17  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  6:47 longlong yan [this message]
2026-07-17  7:32 longlong yan
2026-07-17  8:29 ` bot+bpf-ci
2026-07-17 21:29 ` Emil Tsalapatis

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=20260717064719.1032-1-yanlonglong@kylinos.cn \
    --to=yanlonglong@kylinos.cn \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=song@kernel.org \
    /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