All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH v2 bpf-next 2/7] libbpf: deprecate bpf_map__resize()
Date: Mon, 24 Jan 2022 11:42:49 -0800	[thread overview]
Message-ID: <20220124194254.2051434-3-andrii@kernel.org> (raw)
In-Reply-To: <20220124194254.2051434-1-andrii@kernel.org>

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] Closes: https://github.com/libbpf/libbpf/issues/304

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 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 c89d9b4456fd..9cff3e615cd3 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


  parent reply	other threads:[~2022-01-24 19:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-24 19:42 [PATCH v2 bpf-next 0/7] libbpf: deprecate some setter and getter APIs Andrii Nakryiko
2022-01-24 19:42 ` [PATCH v2 bpf-next 1/7] libbpf: hide and discourage inconsistently named getters Andrii Nakryiko
2022-01-24 19:42 ` Andrii Nakryiko [this message]
2022-01-24 19:42 ` [PATCH v2 bpf-next 3/7] libbpf: deprecate bpf_program__is_<type>() and bpf_program__set_<type>() APIs Andrii Nakryiko
2022-01-24 19:42 ` [PATCH v2 bpf-next 4/7] bpftool: use preferred setters/getters instead of deprecated ones Andrii Nakryiko
2022-01-24 19:42 ` [PATCH v2 bpf-next 5/7] selftests/bpf: use preferred setter/getter APIs " Andrii Nakryiko
2022-01-24 19:42 ` [PATCH v2 bpf-next 6/7] samples/bpf: use preferred getters/setters " Andrii Nakryiko
2022-01-24 19:42 ` [PATCH v2 bpf-next 7/7] perf: use generic bpf_program__set_type() to set BPF prog type Andrii Nakryiko

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=20220124194254.2051434-3-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.