Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Jiri Olsa <olsajiri@gmail.com>
To: Yuan Chen <chenyuan_fl@163.com>
Cc: andrii@kernel.org, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning
Date: Mon, 2 Sep 2024 21:48:35 +0300	[thread overview]
Message-ID: <ZtYIgzz74_OZQM7B@krava> (raw)
In-Reply-To: <20240902093248.23473-1-chenyuan_fl@163.com>

On Mon, Sep 02, 2024 at 05:32:48PM +0800, Yuan Chen 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'.
> 
> Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>

perhaps also 

Fixes: 4e9e07603ecd ("selftests/bpf: make use of PROCMAP_QUERY ioctl if available")

Acked-by: Jiri Olsa <jolsa@kernel.org>

jirka

> ---
>  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
> 
> 

      reply	other threads:[~2024-09-02 18:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02  9:32 [PATCH] selftests/bpf: Fix procmap_query()'s params mismatch and compilation warning Yuan Chen
2024-09-02 18:48 ` Jiri Olsa [this message]

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=ZtYIgzz74_OZQM7B@krava \
    --to=olsajiri@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chenyuan_fl@163.com \
    --cc=linux-kselftest@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