bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Mauricio Vásquez Bernal" <mauricio@kinvolk.io>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Networking <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Quentin Monnet <quentin@isovalent.com>,
	Rafael David Tinoco <rafaeldtinoco@gmail.com>,
	Lorenzo Fontana <lorenzo.fontana@elastic.co>,
	Leonardo Di Donato <leonardo.didonato@elastic.co>
Subject: Re: [PATCH bpf-next v6 6/7] bpftool: gen min_core_btf explanation and examples
Date: Tue, 15 Feb 2022 17:56:36 -0500	[thread overview]
Message-ID: <CAHap4ztLNVm81jchDkAe15UybKRCFEJNci-BFFCRQf86iW_pVw@mail.gmail.com> (raw)
In-Reply-To: <CAEf4BzYp4bCBYrbXGw75x6WFqM_k6Bhy3D73hR9TR1O8S7gXcQ@mail.gmail.com>

On Fri, Feb 11, 2022 at 7:42 PM Andrii Nakryiko
<andrii.nakryiko@gmail.com> wrote:
>
> On Wed, Feb 9, 2022 at 2:27 PM Mauricio Vásquez <mauricio@kinvolk.io> wrote:
> >
> > From: Rafael David Tinoco <rafaeldtinoco@gmail.com>
> >
> > Add "min_core_btf" feature explanation and one example of how to use it
> > to bpftool-gen man page.
> >
> > Signed-off-by: Mauricio Vásquez <mauricio@kinvolk.io>
> > Signed-off-by: Rafael David Tinoco <rafael.tinoco@aquasec.com>
> > Signed-off-by: Lorenzo Fontana <lorenzo.fontana@elastic.co>
> > Signed-off-by: Leonardo Di Donato <leonardo.didonato@elastic.co>
> > ---
> >  .../bpf/bpftool/Documentation/bpftool-gen.rst | 93 +++++++++++++++++++
> >  1 file changed, 93 insertions(+)
> >
>
> [...]
>
> > +Now, the "5.4.0-smaller.btf" file may be used by libbpf as an external BTF file
> > +when loading the "one.bpf.o" object into the "5.4.0-example" kernel. Note that
> > +the generated BTF file won't allow other eBPF objects to be loaded, just the
> > +ones given to min_core_btf.
> > +
> > +::
> > +
> > +  struct bpf_object *obj = NULL;
> > +  struct bpf_object_open_opts openopts = {};
> > +
> > +  openopts.sz = sizeof(struct bpf_object_open_opts);
> > +  openopts.btf_custom_path = "./5.4.0-smaller.btf";
> > +
> > +  obj = bpf_object__open_file("./one.bpf.o", &openopts);
>
> Can you please use LIBBPF_OPTS() macro in the example, that's how
> users are normally expected to use OPTS-based APIs anyways. Also there
> is no need for "./" when specifying file location. This is a different
> case than running a binary in the shell, where binary is searched in
> PATH. This is never done when opening files.
>
> So all this should be:
>
> LIBBPF_OPTS(bpf_object_open_opts, opts, .btf_custom_path = "5.4.0-smaller.btf");
> struct bpf_object *obj;
>

I suppose you meant DECLARE_LIBBPF_OPTS(...)

> obj = bpf_object__open_file("one.bpf.o", &opts);
>
> That's all.
>
>
> > +
> > +  ...
> > --
> > 2.25.1
> >

  reply	other threads:[~2022-02-15 22:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 22:26 [PATCH bpf-next v6 0/7] libbpf: Implement BTFGen Mauricio Vásquez
2022-02-09 22:26 ` [PATCH bpf-next v6 1/7] libbpf: split bpf_core_apply_relo() Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-09 22:26 ` [PATCH bpf-next v6 2/7] libbpf: Expose bpf_core_{add,free}_cands() to bpftool Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-09 22:26 ` [PATCH bpf-next v6 3/7] bpftool: Add gen min_core_btf command Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-09 22:26 ` [PATCH bpf-next v6 4/7] bpftool: Implement minimize_btf() and relocations recording for BTFGen Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-15 22:56     ` Mauricio Vásquez Bernal
2022-02-16  1:23       ` Andrii Nakryiko
2022-02-09 22:26 ` [PATCH bpf-next v6 5/7] bpftool: Implement btfgen_get_btf() Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-15 22:56     ` Mauricio Vásquez Bernal
2022-02-09 22:26 ` [PATCH bpf-next v6 6/7] bpftool: gen min_core_btf explanation and examples Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-15 22:56     ` Mauricio Vásquez Bernal [this message]
2022-02-16  1:26       ` Andrii Nakryiko
2022-02-09 22:26 ` [PATCH bpf-next v6 7/7] selftests/bpf: Test "bpftool gen min_core_btf" Mauricio Vásquez
2022-02-12  0:42   ` Andrii Nakryiko
2022-02-15 22:56     ` Mauricio Vásquez Bernal

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=CAHap4ztLNVm81jchDkAe15UybKRCFEJNci-BFFCRQf86iW_pVw@mail.gmail.com \
    --to=mauricio@kinvolk.io \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=leonardo.didonato@elastic.co \
    --cc=lorenzo.fontana@elastic.co \
    --cc=netdev@vger.kernel.org \
    --cc=quentin@isovalent.com \
    --cc=rafaeldtinoco@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).