From: Kumar Kartikeya Dwivedi <memxor@gmail.com>
To: bpf@vger.kernel.org
Cc: Andrii Nakryiko <andrii@kernel.org>
Subject: [PATCH bpf-next v1 4/6] selftests/bpf: Fix non-C89 loop variable declaration instances
Date: Sat, 6 Nov 2021 05:12:41 +0530 [thread overview]
Message-ID: <20211105234243.390179-5-memxor@gmail.com> (raw)
In-Reply-To: <20211105234243.390179-1-memxor@gmail.com>
Fix the `int i` declaration inside the for statement. This is non-C89
compliant. Doing all of them in this change since they are trivial.
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
---
tools/testing/selftests/bpf/prog_tests/d_path.c | 4 ++--
tools/testing/selftests/bpf/prog_tests/timer_mim.c | 6 +++---
tools/testing/selftests/bpf/prog_tests/xdp_bonding.c | 4 ++--
tools/testing/selftests/bpf/test_progs.c | 2 +-
4 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/d_path.c b/tools/testing/selftests/bpf/prog_tests/d_path.c
index 0a577a248d34..cc787ad68081 100644
--- a/tools/testing/selftests/bpf/prog_tests/d_path.c
+++ b/tools/testing/selftests/bpf/prog_tests/d_path.c
@@ -103,7 +103,7 @@ void test_d_path(void)
{
struct test_d_path__bss *bss;
struct test_d_path *skel;
- int err;
+ int err, i;
skel = test_d_path__open_and_load();
if (CHECK(!skel, "setup", "d_path skeleton failed\n"))
@@ -130,7 +130,7 @@ void test_d_path(void)
"trampoline for filp_close was not called\n"))
goto cleanup;
- for (int i = 0; i < MAX_FILES; i++) {
+ for (i = 0; i < MAX_FILES; i++) {
CHECK(strncmp(src.paths[i], bss->paths_stat[i], MAX_PATH_LEN),
"check",
"failed to get stat path[%d]: %s vs %s\n",
diff --git a/tools/testing/selftests/bpf/prog_tests/timer_mim.c b/tools/testing/selftests/bpf/prog_tests/timer_mim.c
index 949a0617869d..f12536c32e2d 100644
--- a/tools/testing/selftests/bpf/prog_tests/timer_mim.c
+++ b/tools/testing/selftests/bpf/prog_tests/timer_mim.c
@@ -6,9 +6,9 @@
static int timer_mim(struct timer_mim *timer_skel)
{
+ int err, prog_fd, key1 = 1, i;
__u32 duration = 0, retval;
__u64 cnt1, cnt2;
- int err, prog_fd, key1 = 1;
err = timer_mim__attach(timer_skel);
if (!ASSERT_OK(err, "timer_attach"))
@@ -23,7 +23,7 @@ static int timer_mim(struct timer_mim *timer_skel)
/* check that timer_cb[12] are incrementing 'cnt' */
cnt1 = READ_ONCE(timer_skel->bss->cnt);
- for (int i = 0; i < 100; i++) {
+ for (i = 0; i < 100; i++) {
cnt2 = READ_ONCE(timer_skel->bss->cnt);
if (cnt2 != cnt1)
break;
@@ -41,7 +41,7 @@ static int timer_mim(struct timer_mim *timer_skel)
/* check that timer_cb[12] are no longer running */
cnt1 = READ_ONCE(timer_skel->bss->cnt);
- for (int i = 0; i < 100; i++) {
+ for (i = 0; i < 100; i++) {
usleep(200); /* 100 times more than interval */
cnt2 = READ_ONCE(timer_skel->bss->cnt);
if (cnt2 == cnt1)
diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
index faa22b84f2ee..e5b8666e59eb 100644
--- a/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
+++ b/tools/testing/selftests/bpf/prog_tests/xdp_bonding.c
@@ -335,7 +335,7 @@ static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons)
{
static const char * const ifaces[] = {"bond2", "veth2_1", "veth2_2"};
int veth1_1_rx, veth1_2_rx;
- int err;
+ int err, i;
if (bonding_setup(skeletons, BOND_MODE_ROUNDROBIN, BOND_XMIT_POLICY_LAYER23,
BOND_ONE_NO_ATTACH))
@@ -346,7 +346,7 @@ static void test_xdp_bonding_redirect_multi(struct skeletons *skeletons)
goto out;
/* populate the devmap with the relevant interfaces */
- for (int i = 0; i < ARRAY_SIZE(ifaces); i++) {
+ for (i = 0; i < ARRAY_SIZE(ifaces); i++) {
int ifindex = if_nametoindex(ifaces[i]);
int map_fd = bpf_map__fd(skeletons->xdp_redirect_multi_kern->maps.map_all);
diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c
index c65986bd9d07..0096051e7560 100644
--- a/tools/testing/selftests/bpf/test_progs.c
+++ b/tools/testing/selftests/bpf/test_progs.c
@@ -1146,7 +1146,7 @@ static int server_main(void)
/* run serial tests */
save_netns();
- for (int i = 0; i < prog_test_cnt; i++) {
+ for (i = 0; i < prog_test_cnt; i++) {
struct prog_test_def *test = &prog_test_defs[i];
struct test_result *result = &test_results[i];
--
2.33.1
next prev parent reply other threads:[~2021-11-05 23:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-05 23:42 [PATCH bpf-next v1 0/6] Change bpftool, libbpf, selftests to force GNU89 mode Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 1/6] bpftool: Compile using -std=gnu89 Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 2/6] libbpf: fix non-C89 loop variable declaration in gen_loader.c Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 3/6] libbpf: Compile using -std=gnu89 Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` Kumar Kartikeya Dwivedi [this message]
2021-11-05 23:42 ` [PATCH bpf-next v1 5/6] selftests/bpf: Switch to non-unicode character in output Kumar Kartikeya Dwivedi
2021-11-05 23:42 ` [PATCH bpf-next v1 6/6] selftests/bpf: Compile using -std=gnu89 Kumar Kartikeya Dwivedi
2021-11-06 16:33 ` [PATCH bpf-next v1 0/6] Change bpftool, libbpf, selftests to force GNU89 mode Alexei Starovoitov
2021-11-06 20:02 ` Andrii Nakryiko
2021-11-06 23:20 ` Alexei Starovoitov
2021-11-08 22:15 ` Andrii Nakryiko
2021-11-09 21:40 ` Alexei Starovoitov
2021-11-09 23:16 ` 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=20211105234243.390179-5-memxor@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.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