bpf/examples/loader.c | 4 ++-- bpf/examples/mptcp_set_sf_sockopt_kern.c | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-)
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>
---
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
© 2016 - 2024 Red Hat, Inc.