lkml.org 
[lkml]   [2022]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] perf tools: Remove bpf_map__set_priv/bpf_map__priv usage
On Thu, Feb 17, 2022 at 01:49:39PM -0800, Andrii Nakryiko wrote:
> On Thu, Feb 17, 2022 at 5:19 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > Both bpf_map__set_priv/bpf_map__priv are deprecated
> > and will be eventually removed.
> >
> > Using hashmap to replace that functionality.
> >
> > Suggested-by: Andrii Nakryiko <andrii@kernel.org>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/perf/util/bpf-loader.c | 62 ++++++++++++++++++++++++++++++++----
> > 1 file changed, 55 insertions(+), 7 deletions(-)
> >
>
> [...]
>
> > +static int map_set_priv(struct bpf_map *map, void *priv)
> > +{
> > + void *old_priv;
> > +
> > + if (!bpf_map_hash) {
> > + bpf_map_hash = hashmap__new(ptr_hash, ptr_equal, NULL);
> > + if (!bpf_map_hash)
>
> same as in previous patch, on error this is not going to be NULL

yes, will change

jirka

>
> > + return -ENOMEM;
> > + }
> > +
> > + old_priv = map_priv(map);
> > + if (old_priv) {
> > + bpf_map_priv__clear(map, old_priv);
> > + return hashmap__set(bpf_map_hash, map, priv, NULL, NULL);
> > + }
> > + return hashmap__add(bpf_map_hash, map, priv);
> > +}
> > +
>
> [...]

\
 
 \ /
  Last update: 2022-02-18 10:02    [W:2.282 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site