From: Andrii Nakryiko Date: Mon, 25 Oct 2021 22:45:31 +0000 (-0700) Subject: libbpf: Deprecate ambiguously-named bpf_program__size() API X-Git-Tag: v6.1-rc5~2768^2~2^2~29^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4813e969ac471af730902377a2656b6b1b92c4d;p=platform%2Fkernel%2Flinux-starfive.git libbpf: Deprecate ambiguously-named bpf_program__size() API The name of the API doesn't convey clearly that this size is in number of bytes (there needed to be a separate comment to make this clear in libbpf.h). Further, measuring the size of BPF program in bytes is not exactly the best fit, because BPF programs always consist of 8-byte instructions. As such, bpf_program__insn_cnt() is a better alternative in pretty much any imaginable case. So schedule bpf_program__size() deprecation starting from v0.7 and it will be removed in libbpf 1.0. Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20211025224531.1088894-5-andrii@kernel.org --- diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index 449eeed..e190081 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -224,6 +224,7 @@ LIBBPF_API bool bpf_program__autoload(const struct bpf_program *prog); LIBBPF_API int bpf_program__set_autoload(struct bpf_program *prog, bool autoload); /* returns program size in bytes */ +LIBBPF_DEPRECATED_SINCE(0, 7, "use bpf_program__insn_cnt() instead") LIBBPF_API size_t bpf_program__size(const struct bpf_program *prog); struct bpf_insn;