diff mbox series

[bpf-next,2/2] selftests/bpf: Replace bpf_{map,program}__next with bpf_object__next_{map,program}

Message ID 20210906165456.325999-2-hengqi.chen@gmail.com (mailing list archive)
State Changes Requested
Delegated to: BPF
Headers show
Series [bpf-next,1/2] libbpf: Deprecate bpf_{map,program}__{prev,next} APIs | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 10 maintainers not CCed: yangjunlin@yulong.com kafai@fb.com linux-kselftest@vger.kernel.org netdev@vger.kernel.org quentin@isovalent.com kpsingh@kernel.org shuah@kernel.org toke@redhat.com songliubraving@fb.com iii@linux.ibm.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit fail Errors and warnings before: 422 this patch: 2561
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 32 lines checked
netdev/build_allmodconfig_warn fail Errors and warnings before: 574 this patch: 2761
netdev/header_inline success Link
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next success VM_Test

Commit Message

Hengqi Chen Sept. 6, 2021, 4:54 p.m. UTC
Replace deprecated bpf_{map,program}__next APIs with newly added
bpf_object__next_{map,program} APIs, so that no compilation warnings
emit.

Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
---
 tools/testing/selftests/bpf/prog_tests/btf.c              | 2 +-
 tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c    | 2 +-
 tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 2 +-
 tools/testing/selftests/bpf/prog_tests/tcp_rtt.c          | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

--
2.30.2

Comments

Andrii Nakryiko Sept. 9, 2021, 4:47 a.m. UTC | #1
On Mon, Sep 6, 2021 at 9:55 AM Hengqi Chen <hengqi.chen@gmail.com> wrote:
>
> Replace deprecated bpf_{map,program}__next APIs with newly added
> bpf_object__next_{map,program} APIs, so that no compilation warnings
> emit.
>
> Signed-off-by: Hengqi Chen <hengqi.chen@gmail.com>
> ---

LGTM, but the subject for this patch (and a few others you've
submitted) is very long. I think the recommendation is to keep them
shorter than 78 characters or something like that. Maybe use something
like "selftests/bpf: switch to new new bpf_object__next_program APIs"?

>  tools/testing/selftests/bpf/prog_tests/btf.c              | 2 +-
>  tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c    | 2 +-
>  tools/testing/selftests/bpf/prog_tests/select_reuseport.c | 2 +-
>  tools/testing/selftests/bpf/prog_tests/tcp_rtt.c          | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
>

[...]
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/selftests/bpf/prog_tests/btf.c
index 649f87382c8d..77b297f6c003 100644
--- a/tools/testing/selftests/bpf/prog_tests/btf.c
+++ b/tools/testing/selftests/bpf/prog_tests/btf.c
@@ -4268,7 +4268,7 @@  static void do_test_file(unsigned int test_num)
 	if (CHECK(err, "obj: %d", err))
 		return;

-	prog = bpf_program__next(NULL, obj);
+	prog = bpf_object__next_program(NULL, obj);
 	if (CHECK(!prog, "Cannot find bpf_prog")) {
 		err = -1;
 		goto done;
diff --git a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
index 73b4c76e6b86..68205b172a7d 100644
--- a/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
+++ b/tools/testing/selftests/bpf/prog_tests/fexit_bpf2bpf.c
@@ -288,7 +288,7 @@  static void test_fmod_ret_freplace(void)
 	if (CHECK(err, "freplace_obj_load", "err %d\n", err))
 		goto out;

-	prog = bpf_program__next(NULL, freplace_obj);
+	prog = bpf_object__next_program(NULL, freplace_obj);
 	freplace_link = bpf_program__attach_trace(prog);
 	if (!ASSERT_OK_PTR(freplace_link, "freplace_attach_trace"))
 		goto out;
diff --git a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c
index 4efd337d6a3c..55957b42bc23 100644
--- a/tools/testing/selftests/bpf/prog_tests/select_reuseport.c
+++ b/tools/testing/selftests/bpf/prog_tests/select_reuseport.c
@@ -114,7 +114,7 @@  static int prepare_bpf_obj(void)
 	err = bpf_object__load(obj);
 	RET_ERR(err, "load bpf_object", "err:%d\n", err);

-	prog = bpf_program__next(NULL, obj);
+	prog = bpf_object__next_program(NULL, obj);
 	RET_ERR(!prog, "get first bpf_program", "!prog\n");
 	select_by_skb_data_prog = bpf_program__fd(prog);
 	RET_ERR(select_by_skb_data_prog < 0, "get prog fd",
diff --git a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
index d207e968e6b1..4957e391e111 100644
--- a/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
+++ b/tools/testing/selftests/bpf/prog_tests/tcp_rtt.c
@@ -109,7 +109,7 @@  static int run_test(int cgroup_fd, int server_fd)
 		return -1;
 	}

-	map = bpf_map__next(NULL, obj);
+	map = bpf_object__next_map(NULL, obj);
 	map_fd = bpf_map__fd(map);

 	err = bpf_prog_attach(prog_fd, cgroup_fd, BPF_CGROUP_SOCK_OPS, 0);