BPF List
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>
Subject: [PATCH bpf-next 9/9] libbpf: deprecate bpf_prog_load_xattr() API
Date: Wed, 1 Dec 2021 15:28:24 -0800	[thread overview]
Message-ID: <20211201232824.3166325-10-andrii@kernel.org> (raw)
In-Reply-To: <20211201232824.3166325-1-andrii@kernel.org>

bpf_prog_load_xattr() is high-level API that's named as a low-level
BPF_PROG_LOAD wrapper APIs, but it actually operates on struct
bpf_object. It's badly and confusingly misnamed as it will load all the
progs insige bpf_object, returning prog_fd of the very first BPF
program. It also has a bunch of ad-hoc things like log_level override,
map_ifindex auto-setting, etc. All this can be expressed more explicitly
and cleanly through existing libbpf APIs. This patch marks
bpf_prog_load_xattr() for deprecation in libbpf v0.8 ([0]).

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

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/lib/bpf/libbpf.h        | 1 +
 tools/lib/bpf/libbpf_common.h | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 148fa85bab33..c0d62dd37c5d 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -682,6 +682,7 @@ struct bpf_prog_load_attr {
 	int prog_flags;
 };
 
+LIBBPF_DEPRECATED_SINCE(0, 8, "use bpf_object__open() and bpf_object__load() instead")
 LIBBPF_API int bpf_prog_load_xattr(const struct bpf_prog_load_attr *attr,
 				   struct bpf_object **pobj, int *prog_fd);
 LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_object__open() and bpf_object__load() instead")
diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h
index b21cefc9c3b6..000e37798ff2 100644
--- a/tools/lib/bpf/libbpf_common.h
+++ b/tools/lib/bpf/libbpf_common.h
@@ -40,6 +40,11 @@
 #else
 #define __LIBBPF_MARK_DEPRECATED_0_7(X)
 #endif
+#if __LIBBPF_CURRENT_VERSION_GEQ(0, 8)
+#define __LIBBPF_MARK_DEPRECATED_0_8(X) X
+#else
+#define __LIBBPF_MARK_DEPRECATED_0_8(X)
+#endif
 
 /* This set of internal macros allows to do "function overloading" based on
  * number of arguments provided by used in backwards-compatible way during the
-- 
2.30.2


      parent reply	other threads:[~2021-12-01 23:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-01 23:28 [PATCH bpf-next 0/9] Deprecate bpf_prog_load_xattr() API Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 1/9] libbpf: use __u32 fields in bpf_map_create_opts Andrii Nakryiko
2021-12-02 23:28   ` Alexei Starovoitov
2021-12-02 23:40     ` Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 2/9] libbpf: add API to get/set log_level at per-program level Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 3/9] bpftool: migrate off of deprecated bpf_create_map_xattr() API Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 4/9] selftests/bpf: remove recently reintroduced legacy btf__dedup() use Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 5/9] selftests/bpf: mute xdpxceiver.c's deprecation warnings Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 6/9] selftests/bpf: remove all the uses of deprecated bpf_prog_load_xattr() Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 7/9] samples/bpf: clean up samples/bpf build failes Andrii Nakryiko
2021-12-01 23:28 ` [PATCH bpf-next 8/9] samples/bpf: get rid of deprecated libbpf API uses Andrii Nakryiko
2021-12-01 23:28 ` Andrii Nakryiko [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211201232824.3166325-10-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox