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 bpf-next 4/7] bpftool: use preferred setters/getters instead of deprecated ones
Date: Thu, 20 Jan 2022 16:41:12 -0800 [thread overview]
Message-ID: <20220121004115.3845888-5-andrii@kernel.org> (raw)
In-Reply-To: <20220121004115.3845888-1-andrii@kernel.org>
Use bpf_program__type() instead of discouraged bpf_program__get_type().
Also switch to bpf_map__set_max_entries() instead of bpf_map__resize().
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
tools/bpf/bpftool/gen.c | 2 +-
tools/bpf/bpftool/prog.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index 43e3f8700ecc..8f78c27d41f0 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -378,7 +378,7 @@ static void codegen_attach_detach(struct bpf_object *obj, const char *obj_name)
int prog_fd = skel->progs.%2$s.prog_fd; \n\
", obj_name, bpf_program__name(prog));
- switch (bpf_program__get_type(prog)) {
+ switch (bpf_program__type(prog)) {
case BPF_PROG_TYPE_RAW_TRACEPOINT:
tp_name = strchr(bpf_program__section_name(prog), '/') + 1;
printf("\tint fd = bpf_raw_tracepoint_open(\"%s\", prog_fd);\n", tp_name);
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index cf935c63e6f5..87593f98d2d1 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -2283,10 +2283,10 @@ static int do_profile(int argc, char **argv)
profile_obj->rodata->num_metric = num_metric;
/* adjust map sizes */
- bpf_map__resize(profile_obj->maps.events, num_metric * num_cpu);
- bpf_map__resize(profile_obj->maps.fentry_readings, num_metric);
- bpf_map__resize(profile_obj->maps.accum_readings, num_metric);
- bpf_map__resize(profile_obj->maps.counts, 1);
+ bpf_map__set_max_entries(profile_obj->maps.events, num_metric * num_cpu);
+ bpf_map__set_max_entries(profile_obj->maps.fentry_readings, num_metric);
+ bpf_map__set_max_entries(profile_obj->maps.accum_readings, num_metric);
+ bpf_map__set_max_entries(profile_obj->maps.counts, 1);
/* change target name */
profile_tgt_name = profile_target_name(profile_tgt_fd);
--
2.30.2
next prev parent reply other threads:[~2022-01-21 0:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-21 0:41 [PATCH bpf-next 0/7] libbpf: deprecate some setter and getter APIs Andrii Nakryiko
2022-01-21 0:41 ` [PATCH bpf-next 1/7] libbpf: hide and discourage inconsistently named getters Andrii Nakryiko
2022-01-21 0:41 ` [PATCH bpf-next 2/7] libbpf: deprecate bpf_map__resize() Andrii Nakryiko
2022-01-21 0:43 ` Andrii Nakryiko
2022-01-21 0:41 ` [PATCH bpf-next 3/7] libbpf: deprecate bpf_program__is_<type>() and bpf_program__set_<type>() APIs Andrii Nakryiko
2022-01-21 0:41 ` Andrii Nakryiko [this message]
2022-01-21 0:41 ` [PATCH bpf-next 5/7] selftests/bpf: use preferred setter/getter APIs instead of deprecated ones Andrii Nakryiko
2022-01-21 0:41 ` [PATCH bpf-next 6/7] samples/bpf: use preferred getters/setters " Andrii Nakryiko
2022-01-21 0:41 ` [PATCH 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=20220121004115.3845888-5-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).