Skip to contentSkip to conversation

libbpf: deprecate btf_ext rec_size APIs

PATCH Superseded Dave Marchevsky 2 participants 2 messages Jan 27, 2022 – Jan 28, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf: deprecate btf_ext rec_size APIs

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

---
 tools/lib/bpf/btf.h | 2 ++
 1 file changed, 2 insertions(+)
tools/lib/bpf/btf.h +2 -0
index 96b44d55db6e..c2f89a2cca11 100644
@@ -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);
Signature · 1 line
2.30.2
maintainer
#1 lore raw
Quoted 24 lines · Dave Marchevsky

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
---
  tools/lib/bpf/btf.h | 2 ++
  1 file changed, 2 insertions(+)
tools/lib/bpf/btf.h +0 -0
index 96b44d55db6e..c2f89a2cca11 100644

tools/lib/bpf/btf.h int btf_ext__reloc_line_info(const struct btf *btf, · line 174

Quoted 7 lines
tools/lib/bpf/btf.h +2 -0
@@ -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() ?

tools/lib/bpf/btf.h int btf_ext__reloc_line_info(const struct btf *btf, · line 176

Quoted 2 lines
tools/lib/bpf/btf.h +0 -0
  LIBBPF_API int btf__find_str(struct btf *btf, const char *s);
 

Thanks,
Daniel