Re: [PATCH bpf-next 3/5] perf: stop using bpf_map__def() API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jan 5, 2022 at 3:01 PM Christy Lee <christylee@xxxxxx> wrote:
>
> libbpf bpf_map__def() API is being deprecated, replace bpftool's
> usage with the appropriate getters and setters.
>
> Signed-off-by: Christy Lee <christylee@xxxxxx>
> ---
>  tools/perf/util/bpf-loader.c | 58 ++++++++++++++++--------------------
>  tools/perf/util/bpf_map.c    | 28 ++++++++---------
>  2 files changed, 39 insertions(+), 47 deletions(-)
>

[...]

> @@ -1304,7 +1296,7 @@ bpf_map_config_foreach_key(struct bpf_map *map,
>                            map_config_func_t func,
>                            void *arg)
>  {
> -       int err, map_fd;
> +       int err, map_fd, type;
>         struct bpf_map_op *op;
>         const struct bpf_map_def *def;

missed this one and another bpf_map__def()? A small pro tip is after
marking some API as deprecated since v0.8 (for example), locally mark
it as deprecated since 0.6 or 0.7 (current or older version) and build
all the typical suspects (perf, bpftool, selftests, etc) to let
compiler complain about any missed references.

>         const char *name = bpf_map__name(map);
> @@ -1330,19 +1322,19 @@ bpf_map_config_foreach_key(struct bpf_map *map,
>                 return map_fd;
>         }
>
> +       type = bpf_map__type(map);
>         list_for_each_entry(op, &priv->ops_list, list) {
> -               switch (def->type) {
> +               switch (type) {
>                 case BPF_MAP_TYPE_ARRAY:
>                 case BPF_MAP_TYPE_PERF_EVENT_ARRAY:
>                         switch (op->key_type) {
>                         case BPF_MAP_KEY_ALL:
>                                 err = foreach_key_array_all(func, arg, name,
> -                                                           map_fd, def, op);
> +                                               map_fd, map, op);

double check argument indentation

>                                 break;
>                         case BPF_MAP_KEY_RANGES:
>                                 err = foreach_key_array_ranges(func, arg, name,
> -                                                              map_fd, def,
> -                                                              op);
> +                                               map_fd, map, op);

and here


>                                 break;
>                         default:
>                                 pr_debug("ERROR: keytype for map '%s' invalid\n",

[...]



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux