Skip to contentSkip to conversation

libbpf 1.0: deprecate bpf_object__find_map_by_offset() API

PATCH Applied Christy Lee 2 participants 2 messages Jan 5, 2022 – Jan 6, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libbpf 1.0: deprecate bpf_object__find_map_by_offset() API

API created with simplistic assumptions about BPF map definitions. It hasn’t worked for a while, deprecate it in preparation for libbpf 1.0.

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

---
 tools/lib/bpf/libbpf.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/lib/bpf/libbpf.h +2 -1
index 85dfef88b3d2..8a86d7e614bc 100644
@@ -677,7 +677,8 @@ bpf_object__find_map_fd_by_name(const struct bpf_object *obj, const char *name);
  * Get bpf_map through the offset of corresponding struct bpf_map_def
  * in the BPF object file.
  */
-LIBBPF_API struct bpf_map *
+LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 8, "function has no effect")
+struct bpf_map *
 bpf_object__find_map_by_offset(struct bpf_object *obj, size_t offset);
 
 LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_map() instead")
Signature · 1 line
2.30.2
#1 lore raw
Quoted 5 lines · Christy Lee

API created with simplistic assumptions about BPF map definitions. It hasn’t worked for a while, deprecate it in preparation for libbpf 1.0.

Quoted 7 lines

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

---
 tools/lib/bpf/libbpf.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Applied to bpf-next, thanks.

Quoted 17 lines
tools/lib/bpf/libbpf.h +2 -2
index 85dfef88b3d2..8a86d7e614bc 100644
@@ -677,7 +677,8 @@ bpf_object__find_map_fd_by_name(const struct bpf_object *obj, const char *name);
  * Get bpf_map through the offset of corresponding struct bpf_map_def
  * in the BPF object file.
  */
-LIBBPF_API struct bpf_map *
+LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 8, "function has no effect")
+struct bpf_map *
 bpf_object__find_map_by_offset(struct bpf_object *obj, size_t offset);
 
 LIBBPF_API LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__next_map() instead")
--

2.30.2