diff mbox series

[bpf-next] libbpf: deprecate btf_ext rec_size APIs

Message ID 20220127182154.751999-1-davemarchevsky@fb.com (mailing list archive)
State Superseded
Delegated to: BPF
Headers show
Series [bpf-next] libbpf: deprecate btf_ext rec_size APIs | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 6 maintainers not CCed: kpsingh@kernel.org john.fastabend@gmail.com kafai@fb.com songliubraving@fb.com yhs@fb.com netdev@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: Prefer using '"%s...", __func__' to using 'btf_ext__reloc_line_info', this function's name, in a string WARNING: line length of 121 exceeds 80 columns
netdev/kdoc success Errors and warnings before: 12 this patch: 12
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next success VM_Test

Commit Message

Dave Marchevsky Jan. 27, 2022, 6:21 p.m. UTC
btf_ext__{func,line}_info_rec_size functions are used in conjunction
with already-deprecated btf_ext__reloc_{func,line}_info functions. Since
struct btf_ext is opaque to the user it was necessary to expose rec_size
getters in the past.

btf_ext__reloc_{func,line}_info were deprecated in commit 8505e8709b5ee
("libbpf: Implement generalized .BTF.ext func/line info adjustment")
as they're not compatible with support for multiple programs per
section. It was decided[0] that users of these APIs should implement their
own .btf.ext parsing to access this data, in which case the rec_size
getters are unnecessary. So deprecate them from libbpf 0.7.0 onwards.

  [0] Closes: https://github.com/libbpf/libbpf/issues/277

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
---
 tools/lib/bpf/btf.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Daniel Borkmann Jan. 28, 2022, 1:17 p.m. UTC | #1
On 1/27/22 7:21 PM, Dave Marchevsky wrote:
> btf_ext__{func,line}_info_rec_size functions are used in conjunction
> with already-deprecated btf_ext__reloc_{func,line}_info functions. Since
> struct btf_ext is opaque to the user it was necessary to expose rec_size
> getters in the past.
> 
> btf_ext__reloc_{func,line}_info were deprecated in commit 8505e8709b5ee
> ("libbpf: Implement generalized .BTF.ext func/line info adjustment")
> as they're not compatible with support for multiple programs per
> section. It was decided[0] that users of these APIs should implement their
> own .btf.ext parsing to access this data, in which case the rec_size
> getters are unnecessary. So deprecate them from libbpf 0.7.0 onwards.
> 
>    [0] Closes: https://github.com/libbpf/libbpf/issues/277
> 
> Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
> ---
>   tools/lib/bpf/btf.h | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
> index 96b44d55db6e..c2f89a2cca11 100644
> --- a/tools/lib/bpf/btf.h
> +++ b/tools/lib/bpf/btf.h
> @@ -168,7 +168,9 @@ int btf_ext__reloc_line_info(const struct btf *btf,
>   			     const struct btf_ext *btf_ext,
>   			     const char *sec_name, __u32 insns_cnt,
>   			     void **line_info, __u32 *cnt);
> +LIBBPF_DEPRECATED_SINCE(0, 7, "btf_ext__reloc_func_info is deprecated; write custom func_info parsing to fetch rec_size")
>   LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
> +LIBBPF_DEPRECATED_SINCE(0, 7, "btf_ext__reloc_line_info is deprecated; write custom line_info parsing to fetch rec_size")
>   LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);

The btf_ext__reloc_{func,line}_info() only use LIBBPF_DEPRECATED() instead of
LIBBPF_DEPRECATED_SINCE(). If they are used in conjunction with the other ones,
should we either mark all of them LIBBPF_DEPRECATED_SINCE(0, 7, [...]) or just
all as LIBBPF_DEPRECATED() ?

>   LIBBPF_API int btf__find_str(struct btf *btf, const char *s);
> 

Thanks,
Daniel
diff mbox series

Patch

diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h
index 96b44d55db6e..c2f89a2cca11 100644
--- a/tools/lib/bpf/btf.h
+++ b/tools/lib/bpf/btf.h
@@ -168,7 +168,9 @@  int btf_ext__reloc_line_info(const struct btf *btf,
 			     const struct btf_ext *btf_ext,
 			     const char *sec_name, __u32 insns_cnt,
 			     void **line_info, __u32 *cnt);
+LIBBPF_DEPRECATED_SINCE(0, 7, "btf_ext__reloc_func_info is deprecated; write custom func_info parsing to fetch rec_size")
 LIBBPF_API __u32 btf_ext__func_info_rec_size(const struct btf_ext *btf_ext);
+LIBBPF_DEPRECATED_SINCE(0, 7, "btf_ext__reloc_line_info is deprecated; write custom line_info parsing to fetch rec_size")
 LIBBPF_API __u32 btf_ext__line_info_rec_size(const struct btf_ext *btf_ext);
 
 LIBBPF_API int btf__find_str(struct btf *btf, const char *s);