diff options
author | Jakub Kicinski <jakub.kicinski@netronome.com> | 2017-11-20 18:21:56 -0500 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2017-11-20 18:37:35 -0500 |
commit | 479321e9c31a6c05426790b11888427400f75ac8 (patch) | |
tree | ec55a10f0f7e571e59ead13c820ddc4bae46d67c | |
parent | 441a33031fe5a3e828fbc17a4f9a5bab9143243c (diff) |
bpf: turn bpf_prog_get_type() into a wrapper
bpf_prog_get_type() is identical to bpf_prog_get_type_dev(),
with false passed as attach_drv. Instead of keeping it as
an exported symbol turn it into static inline wrapper.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r-- | include/linux/bpf.h | 13 | ||||
-rw-r--r-- | kernel/bpf/syscall.c | 10 |
2 files changed, 6 insertions, 17 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h index f82be640731e..37bbab8c0f56 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h | |||
@@ -334,7 +334,6 @@ extern const struct bpf_verifier_ops tc_cls_act_analyzer_ops; | |||
334 | extern const struct bpf_verifier_ops xdp_analyzer_ops; | 334 | extern const struct bpf_verifier_ops xdp_analyzer_ops; |
335 | 335 | ||
336 | struct bpf_prog *bpf_prog_get(u32 ufd); | 336 | struct bpf_prog *bpf_prog_get(u32 ufd); |
337 | struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type); | ||
338 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, | 337 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, |
339 | bool attach_drv); | 338 | bool attach_drv); |
340 | struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i); | 339 | struct bpf_prog * __must_check bpf_prog_add(struct bpf_prog *prog, int i); |
@@ -425,12 +424,6 @@ static inline struct bpf_prog *bpf_prog_get(u32 ufd) | |||
425 | return ERR_PTR(-EOPNOTSUPP); | 424 | return ERR_PTR(-EOPNOTSUPP); |
426 | } | 425 | } |
427 | 426 | ||
428 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, | ||
429 | enum bpf_prog_type type) | ||
430 | { | ||
431 | return ERR_PTR(-EOPNOTSUPP); | ||
432 | } | ||
433 | |||
434 | static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, | 427 | static inline struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, |
435 | enum bpf_prog_type type, | 428 | enum bpf_prog_type type, |
436 | bool attach_drv) | 429 | bool attach_drv) |
@@ -514,6 +507,12 @@ static inline int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, | |||
514 | } | 507 | } |
515 | #endif /* CONFIG_BPF_SYSCALL */ | 508 | #endif /* CONFIG_BPF_SYSCALL */ |
516 | 509 | ||
510 | static inline struct bpf_prog *bpf_prog_get_type(u32 ufd, | ||
511 | enum bpf_prog_type type) | ||
512 | { | ||
513 | return bpf_prog_get_type_dev(ufd, type, false); | ||
514 | } | ||
515 | |||
517 | int bpf_prog_offload_compile(struct bpf_prog *prog); | 516 | int bpf_prog_offload_compile(struct bpf_prog *prog); |
518 | void bpf_prog_offload_destroy(struct bpf_prog *prog); | 517 | void bpf_prog_offload_destroy(struct bpf_prog *prog); |
519 | u32 bpf_prog_offload_ifindex(struct bpf_prog *prog); | 518 | u32 bpf_prog_offload_ifindex(struct bpf_prog *prog); |
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 38da55905ab0..41509cf825d8 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -1097,16 +1097,6 @@ struct bpf_prog *bpf_prog_get(u32 ufd) | |||
1097 | return __bpf_prog_get(ufd, NULL, false); | 1097 | return __bpf_prog_get(ufd, NULL, false); |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | struct bpf_prog *bpf_prog_get_type(u32 ufd, enum bpf_prog_type type) | ||
1101 | { | ||
1102 | struct bpf_prog *prog = __bpf_prog_get(ufd, &type, false); | ||
1103 | |||
1104 | if (!IS_ERR(prog)) | ||
1105 | trace_bpf_prog_get_type(prog); | ||
1106 | return prog; | ||
1107 | } | ||
1108 | EXPORT_SYMBOL_GPL(bpf_prog_get_type); | ||
1109 | |||
1110 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, | 1100 | struct bpf_prog *bpf_prog_get_type_dev(u32 ufd, enum bpf_prog_type type, |
1111 | bool attach_drv) | 1101 | bool attach_drv) |
1112 | { | 1102 | { |