66 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef PERF_UTIL_BPF_FILTER_H3#define PERF_UTIL_BPF_FILTER_H4 5#include <linux/list.h>6 7#include "bpf_skel/sample-filter.h"8 9struct perf_bpf_filter_expr {10 struct list_head list;11 struct list_head groups;12 enum perf_bpf_filter_op op;13 int part;14 enum perf_bpf_filter_term term;15 unsigned long val;16};17 18struct evsel;19struct target;20 21/* path in BPF-fs for the pinned program and maps */22#define PERF_BPF_FILTER_PIN_PATH "perf_filter"23 24#ifdef HAVE_BPF_SKEL25struct perf_bpf_filter_expr *perf_bpf_filter_expr__new(enum perf_bpf_filter_term term,26 int part,27 enum perf_bpf_filter_op op,28 unsigned long val);29int perf_bpf_filter__parse(struct list_head *expr_head, const char *str);30int perf_bpf_filter__prepare(struct evsel *evsel, struct target *target);31int perf_bpf_filter__destroy(struct evsel *evsel);32u64 perf_bpf_filter__lost_count(struct evsel *evsel);33int perf_bpf_filter__pin(void);34int perf_bpf_filter__unpin(void);35 36#else /* !HAVE_BPF_SKEL */37 38static inline int perf_bpf_filter__parse(struct list_head *expr_head __maybe_unused,39 const char *str __maybe_unused)40{41 return -EOPNOTSUPP;42}43static inline int perf_bpf_filter__prepare(struct evsel *evsel __maybe_unused,44 struct target *target __maybe_unused)45{46 return -EOPNOTSUPP;47}48static inline int perf_bpf_filter__destroy(struct evsel *evsel __maybe_unused)49{50 return -EOPNOTSUPP;51}52static inline u64 perf_bpf_filter__lost_count(struct evsel *evsel __maybe_unused)53{54 return 0;55}56static inline int perf_bpf_filter__pin(void)57{58 return -EOPNOTSUPP;59}60static inline int perf_bpf_filter__unpin(void)61{62 return -EOPNOTSUPP;63}64#endif /* HAVE_BPF_SKEL*/65#endif /* PERF_UTIL_BPF_FILTER_H */66