From: Arnaldo Carvalho de Melo Date: Fri, 19 Sep 2025 20:59:25 +0000 (-0300) Subject: perf bpf: Move the LIBBPF_CURRENT_VERSION_GEQ macro to bpf-utils.h X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=5a022bf88fb0f4edde14b1f6f9029d96bffbf3e6;p=users%2Fhch%2Fmisc.git perf bpf: Move the LIBBPF_CURRENT_VERSION_GEQ macro to bpf-utils.h We need it to fix some other libbpf version dependent issues when building with LIBBPF_DYNAMIC=1. Reviewed-by: Ian Rogers Acked-by: Namhyung Kim Cc: Adrian Hunter Cc: Andrii Nakryiko Cc: James Clark Cc: Jiri Olsa Cc: Kan Liang Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/bpf-filter.c b/tools/perf/util/bpf-filter.c index 92308c38fbb5..1a2e7b388d57 100644 --- a/tools/perf/util/bpf-filter.c +++ b/tools/perf/util/bpf-filter.c @@ -56,6 +56,7 @@ #include "util/debug.h" #include "util/evsel.h" #include "util/target.h" +#include "util/bpf-utils.h" #include "util/bpf-filter.h" #include @@ -443,10 +444,6 @@ err: return -1; } -#define LIBBPF_CURRENT_VERSION_GEQ(major, minor) \ - (LIBBPF_MAJOR_VERSION > (major) || \ - (LIBBPF_MAJOR_VERSION == (major) && LIBBPF_MINOR_VERSION >= (minor))) - int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target) { int i, x, y, fd, ret; diff --git a/tools/perf/util/bpf-utils.h b/tools/perf/util/bpf-utils.h index 86a5055cdfad..eafc43b8731f 100644 --- a/tools/perf/util/bpf-utils.h +++ b/tools/perf/util/bpf-utils.h @@ -8,6 +8,11 @@ #ifdef HAVE_LIBBPF_SUPPORT #include +#include + +#define LIBBPF_CURRENT_VERSION_GEQ(major, minor) \ + (LIBBPF_MAJOR_VERSION > (major) || \ + (LIBBPF_MAJOR_VERSION == (major) && LIBBPF_MINOR_VERSION >= (minor))) /* * Get bpf_prog_info in continuous memory