[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHap4zsH97nNA8KSVeeKGxgfoh8bfno0jd0m45UH8CJN_trXbw@mail.gmail.com>
Date: Fri, 21 Jan 2022 15:44:39 -0500
From: Mauricio Vásquez Bernal <mauricio@...volk.io>
To: Andrii Nakryiko <andrii.nakryiko@...il.com>
Cc: Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Quentin Monnet <quentin@...valent.com>,
Rafael David Tinoco <rafaeldtinoco@...il.com>,
Lorenzo Fontana <lorenzo.fontana@...stic.co>,
Leonardo Di Donato <leonardo.didonato@...stic.co>
Subject: Re: [PATCH bpf-next v4 3/8] bpftool: Add gen btf command
On Fri, Jan 14, 2022 at 9:09 PM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Wed, Jan 12, 2022 at 6:27 AM Mauricio Vásquez <mauricio@...volk.io> wrote:
> >
> > This command is implemented under the "gen" command in bpftool and the
> > syntax is the following:
> >
> > $ bpftool gen btf INPUT OUTPUT OBJECT(S)
>
> "gen btf" doesn't really convey that it's a minimized BTF for CO-RE,
> maybe let's do something more verbose but also more precise, it's not
> like this is going to be used by everyone multiple times a day, so
> verboseness is not a bad thing here. Naming is hard, but something
> like `bpftool gen min_core_btf` probably would give a bit better
> pointer as to what this command is doing (minimal CO-RE BTF, right?)
>
I agree. `bpftool gen min_core_btf` seems just fine to us.
> >
> > INPUT can be either a single BTF file or a folder containing BTF files,
> > when it's a folder, a BTF file is generated for each BTF file contained
> > in this folder. OUTPUT is the file (or folder) where generated files are
> > stored and OBJECT(S) is the list of bpf objects we want to generate the
> > BTF file(s) for (each generated BTF file contains all the types needed
> > by all the objects).
> >
> > Signed-off-by: Mauricio Vásquez <mauricio@...volk.io>
> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@...asec.com>
> > Signed-off-by: Lorenzo Fontana <lorenzo.fontana@...stic.co>
> > Signed-off-by: Leonardo Di Donato <leonardo.didonato@...stic.co>
> > ---
> > tools/bpf/bpftool/gen.c | 117 ++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 117 insertions(+)
> >
>
> [...]
>
> > +
> > + while ((dir = readdir(d)) != NULL) {
> > + if (dir->d_type != DT_REG)
> > + continue;
> > +
> > + if (strncmp(dir->d_name + strlen(dir->d_name) - 4, ".btf", 4))
> > + continue;
> > +
> > + snprintf(src_btf_path, sizeof(src_btf_path), "%s/%s", input, dir->d_name);
> > + snprintf(dst_btf_path, sizeof(dst_btf_path), "%s/%s", output, dir->d_name);
> > +
> > + printf("SBTF: %s\n", src_btf_path);
>
> What's SBTF? Is this part of bpftool "protocol" now? It should be
> something a bit more meaningful...
>
These are almost debug leftovers. I updated them to be more meaningful.
> > +
> > + err = btfgen(src_btf_path, dst_btf_path, objs);
> > + if (err)
> > + goto out;
> > + }
> > +
> > +out:
> > + if (!err)
> > + printf("STAT: done!\n");
>
> similar, STAT? what's that? Do we need "done!" message in tool's output?
>
> > + free(objs);
> > + closedir(d);
> > + return err;
> > +}
> > +
> > static const struct cmd cmds[] = {
> > { "object", do_object },
> > { "skeleton", do_skeleton },
> > + { "btf", do_gen_btf},
> > { "help", do_help },
> > { 0 }
> > };
> > --
> > 2.25.1
> >
Powered by blists - more mailing lists