Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Jason Xing <kerneljasonxing@gmail.com>
To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
	eddyz87@gmail.com, mykolal@fb.com, martin.lau@linux.dev,
	song@kernel.org, yonghong.song@linux.dev,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, jolsa@kernel.org, shuah@kernel.org
Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Jason Xing <kerneljasonxing@gmail.com>
Subject: [PATCH bpf-next v1 1/2] bpf: changes_pkt_data: correct the 'main' error
Date: Tue,  4 Feb 2025 10:39:45 +0800	[thread overview]
Message-ID: <20250204023946.16031-2-kerneljasonxing@gmail.com> (raw)
In-Reply-To: <20250204023946.16031-1-kerneljasonxing@gmail.com>

When compiling the selftests, the following error is printed out:
selftests/bpf/prog_tests/changes_pkt_data.c: In function ‘test_aux’:
selftests/bpf/prog_tests/changes_pkt_data.c:22:27: error: ‘main’ is usually a function [-Werror=main]
  struct changes_pkt_data *main = NULL;
                           ^~~~

Fix it by replacing with 'main_data'.

Signed-off-by: Jason Xing <kerneljasonxing@gmail.com>
---
 .../selftests/bpf/prog_tests/changes_pkt_data.c      | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/changes_pkt_data.c b/tools/testing/selftests/bpf/prog_tests/changes_pkt_data.c
index 7526de379081..b5c9031ec470 100644
--- a/tools/testing/selftests/bpf/prog_tests/changes_pkt_data.c
+++ b/tools/testing/selftests/bpf/prog_tests/changes_pkt_data.c
@@ -19,7 +19,7 @@ static void test_aux(const char *main_prog_name,
 	struct bpf_program *freplace_prog = NULL;
 	struct bpf_program *main_prog = NULL;
 	LIBBPF_OPTS(bpf_object_open_opts, opts);
-	struct changes_pkt_data *main = NULL;
+	struct changes_pkt_data *main_data = NULL;
 	char log[16*1024];
 	int err;
 
@@ -27,14 +27,14 @@ static void test_aux(const char *main_prog_name,
 	opts.kernel_log_size = sizeof(log);
 	if (env.verbosity >= VERBOSE_SUPER)
 		opts.kernel_log_level = 1 | 2 | 4;
-	main = changes_pkt_data__open_opts(&opts);
-	if (!ASSERT_OK_PTR(main, "changes_pkt_data__open"))
+	main_data = changes_pkt_data__open_opts(&opts);
+	if (!ASSERT_OK_PTR(main_data, "changes_pkt_data__open"))
 		goto out;
-	main_prog = bpf_object__find_program_by_name(main->obj, main_prog_name);
+	main_prog = bpf_object__find_program_by_name(main_data->obj, main_prog_name);
 	if (!ASSERT_OK_PTR(main_prog, "main_prog"))
 		goto out;
 	bpf_program__set_autoload(main_prog, true);
-	err = changes_pkt_data__load(main);
+	err = changes_pkt_data__load(main_data);
 	print_verifier_log(log);
 	if (!ASSERT_OK(err, "changes_pkt_data__load"))
 		goto out;
@@ -60,7 +60,7 @@ static void test_aux(const char *main_prog_name,
 
 out:
 	changes_pkt_data_freplace__destroy(freplace);
-	changes_pkt_data__destroy(main);
+	changes_pkt_data__destroy(main_data);
 }
 
 /* There are two global subprograms in both changes_pkt_data.skel.h:
-- 
2.43.5


  reply	other threads:[~2025-02-04  2:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04  2:39 [PATCH bpf-next v1 0/2] selftests: fix two small compilation errors Jason Xing
2025-02-04  2:39 ` Jason Xing [this message]
2025-02-07  6:04   ` [PATCH bpf-next v1 1/2] bpf: changes_pkt_data: correct the 'main' error Martin KaFai Lau
2025-02-07  6:48     ` Jason Xing
2025-02-11 20:06       ` Martin KaFai Lau
2025-02-04  2:39 ` [PATCH bpf-next v1 2/2] bpf: sockopt_sk: fix 'undeclared' definition error Jason Xing
2025-02-05  2:57   ` Hou Tao
2025-02-05  3:27     ` Jason Xing
2025-02-05  9:30       ` Hou Tao
2025-02-05  9:38         ` Jason Xing
2025-02-11 19:40       ` Martin KaFai Lau
2025-02-11  7:52 ` [PATCH bpf-next v1 0/2] selftests: fix two small compilation errors Jason Xing

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=20250204023946.16031-2-kerneljasonxing@gmail.com \
    --to=kerneljasonxing@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mykolal@fb.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /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