* [PATCH RESEND mptcp-next] bpf: examples: fix libbpf 0.7 deprecated warnings
@ 2022-02-22 6:21 Geliang Tang
2022-02-23 0:39 ` Mat Martineau
0 siblings, 1 reply; 2+ messages in thread
From: Geliang Tang @ 2022-02-22 6:21 UTC (permalink / raw)
To: mptcp; +Cc: Geliang Tang
This patch fixed the following deprecated warnings:
loader.c:136:10: warning: 'bpf_program__next' is deprecated: libbpf v0.7+: use bpf_object__next_program() instead [-Wdeprecated-declarations]
prog = bpf_program__next(prog, object_file);
^
tools/lib/bpf/libbpf.h:265:12: note: 'bpf_program__next' has been explicitly marked deprecated here
LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_program() instead")
^
tools/lib/bpf/libbpf_common.h:24:4: note: expanded from macro 'LIBBPF_DEPRECATED_SINCE'
(LIBBPF_DEPRECATED("libbpf v" # major "." # minor "+: " msg))
^
tools/lib/bpf/libbpf_common.h:19:47: note: expanded from macro 'LIBBPF_DEPRECATED'
^
loader.c:139:18: warning: 'bpf_program__title' is deprecated: BPF program title is confusing term; please use bpf_program__section_name() instead [-Wdeprecated-declarations]
name = (char*) bpf_program__title(prog, false);
^
tools/lib/bpf/libbpf.h:294:12: note: 'bpf_program__title' has been explicitly marked deprecated here
LIBBPF_API LIBBPF_DEPRECATED("BPF program title is confusing term; please use bpf_program__section_name() instead")
^
tools/lib/bpf/libbpf_common.h:19:47: note: expanded from macro 'LIBBPF_DEPRECATED'
^
2 warnings generated.
mptcp_set_sf_sockopt_kern.c:19:8: warning: 'bpf_map_def' is deprecated: use BTF-defined maps in .maps section [-Wdeprecated-declarations]
struct bpf_map_def SEC("maps") mptcp_sf = {
^
tools/lib/bpf/bpf_helpers.h:136:18: note: 'bpf_map_def' has been explicitly marked deprecated here
} __attribute__((deprecated("use BTF-defined maps in .maps section")));
^
1 warning generated.
Signed-off-by: Geliang Tang <geliang.tang@suse.com>
---
RESEND:
- update the subject prefix from "bpf: example:" to "bpf: examples:"
---
bpf/examples/loader.c | 4 ++--
bpf/examples/mptcp_set_sf_sockopt_kern.c | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/bpf/examples/loader.c b/bpf/examples/loader.c
index 6a87aa9555c8..c4f8e85585b5 100644
--- a/bpf/examples/loader.c
+++ b/bpf/examples/loader.c
@@ -133,10 +133,10 @@ int main(int argc, const char **argv)
LIBBPF_ERROR_WRAPPER(ret, "failed to load programs from object file");
do {
- prog = bpf_program__next(prog, object_file);
+ prog = bpf_object__next_program(object_file, prog);
if (!prog) break;
- name = (char*) bpf_program__title(prog, false);
+ name = (char *)bpf_program__section_name(prog);
switch(bpf_program__get_expected_attach_type(prog)) {
case BPF_CGROUP_SOCK_OPS:
diff --git a/bpf/examples/mptcp_set_sf_sockopt_kern.c b/bpf/examples/mptcp_set_sf_sockopt_kern.c
index 4079ce197e83..6c8231d21ad8 100644
--- a/bpf/examples/mptcp_set_sf_sockopt_kern.c
+++ b/bpf/examples/mptcp_set_sf_sockopt_kern.c
@@ -16,12 +16,12 @@ char _license[] SEC("license") = "GPL";
char cc [TCP_CA_NAME_MAX] = "vegas";
/* Associate a subflow counter to each token */
-struct bpf_map_def SEC("maps") mptcp_sf = {
- .type = BPF_MAP_TYPE_HASH,
- .key_size = sizeof(__u32),
- .value_size = sizeof(__u32),
- .max_entries = 100
-};
+struct {
+ __uint(type, BPF_MAP_TYPE_HASH);
+ __uint(key_size, sizeof(__u32));
+ __uint(value_size, sizeof(__u32));
+ __uint(max_entries, 100);
+} mptcp_sf SEC(".maps");
#define DEBUG 1
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND mptcp-next] bpf: examples: fix libbpf 0.7 deprecated warnings
2022-02-22 6:21 [PATCH RESEND mptcp-next] bpf: examples: fix libbpf 0.7 deprecated warnings Geliang Tang
@ 2022-02-23 0:39 ` Mat Martineau
0 siblings, 0 replies; 2+ messages in thread
From: Mat Martineau @ 2022-02-23 0:39 UTC (permalink / raw)
To: Geliang Tang; +Cc: mptcp
On Tue, 22 Feb 2022, Geliang Tang wrote:
> This patch fixed the following deprecated warnings:
>
> loader.c:136:10: warning: 'bpf_program__next' is deprecated: libbpf v0.7+: use bpf_object__next_program() instead [-Wdeprecated-declarations]
> prog = bpf_program__next(prog, object_file);
> ^
> tools/lib/bpf/libbpf.h:265:12: note: 'bpf_program__next' has been explicitly marked deprecated here
> LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_program() instead")
> ^
> tools/lib/bpf/libbpf_common.h:24:4: note: expanded from macro 'LIBBPF_DEPRECATED_SINCE'
> (LIBBPF_DEPRECATED("libbpf v" # major "." # minor "+: " msg))
> ^
> tools/lib/bpf/libbpf_common.h:19:47: note: expanded from macro 'LIBBPF_DEPRECATED'
> ^
> loader.c:139:18: warning: 'bpf_program__title' is deprecated: BPF program title is confusing term; please use bpf_program__section_name() instead [-Wdeprecated-declarations]
> name = (char*) bpf_program__title(prog, false);
> ^
> tools/lib/bpf/libbpf.h:294:12: note: 'bpf_program__title' has been explicitly marked deprecated here
> LIBBPF_API LIBBPF_DEPRECATED("BPF program title is confusing term; please use bpf_program__section_name() instead")
> ^
> tools/lib/bpf/libbpf_common.h:19:47: note: expanded from macro 'LIBBPF_DEPRECATED'
> ^
> 2 warnings generated.
> mptcp_set_sf_sockopt_kern.c:19:8: warning: 'bpf_map_def' is deprecated: use BTF-defined maps in .maps section [-Wdeprecated-declarations]
> struct bpf_map_def SEC("maps") mptcp_sf = {
> ^
> tools/lib/bpf/bpf_helpers.h:136:18: note: 'bpf_map_def' has been explicitly marked deprecated here
> } __attribute__((deprecated("use BTF-defined maps in .maps section")));
> ^
> 1 warning generated.
>
> Signed-off-by: Geliang Tang <geliang.tang@suse.com>
> ---
> RESEND:
> - update the subject prefix from "bpf: example:" to "bpf: examples:"
> ---
> bpf/examples/loader.c | 4 ++--
> bpf/examples/mptcp_set_sf_sockopt_kern.c | 12 ++++++------
> 2 files changed, 8 insertions(+), 8 deletions(-)
Hi Geliang -
Oh, this is for the scripts branch.
Can you also update bpf/examples/Makefile to make it easier to build this
example on a system that has libbpf 0.7 and its headers built in a kernel
tree but not installed systemwide?
Thanks,
Mat
>
> diff --git a/bpf/examples/loader.c b/bpf/examples/loader.c
> index 6a87aa9555c8..c4f8e85585b5 100644
> --- a/bpf/examples/loader.c
> +++ b/bpf/examples/loader.c
> @@ -133,10 +133,10 @@ int main(int argc, const char **argv)
> LIBBPF_ERROR_WRAPPER(ret, "failed to load programs from object file");
>
> do {
> - prog = bpf_program__next(prog, object_file);
> + prog = bpf_object__next_program(object_file, prog);
> if (!prog) break;
>
> - name = (char*) bpf_program__title(prog, false);
> + name = (char *)bpf_program__section_name(prog);
>
> switch(bpf_program__get_expected_attach_type(prog)) {
> case BPF_CGROUP_SOCK_OPS:
> diff --git a/bpf/examples/mptcp_set_sf_sockopt_kern.c b/bpf/examples/mptcp_set_sf_sockopt_kern.c
> index 4079ce197e83..6c8231d21ad8 100644
> --- a/bpf/examples/mptcp_set_sf_sockopt_kern.c
> +++ b/bpf/examples/mptcp_set_sf_sockopt_kern.c
> @@ -16,12 +16,12 @@ char _license[] SEC("license") = "GPL";
> char cc [TCP_CA_NAME_MAX] = "vegas";
>
> /* Associate a subflow counter to each token */
> -struct bpf_map_def SEC("maps") mptcp_sf = {
> - .type = BPF_MAP_TYPE_HASH,
> - .key_size = sizeof(__u32),
> - .value_size = sizeof(__u32),
> - .max_entries = 100
> -};
> +struct {
> + __uint(type, BPF_MAP_TYPE_HASH);
> + __uint(key_size, sizeof(__u32));
> + __uint(value_size, sizeof(__u32));
> + __uint(max_entries, 100);
> +} mptcp_sf SEC(".maps");
>
> #define DEBUG 1
>
> --
> 2.34.1
>
>
>
--
Mat Martineau
Intel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-23 0:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 6:21 [PATCH RESEND mptcp-next] bpf: examples: fix libbpf 0.7 deprecated warnings Geliang Tang
2022-02-23 0:39 ` Mat Martineau
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.