[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAEf4BzajXLe7Yx+r024A9bhaR6Dwy+t+n2sqA=8NXQ9m0sp1mQ@mail.gmail.com>
Date: Sun, 18 Jul 2021 14:30:20 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andriin@...com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...omium.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alan Maguire <alan.maguire@...cle.com>
Subject: Re: [PATCHv4 bpf-next 6/8] libbpf: Add bpf_program__attach_kprobe_opts
function
On Sun, Jul 18, 2021 at 12:32 PM Jiri Olsa <jolsa@...hat.com> wrote:
>
> On Fri, Jul 16, 2021 at 06:41:59PM -0700, Andrii Nakryiko wrote:
> > On Wed, Jul 14, 2021 at 2:45 AM Jiri Olsa <jolsa@...hat.com> wrote:
> > >
> > > Adding bpf_program__attach_kprobe_opts that does the same
> > > as bpf_program__attach_kprobe, but takes opts argument.
> > >
> > > Currently opts struct holds just retprobe bool, but we will
> > > add new field in following patch.
> > >
> > > The function is not exported, so there's no need to add
> > > size to the struct bpf_program_attach_kprobe_opts for now.
> >
> > Why not exported? Please use a proper _opts struct just like others
> > (e.g., bpf_object_open_opts) and add is as a public API, it's a useful
> > addition. We are going to have a similar structure for attach_uprobe,
> > btw. Please send a follow up patch.
>
> there's no outside user.. ok
because there is no API :) I've seen people asking about the ability
to attach to kprobe+offset in some PRs.
>
> >
> > >
> > > Signed-off-by: Jiri Olsa <jolsa@...nel.org>
> > > ---
> > > tools/lib/bpf/libbpf.c | 34 +++++++++++++++++++++++++---------
> > > 1 file changed, 25 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
> > > index 88b99401040c..d93a6f9408d1 100644
> > > --- a/tools/lib/bpf/libbpf.c
> > > +++ b/tools/lib/bpf/libbpf.c
> > > @@ -10346,19 +10346,24 @@ static int perf_event_open_probe(bool uprobe, bool retprobe, const char *name,
> > > return pfd;
> > > }
> > >
> > > -struct bpf_link *bpf_program__attach_kprobe(struct bpf_program *prog,
> > > - bool retprobe,
> > > - const char *func_name)
> > > +struct bpf_program_attach_kprobe_opts {
> >
> > when you make it part of libbpf API, let's call it something shorter,
> > like bpf_kprobe_opts, maybe? And later we'll have bpf_uprobe_opts for
> > uprobes. Short and unambiguous.
>
> ok
>
> jirka
>
> >
> > > + bool retprobe;
> > > +};
> > > +
> > > +static struct bpf_link*
> > > +bpf_program__attach_kprobe_opts(struct bpf_program *prog,
> > > + const char *func_name,
> > > + struct bpf_program_attach_kprobe_opts *opts)
> > > {
> > > char errmsg[STRERR_BUFSIZE];
> > > struct bpf_link *link;
> > > int pfd, err;
> > >
> >
> > [...]
> >
>
Powered by blists - more mailing lists