diff options
author | Lorenz Bauer <lmb@cloudflare.com> | 2020-09-21 13:12:27 +0100 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-09-21 15:00:41 -0700 |
commit | f79e7ea571732a6e16f15c6e2f000c347e2d7431 (patch) | |
tree | 7ea295685ddd54b775cdc688bcfe0b5f577e48f6 /tools/testing/selftests/bpf/prog_tests/d_path.c | |
parent | fd1b0d604c56e0d9f143b39a92132a2ea9625e6d (diff) |
bpf: Use a table to drive helper arg type checks
The mapping between bpf_arg_type and bpf_reg_type is encoded in a big
hairy if statement that is hard to follow. The debug output also leaves
to be desired: if a reg_type doesn't match we only print one of the
options, instead printing all the valid ones.
Convert the if statement into a table which is then used to drive type
checking. If none of the reg_types match we print all options, e.g.:
R2 type=rdonly_buf expected=fp, pkt, pkt_meta, map_value
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200921121227.255763-12-lmb@cloudflare.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/d_path.c')
0 files changed, 0 insertions, 0 deletions