diff options
author | Alexei Starovoitov <ast@kernel.org> | 2021-12-03 02:08:37 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2021-12-03 02:23:41 +0300 |
commit | 080a70b21f476b39ad66524c0ce0729972c61a10 (patch) | |
tree | dad6591838a9b35d8414ed4e80d0763b02ff2287 /tools/lib/bpf | |
parent | 8b4ff5f8bb126fa8ee6918f4854748277609cf68 (diff) | |
parent | c93faaaf2f67ba5396840316651cdc7640d9fa9e (diff) | |
download | linux-080a70b21f476b39ad66524c0ce0729972c61a10.tar.xz |
Merge branch 'Deprecate bpf_prog_load_xattr() API'
Andrii Nakryiko says:
====================
Few lines in the last patch to mark bpf_prog_load_xattr() deprecated required
a decent amount of clean ups in all the other patches. samples/bpf is big part
of the clean up.
This patch set also bumps libbpf version to 0.7, as libbpf v0.6 release will
be cut shortly.
====================
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf')
-rw-r--r-- | tools/lib/bpf/bpf.h | 8 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf.c | 14 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf.h | 3 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf.map | 6 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf_common.h | 5 | ||||
-rw-r--r-- | tools/lib/bpf/libbpf_version.h | 2 |
6 files changed, 33 insertions, 5 deletions
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h index 70b6f44fc8b0..f79e5fbcf1c1 100644 --- a/tools/lib/bpf/bpf.h +++ b/tools/lib/bpf/bpf.h @@ -43,12 +43,12 @@ struct bpf_map_create_opts { __u32 btf_value_type_id; __u32 btf_vmlinux_value_type_id; - int inner_map_fd; - int map_flags; + __u32 inner_map_fd; + __u32 map_flags; __u64 map_extra; - int numa_node; - int map_ifindex; + __u32 numa_node; + __u32 map_ifindex; }; #define bpf_map_create_opts__last_field map_ifindex diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 1341ce539662..de260c94e418 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -8475,6 +8475,20 @@ int bpf_program__set_flags(struct bpf_program *prog, __u32 flags) return 0; } +__u32 bpf_program__log_level(const struct bpf_program *prog) +{ + return prog->log_level; +} + +int bpf_program__set_log_level(struct bpf_program *prog, __u32 log_level) +{ + if (prog->obj->loaded) + return libbpf_err(-EBUSY); + + prog->log_level = log_level; + return 0; +} + #define SEC_DEF(sec_pfx, ptype, atype, flags, ...) { \ .sec = sec_pfx, \ .prog_type = BPF_PROG_TYPE_##ptype, \ diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index d02139fec4ac..c0d62dd37c5d 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -499,6 +499,8 @@ bpf_program__set_expected_attach_type(struct bpf_program *prog, LIBBPF_API __u32 bpf_program__flags(const struct bpf_program *prog); LIBBPF_API int bpf_program__set_flags(struct bpf_program *prog, __u32 flags); +LIBBPF_API __u32 bpf_program__log_level(const struct bpf_program *prog); +LIBBPF_API int bpf_program__set_log_level(struct bpf_program *prog, __u32 log_level); LIBBPF_API int bpf_program__set_attach_target(struct bpf_program *prog, int attach_prog_fd, @@ -680,6 +682,7 @@ struct bpf_prog_load_attr { int prog_flags; }; +LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open() and bpf_object__load() instead") LIBBPF_API int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr, struct bpf_object **pobj, int *prog_fd); LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__open() and bpf_object__load() instead") diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map index 623002b83b2b..715df3a27389 100644 --- a/tools/lib/bpf/libbpf.map +++ b/tools/lib/bpf/libbpf.map @@ -419,3 +419,9 @@ LIBBPF_0.6.0 { perf_buffer__new_raw; perf_buffer__new_raw_deprecated; } LIBBPF_0.5.0; + +LIBBPF_0.7.0 { + global: + bpf_program__log_level; + bpf_program__set_log_level; +}; diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h index b21cefc9c3b6..000e37798ff2 100644 --- a/tools/lib/bpf/libbpf_common.h +++ b/tools/lib/bpf/libbpf_common.h @@ -40,6 +40,11 @@ #else #define __LIBBPF_MARK_DEPRECATED_0_7(X) #endif +#if __LIBBPF_CURRENT_VERSION_GEQ(0, 8) +#define __LIBBPF_MARK_DEPRECATED_0_8(X) X +#else +#define __LIBBPF_MARK_DEPRECATED_0_8(X) +#endif /* This set of internal macros allows to do "function overloading" based on * number of arguments provided by used in backwards-compatible way during the diff --git a/tools/lib/bpf/libbpf_version.h b/tools/lib/bpf/libbpf_version.h index dd56d76f291c..0fefefc3500b 100644 --- a/tools/lib/bpf/libbpf_version.h +++ b/tools/lib/bpf/libbpf_version.h @@ -4,6 +4,6 @@ #define __LIBBPF_VERSION_H #define LIBBPF_MAJOR_VERSION 0 -#define LIBBPF_MINOR_VERSION 6 +#define LIBBPF_MINOR_VERSION 7 #endif /* __LIBBPF_VERSION_H */ |