[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4Bzbk1ivXa=Q_Fvb+jjrWAJaXJccBWhFTAsH4pVsz0V-eLQ@mail.gmail.com>
Date: Tue, 4 Aug 2020 23:18:20 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...nel.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Martin KaFai Lau <kafai@...com>,
David Miller <davem@...hat.com>,
John Fastabend <john.fastabend@...il.com>,
Wenbo Zhang <ethercflow@...il.com>,
KP Singh <kpsingh@...omium.org>,
Brendan Gregg <bgregg@...flix.com>,
Florent Revest <revest@...omium.org>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v9 bpf-next 07/14] bpf: Factor btf_struct_access function
On Sat, Aug 1, 2020 at 10:04 AM Jiri Olsa <jolsa@...nel.org> wrote:
>
> Adding btf_struct_walk function that walks through the
> struct type + given offset and returns following values:
>
> enum bpf_struct_walk_result {
> /* < 0 error */
> WALK_SCALAR = 0,
> WALK_PTR,
> WALK_STRUCT,
> };
>
> WALK_SCALAR - when SCALAR_VALUE is found
> WALK_PTR - when pointer value is found, its ID is stored
> in 'next_btf_id' output param
> WALK_STRUCT - when nested struct object is found, its ID is stored
> in 'next_btf_id' output param
>
> It will be used in following patches to get all nested
> struct objects for given type and offset.
>
> The btf_struct_access now calls btf_struct_walk function,
> as long as it gets nested structs as return value.
>
> Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> ---
This turned out to be rather much more succinct and clean than I
imagined when I was originally proposing the struct iteration idea.
Great job at abstracting this!
Acked-by: Andrii Nakryiko <andriin@...com>
> kernel/bpf/btf.c | 75 +++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 65 insertions(+), 10 deletions(-)
>
[...]
Powered by blists - more mailing lists