Re: [PATCH v9 bpf-next 07/14] bpf: Factor btf_struct_access function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Aug 1, 2020 at 10:04 AM Jiri Olsa <jolsa@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---

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

>  kernel/bpf/btf.c | 75 +++++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 65 insertions(+), 10 deletions(-)
>

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux