bpf: net: Refactor bpf_iter target registration

Currently bpf_iter_reg_target takes parameters from target
and allocates memory to save them. This is really not
necessary, esp. in the future we may grow information
passed from targets to bpf_iter manager.

The patch refactors the code so target reg_info
becomes static and bpf_iter manager can just take
a reference to it.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200513180219.2949605-1-yhs@fb.com
This commit is contained in:
Yonghong Song
2020-05-13 11:02:19 -07:00
committed by Alexei Starovoitov
parent 2e3ed68bfc
commit 15172a46fa
6 changed files with 61 additions and 61 deletions

View File

@@ -1153,7 +1153,7 @@ struct bpf_iter_meta {
u64 seq_num;
};
int bpf_iter_reg_target(struct bpf_iter_reg *reg_info);
int bpf_iter_reg_target(const struct bpf_iter_reg *reg_info);
void bpf_iter_unreg_target(const char *target);
bool bpf_iter_prog_supported(struct bpf_prog *prog);
int bpf_iter_link_attach(const union bpf_attr *attr, struct bpf_prog *prog);