Skip to contentSkip to conversation

bpf: unify function pointer type of dispatcher

PATCH New Jason A. Donenfeld 1 participant 1 message Oct 4, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: unify function pointer type of dispatcher

The __bpf_prog_run() function takes a bpf_dispatcher_fn as its last argument, which are usually generated by use of the DEFINE_BPF_DISPATCHER() macro. The last argument of a bpf_dispatcher_fn is an open coded function pointer. The DEFINE_BPF_DISPATCHER() macro, on the other hand, has as its last argument a bpf_func_t, rather than an open coded function pointer. Unify these two signatures by using bpf_func_t in both places, since it's the same as the open coded function pointer.

---
 include/linux/filter.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/linux/filter.h +1 -2
index 527ae1d64e27..25e85cfc28b8 100644
@@ -569,8 +569,7 @@ DECLARE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
 
 typedef unsigned int (*bpf_dispatcher_fn)(const void *ctx,
 					  const struct bpf_insn *insnsi,
-					  unsigned int (*bpf_func)(const void *,
-								   const struct bpf_insn *));
+					  bpf_func_t bpf_func);
 
 static __always_inline u32 __bpf_prog_run(const struct bpf_prog *prog,
 					  const void *ctx,
Signature · 1 line
2.37.3