Re: [PATCH bpf-next 5/9] selftests/bpf: test libbpf API function btf__add_tag()

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

 



On Tue, Sep 7, 2021 at 4:01 PM Yonghong Song <yhs@xxxxxx> wrote:
>
> Add btf_write tests with btf__add_tag() function.
>
> Signed-off-by: Yonghong Song <yhs@xxxxxx>
> ---
>  tools/testing/selftests/bpf/btf_helpers.c     |  7 +++++-
>  .../selftests/bpf/prog_tests/btf_write.c      | 23 +++++++++++++++++++
>  2 files changed, 29 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/btf_helpers.c b/tools/testing/selftests/bpf/btf_helpers.c
> index b692e6ead9b5..20dc8f4cb884 100644
> --- a/tools/testing/selftests/bpf/btf_helpers.c
> +++ b/tools/testing/selftests/bpf/btf_helpers.c
> @@ -24,11 +24,12 @@ static const char * const btf_kind_str_mapping[] = {
>         [BTF_KIND_VAR]          = "VAR",
>         [BTF_KIND_DATASEC]      = "DATASEC",
>         [BTF_KIND_FLOAT]        = "FLOAT",
> +       [BTF_KIND_TAG]          = "TAG",
>  };
>
>  static const char *btf_kind_str(__u16 kind)
>  {
> -       if (kind > BTF_KIND_DATASEC)
> +       if (kind > BTF_KIND_TAG)
>                 return "UNKNOWN";
>         return btf_kind_str_mapping[kind];
>  }
> @@ -177,6 +178,10 @@ int fprintf_btf_type_raw(FILE *out, const struct btf *btf, __u32 id)
>         case BTF_KIND_FLOAT:
>                 fprintf(out, " size=%u", t->size);
>                 break;
> +       case BTF_KIND_TAG:
> +               fprintf(out, " type_id=%u, comp_id=%d",

seems like we use space as a separator, please remove comma for consistency

> +                       t->type, btf_kflag(t) ? -1 : (int)btf_tag(t)->comp_id);
> +               break;
>         default:
>                 break;
>         }

[...]



[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