2022-09-23 22:07:35

by Andrii Nakryiko

[permalink] [raw]
Subject: Re: [bpf-next v4] libbpf: Add pathname_concat() helper

On Wed, Sep 21, 2022 at 11:08 PM Wang Yufen <[email protected]> wrote:
>
> Move snprintf and len check to common helper pathname_concat() to make the
> code simpler.
>
> Signed-off-by: Wang Yufen <[email protected]>
> ---
> tools/lib/bpf/libbpf.c | 76 +++++++++++++++++++-------------------------------
> 1 file changed, 29 insertions(+), 47 deletions(-)
>

You went a bit overboard with libbpf_err(). We need it only in
directly user-facing functions. I've fixed it up while applying. Also
moved buf and buffer size to be first two arguments to match
snprintf() order of arguments a bit closer. Applied to bpf-next,
thanks.

> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> index 2ca30cc..2d8b195 100644
> --- a/tools/lib/bpf/libbpf.c
> +++ b/tools/lib/bpf/libbpf.c
> @@ -2096,19 +2096,30 @@ static bool get_map_field_int(const char *map_name, const struct btf *btf,
> return true;
> }

[...]