BPF List
 help / color / mirror / Atom feed
From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH bpf-next v2 11/16] perf: Use bpf_{btf,link,map,prog}_get_info_by_fd()
Date: Fri, 10 Feb 2023 01:12:05 +0100	[thread overview]
Message-ID: <20230210001210.395194-12-iii@linux.ibm.com> (raw)
In-Reply-To: <20230210001210.395194-1-iii@linux.ibm.com>

Use the new type-safe wrappers around bpf_obj_get_info_by_fd().

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/perf/util/bpf-utils.c   | 4 ++--
 tools/perf/util/bpf_counter.c | 2 +-
 tools/perf/util/bpf_counter.h | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/perf/util/bpf-utils.c b/tools/perf/util/bpf-utils.c
index 80b1d2b3729b..a4154199f56c 100644
--- a/tools/perf/util/bpf-utils.c
+++ b/tools/perf/util/bpf-utils.c
@@ -121,7 +121,7 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
 		return ERR_PTR(-EINVAL);
 
 	/* step 1: get array dimensions */
-	err = bpf_obj_get_info_by_fd(fd, &info, &info_len);
+	err = bpf_prog_get_info_by_fd(fd, &info, &info_len);
 	if (err) {
 		pr_debug("can't get prog info: %s", strerror(errno));
 		return ERR_PTR(-EFAULT);
@@ -183,7 +183,7 @@ get_bpf_prog_info_linear(int fd, __u64 arrays)
 	}
 
 	/* step 5: call syscall again to get required arrays */
-	err = bpf_obj_get_info_by_fd(fd, &info_linear->info, &info_len);
+	err = bpf_prog_get_info_by_fd(fd, &info_linear->info, &info_len);
 	if (err) {
 		pr_debug("can't get prog info: %s", strerror(errno));
 		free(info_linear);
diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c
index eeee899fcf34..5826a1073cf6 100644
--- a/tools/perf/util/bpf_counter.c
+++ b/tools/perf/util/bpf_counter.c
@@ -304,7 +304,7 @@ static bool bperf_attr_map_compatible(int attr_map_fd)
 	__u32 map_info_len = sizeof(map_info);
 	int err;
 
-	err = bpf_obj_get_info_by_fd(attr_map_fd, &map_info, &map_info_len);
+	err = bpf_map_get_info_by_fd(attr_map_fd, &map_info, &map_info_len);
 
 	if (err)
 		return false;
diff --git a/tools/perf/util/bpf_counter.h b/tools/perf/util/bpf_counter.h
index c6d21c07b14c..c071e9444395 100644
--- a/tools/perf/util/bpf_counter.h
+++ b/tools/perf/util/bpf_counter.h
@@ -97,7 +97,7 @@ static inline __u32 bpf_link_get_id(int fd)
 	struct bpf_link_info link_info = { .id = 0, };
 	__u32 link_info_len = sizeof(link_info);
 
-	bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len);
+	bpf_link_get_info_by_fd(fd, &link_info, &link_info_len);
 	return link_info.id;
 }
 
@@ -106,7 +106,7 @@ static inline __u32 bpf_link_get_prog_id(int fd)
 	struct bpf_link_info link_info = { .id = 0, };
 	__u32 link_info_len = sizeof(link_info);
 
-	bpf_obj_get_info_by_fd(fd, &link_info, &link_info_len);
+	bpf_link_get_info_by_fd(fd, &link_info, &link_info_len);
 	return link_info.prog_id;
 }
 
@@ -115,7 +115,7 @@ static inline __u32 bpf_map_get_id(int fd)
 	struct bpf_map_info map_info = { .id = 0, };
 	__u32 map_info_len = sizeof(map_info);
 
-	bpf_obj_get_info_by_fd(fd, &map_info, &map_info_len);
+	bpf_map_get_info_by_fd(fd, &map_info, &map_info_len);
 	return map_info.id;
 }
 
-- 
2.39.1


  parent reply	other threads:[~2023-02-10  0:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10  0:11 [PATCH bpf-next v2 00/16] selftests/bpf: Add Memory Sanitizer support Ilya Leoshkevich
2023-02-10  0:11 ` [PATCH bpf-next v2 01/16] selftests/bpf: Quote host tools Ilya Leoshkevich
2023-02-10  0:11 ` [PATCH bpf-next v2 02/16] tools: runqslower: Add EXTRA_CFLAGS and EXTRA_LDFLAGS support Ilya Leoshkevich
2023-02-10  0:11 ` [PATCH bpf-next v2 03/16] selftests/bpf: Split SAN_CFLAGS and SAN_LDFLAGS Ilya Leoshkevich
2023-02-10  0:11 ` [PATCH bpf-next v2 04/16] selftests/bpf: Forward SAN_CFLAGS and SAN_LDFLAGS to runqslower and libbpf Ilya Leoshkevich
2023-02-10  0:11 ` [PATCH bpf-next v2 05/16] selftests/bpf: Attach to fopen()/fclose() in uprobe_autoattach Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 06/16] selftests/bpf: Attach to fopen()/fclose() in attach_probe Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 07/16] libbpf: Fix alen calculation in libbpf_nla_dump_errormsg() Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 08/16] libbpf: Introduce bpf_{btf,link,map,prog}_get_info_by_fd() Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 09/16] libbpf: Use bpf_{btf,link,map,prog}_get_info_by_fd() Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 10/16] bpftool: " Ilya Leoshkevich
2023-02-10 10:36   ` Ilya Leoshkevich
2023-02-10 14:41   ` Quentin Monnet
2023-02-10  0:12 ` Ilya Leoshkevich [this message]
2023-02-10 23:26   ` [PATCH bpf-next v2 11/16] perf: " Andrii Nakryiko
2023-02-10  0:12 ` [PATCH bpf-next v2 12/16] samples/bpf: " Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 13/16] selftests/bpf: " Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 14/16] libbpf: Factor out is_percpu_bpf_map_type() Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 15/16] libbpf: Add MSan annotations Ilya Leoshkevich
2023-02-10  0:12 ` [PATCH bpf-next v2 16/16] selftests/bpf: " Ilya Leoshkevich
2023-02-10 23:38 ` [PATCH bpf-next v2 00/16] selftests/bpf: Add Memory Sanitizer support Andrii Nakryiko
2023-02-10 23:40 ` patchwork-bot+netdevbpf

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=20230210001210.395194-12-iii@linux.ibm.com \
    --to=iii@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.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