Skip to contentSkip to conversation

libbpf: mark bpf_object__open_xattr() deprecated

PATCH In review Christy Lee 2 participants 2 messages Jan 25, 2022

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

PATCH 1/1 libbpf: mark bpf_object__open_xattr() deprecated

Mark bpf_object__open_xattr() as deprecated, use
bpf_object__open_file() instead.

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

---
 tools/lib/bpf/libbpf.h | 1 +
 1 file changed, 1 insertion(+)
tools/lib/bpf/libbpf.h +1 -0
index 94670066de62..55dba4c38a04 100644
@@ -183,6 +183,7 @@ bpf_object__open_mem(const void *obj_buf, size_t obj_buf_sz,
 LIBBPF_API struct bpf_object *
 bpf_object__open_buffer(const void *obj_buf, size_t obj_buf_sz,
 			const char *name);
+LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open_file() instead")
 LIBBPF_API struct bpf_object *
 bpf_object__open_xattr(struct bpf_object_open_attr *attr);
 
Signature · 1 line
2.30.2
#1 lore raw
Quoted 16 lines · Christy Lee

Mark bpf_object__open_xattr() as deprecated, use
bpf_object__open_file() instead.

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

---
 tools/lib/bpf/libbpf.h | 1 +
 1 file changed, 1 insertion(+)
tools/lib/bpf/libbpf.h +0 -0
index 94670066de62..55dba4c38a04 100644

tools/lib/bpf/libbpf.h bpf_object__open_mem(const void *obj_buf, size_t obj_buf_sz, · line 188

Quoted 6 lines
tools/lib/bpf/libbpf.h +1 -0
@@ -183,6 +183,7 @@ bpf_object__open_mem(const void *obj_buf, size_t obj_buf_sz,
 LIBBPF_API struct bpf_object *
 bpf_object__open_buffer(const void *obj_buf, size_t obj_buf_sz,
                        const char *name);
+LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open_file() instead")
 LIBBPF_API struct bpf_object *
 bpf_object__open_xattr(struct bpf_object_open_attr *attr);

You've missed one internal use of bpf_object__open_xattr() in bpf_prog_load_xattr2(), which would cause compilation warning (turned error) at the next version bump. I've updated that to __bpf_object__open_xattr(&open_attr, 0).

Best way to catch this is to temporarily change DEPRECATED_SINCE to the current version (0.7) and compile everything with that.

But also given a better API exists for a long time now, we can deprecate bpf_object__open_xattr() right now, so I changed DEPRECATED_SINCE to 0.7 and applied to bpf-next, thanks.

Quoted 4 lines
tools/lib/bpf/libbpf.h +0 -1
--

2.30.2