* [PATCH v2 1/1] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning
@ 2024-09-03 1:28 Yuan Chen
2024-09-04 19:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Yuan Chen @ 2024-09-03 1:28 UTC (permalink / raw)
To: andrii, olsajiri; +Cc: bpf, linux-kselftest
From: Yuan Chen <chenyuan@kylinos.cn>
When the PROCMAP_QUERY is not defined, a compilation error occurs due to the
mismatch of the procmap_query()'s params, procmap_query() only be called in
the file where the function is defined, modify the params so they can match.
We get a warning when build samples/bpf:
trace_helpers.c:252:5: warning: no previous prototype for ‘procmap_query’ [-Wmissing-prototypes]
252 | int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
| ^~~~~~~~~~~~~
As this function is only used in the file, mark it as 'static'.
Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
---
tools/testing/selftests/bpf/trace_helpers.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helpers.c
index 1bfd881c0e07..2d742fdac6b9 100644
--- a/tools/testing/selftests/bpf/trace_helpers.c
+++ b/tools/testing/selftests/bpf/trace_helpers.c
@@ -249,7 +249,7 @@ int kallsyms_find(const char *sym, unsigned long long *addr)
#ifdef PROCMAP_QUERY
int env_verbosity __weak = 0;
-int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
+static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
{
char path_buf[PATH_MAX], build_id_buf[20];
struct procmap_query q;
@@ -293,7 +293,7 @@ int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, si
return 0;
}
#else
-int procmap_query(int fd, const void *addr, size_t *start, size_t *offset, int *flags)
+static int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
{
return -EOPNOTSUPP;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v2 1/1] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning
2024-09-03 1:28 [PATCH v2 1/1] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning Yuan Chen
@ 2024-09-04 19:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-09-04 19:00 UTC (permalink / raw)
To: Yuan Chen; +Cc: andrii, olsajiri, bpf, linux-kselftest
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Tue, 3 Sep 2024 09:28:39 +0800 you wrote:
> From: Yuan Chen <chenyuan@kylinos.cn>
>
> When the PROCMAP_QUERY is not defined, a compilation error occurs due to the
> mismatch of the procmap_query()'s params, procmap_query() only be called in
> the file where the function is defined, modify the params so they can match.
>
> We get a warning when build samples/bpf:
> trace_helpers.c:252:5: warning: no previous prototype for ‘procmap_query’ [-Wmissing-prototypes]
> 252 | int procmap_query(int fd, const void *addr, __u32 query_flags, size_t *start, size_t *offset, int *flags)
> | ^~~~~~~~~~~~~
> As this function is only used in the file, mark it as 'static'.
>
> [...]
Here is the summary with links:
- [v2,1/1] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning
https://git.kernel.org/bpf/bpf-next/c/02baa0a2a677
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-04 19:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-03 1:28 [PATCH v2 1/1] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning Yuan Chen
2024-09-04 19:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox