All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: "Daniel Müller" <deso@posteo.net>,
	"Quentin Monnet" <quentin@isovalent.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 09/12] bpftool: Use libbpf_bpf_attach_type_str
Date: Mon, 16 May 2022 16:41:00 -0700	[thread overview]
Message-ID: <CAEf4BzYXxSerQnw3U5SKU10HAbM1KrTj9z_DvX+tQqaq7+2CUQ@mail.gmail.com> (raw)
In-Reply-To: <20220516173540.3520665-10-deso@posteo.net>

On Mon, May 16, 2022 at 10:36 AM Daniel Müller <deso@posteo.net> wrote:
>
> This change switches bpftool over to using the recently introduced
> libbpf_bpf_attach_type_str function instead of maintaining its own
> string representation for the bpf_attach_type enum.
>
> Note that contrary to other enum types, the variant names that bpftool
> maps bpf_attach_type to do not follow a simple to follow rule. With
> bpf_prog_type, for example, the textual representation can easily be
> inferred by stripping the BPF_PROG_TYPE_ prefix and lowercasing the
> remaining string. bpf_attach_type violates this rule for various
> variants. In order to not brake compatibility (these textual
> representations appear in JSON and are used to parse user input), we
> introduce a program local bpf_attach_type_str that overrides the
> variants in question.
> We should consider removing this function and expect the libbpf string
> representation with the next backwards compatibility breaking release,
> if possible.
>
> Signed-off-by: Daniel Müller <deso@posteo.net>
> ---

Quentin, any opinion on this approach? Should we fallback to libbpf's
API for all the future cases or it's better to keep bpftool's own
attach_type mapping?

>  tools/bpf/bpftool/cgroup.c | 20 ++++++----
>  tools/bpf/bpftool/common.c | 82 +++++++++++++++++---------------------
>  tools/bpf/bpftool/link.c   | 15 ++++---
>  tools/bpf/bpftool/main.h   | 15 +++++++
>  4 files changed, 73 insertions(+), 59 deletions(-)
>

[...]

  reply	other threads:[~2022-05-16 23:41 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 17:35 [PATCH bpf-next 00/12] libbpf: Textual representation of enums Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 01/12] libbpf: Introduce libbpf_bpf_prog_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 02/12] selftests/bpf: Add test for libbpf_bpf_prog_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 03/12] bpftool: Use libbpf_bpf_prog_type_str Daniel Müller
2022-05-17 14:18   ` Quentin Monnet
2022-05-17 19:09     ` Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 04/12] libbpf: Introduce libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 05/12] selftests/bpf: Add test for libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 06/12] bpftool: Use libbpf_bpf_map_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 07/12] libbpf: Introduce libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 08/12] selftests/bpf: Add test for libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 09/12] bpftool: Use libbpf_bpf_attach_type_str Daniel Müller
2022-05-16 23:41   ` Andrii Nakryiko [this message]
2022-05-17 14:18     ` Quentin Monnet
2022-05-17 18:54       ` Daniel Müller
2022-05-18 13:31         ` Quentin Monnet
2022-05-18 23:54           ` Daniel Müller
2022-05-19  3:08           ` Dave Thaler
2022-05-16 17:35 ` [PATCH bpf-next 10/12] libbpf: Introduce libbpf_bpf_link_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 11/12] selftests/bpf: Add test for libbpf_bpf_link_type_str Daniel Müller
2022-05-16 17:35 ` [PATCH bpf-next 12/12] bpftool: Use libbpf_bpf_link_type_str Daniel Müller
2022-05-16 23:43 ` [PATCH bpf-next 00/12] libbpf: Textual representation of enums Andrii Nakryiko
2022-05-17 18:59   ` Daniel Müller
2022-05-17  6:42 ` Yonghong Song

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=CAEf4BzYXxSerQnw3U5SKU10HAbM1KrTj9z_DvX+tQqaq7+2CUQ@mail.gmail.com \
    --to=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=deso@posteo.net \
    --cc=kernel-team@fb.com \
    --cc=quentin@isovalent.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.