summaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-01-08 00:53:26 +0300
committerAndrii Nakryiko <andrii@kernel.org>2022-01-13 04:01:37 +0300
commit472ee694b0a77f6e7f895ccfc75af787d911159c (patch)
tree454d715af3aa1c6ae358f22c32584b34f9e96ab0 /tools/lib
parent622a5b582cc27d3deedc38fcef68da2972e8e58d (diff)
parentce7875473324729b07661e588ac0c44862efbb0f (diff)
downloadlinux-472ee694b0a77f6e7f895ccfc75af787d911159c.tar.xz
Merge branch 'libbpf: rename bpf_prog_attach_xattr to bpf_prog_attach_opts'
Christy Lee says: ==================== All xattr APIs are being dropped, mark bpf_prog_attach_opts() as deprecated and rename to bpf_prog_attach_xattr(). Replace all usages of the deprecated function with the new function name. [0] Closes: https://github.com/libbpf/libbpf/issues/285 Changelog: ---------- v2 -> v3: https://lore.kernel.org/all/20220106234639.1418484-2-christylee@fb.com/ * Fixed build break v1 -> v2: https://lore.kernel.org/all/20211230000110.1068538-1-christylee@fb.com/ * Used alias instead of returning original function * Split out selftests to a different commit ==================== Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/bpf/bpf.c9
-rw-r--r--tools/lib/bpf/bpf.h4
-rw-r--r--tools/lib/bpf/libbpf.map1
3 files changed, 12 insertions, 2 deletions
diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
index 550b4cbb6c99..418b259166f8 100644
--- a/tools/lib/bpf/bpf.c
+++ b/tools/lib/bpf/bpf.c
@@ -754,10 +754,10 @@ int bpf_prog_attach(int prog_fd, int target_fd, enum bpf_attach_type type,
.flags = flags,
);
- return bpf_prog_attach_xattr(prog_fd, target_fd, type, &opts);
+ return bpf_prog_attach_opts(prog_fd, target_fd, type, &opts);
}
-int bpf_prog_attach_xattr(int prog_fd, int target_fd,
+int bpf_prog_attach_opts(int prog_fd, int target_fd,
enum bpf_attach_type type,
const struct bpf_prog_attach_opts *opts)
{
@@ -778,6 +778,11 @@ int bpf_prog_attach_xattr(int prog_fd, int target_fd,
return libbpf_err_errno(ret);
}
+__attribute__((alias("bpf_prog_attach_opts")))
+int bpf_prog_attach_xattr(int prog_fd, int target_fd,
+ enum bpf_attach_type type,
+ const struct bpf_prog_attach_opts *opts);
+
int bpf_prog_detach(int target_fd, enum bpf_attach_type type)
{
union bpf_attr attr;
diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
index 14e0d97ad2cf..c2e8327010f9 100644
--- a/tools/lib/bpf/bpf.h
+++ b/tools/lib/bpf/bpf.h
@@ -391,6 +391,10 @@ struct bpf_prog_attach_opts {
LIBBPF_API int bpf_prog_attach(int prog_fd, int attachable_fd,
enum bpf_attach_type type, unsigned int flags);
+LIBBPF_API int bpf_prog_attach_opts(int prog_fd, int attachable_fd,
+ enum bpf_attach_type type,
+ const struct bpf_prog_attach_opts *opts);
+LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_prog_attach_opts() instead")
LIBBPF_API int bpf_prog_attach_xattr(int prog_fd, int attachable_fd,
enum bpf_attach_type type,
const struct bpf_prog_attach_opts *opts);
diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
index 529783967793..8262cfca2240 100644
--- a/tools/lib/bpf/libbpf.map
+++ b/tools/lib/bpf/libbpf.map
@@ -247,6 +247,7 @@ LIBBPF_0.0.8 {
bpf_link_create;
bpf_link_update;
bpf_map__set_initial_value;
+ bpf_prog_attach_opts;
bpf_program__attach_cgroup;
bpf_program__attach_lsm;
bpf_program__is_lsm;