Re: [PATCH bpf-next 2/7] libbpf: deprecate bpf_map__resize()

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

 



On Thu, Jan 20, 2022 at 4:41 PM Andrii Nakryiko <andrii@xxxxxxxxxx> wrote:
>
> Deprecated bpf_map__resize() in favor of bpf_map__set_max_entries()
> setter. In addition to having a surprising name (users often don't
> realize that they need to use bpf_map__resize()), the name also implies
> some magic way of resizing BPF map after it is created, which is clearly
> not the case.
>
> Another minor annoyance is that bpf_map__resize() disallows 0 value for
> max_entries, which in some cases is totally acceptable (e.g., like for
> BPF perf buf case to let libbpf auto-create one buffer per each
> available CPU core).
>
>   [0] https://github.com/libbpf/libbpf/issues/304

This is supposed to have Closes: there. I'll fix it in the next
revision after waiting for any comments.

>
> Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx>
> ---
>  tools/lib/bpf/libbpf.h | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> index dbf37c0fa531..6f8e6b3cff84 100644
> --- a/tools/lib/bpf/libbpf.h
> +++ b/tools/lib/bpf/libbpf.h
> @@ -716,6 +716,7 @@ LIBBPF_API int bpf_map__set_type(struct bpf_map *map, enum bpf_map_type type);
>  /* get/set map size (max_entries) */
>  LIBBPF_API __u32 bpf_map__max_entries(const struct bpf_map *map);
>  LIBBPF_API int bpf_map__set_max_entries(struct bpf_map *map, __u32 max_entries);
> +LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_map__set_max_entries() instead")
>  LIBBPF_API int bpf_map__resize(struct bpf_map *map, __u32 max_entries);
>  /* get/set map flags */
>  LIBBPF_API __u32 bpf_map__map_flags(const struct bpf_map *map);
> --
> 2.30.2
>



[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