mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 15:42:32 +00:00
bpf: Refactor bpf_iter_reg to have separate seq_info member
There is no functionality change for this patch. Struct bpf_iter_reg is used to register a bpf_iter target, which includes information for both prog_load, link_create and seq_file creation. This patch puts fields related seq_file creation into a different structure. This will be useful for map elements iterator where one iterator covers different map types and different map types may have different seq_ops, init/fini private_data function and private_data size. Signed-off-by: Yonghong Song <yhs@fb.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200723184109.590030-1-yhs@fb.com
This commit is contained in:
parent
a228a64fc1
commit
14fc6bd6b7
9 changed files with 64 additions and 29 deletions
|
@ -319,25 +319,32 @@ BTF_ID_LIST(btf_task_file_ids)
|
|||
BTF_ID(struct, task_struct)
|
||||
BTF_ID(struct, file)
|
||||
|
||||
static struct bpf_iter_reg task_reg_info = {
|
||||
.target = "task",
|
||||
static const struct bpf_iter_seq_info task_seq_info = {
|
||||
.seq_ops = &task_seq_ops,
|
||||
.init_seq_private = init_seq_pidns,
|
||||
.fini_seq_private = fini_seq_pidns,
|
||||
.seq_priv_size = sizeof(struct bpf_iter_seq_task_info),
|
||||
};
|
||||
|
||||
static struct bpf_iter_reg task_reg_info = {
|
||||
.target = "task",
|
||||
.ctx_arg_info_size = 1,
|
||||
.ctx_arg_info = {
|
||||
{ offsetof(struct bpf_iter__task, task),
|
||||
PTR_TO_BTF_ID_OR_NULL },
|
||||
},
|
||||
.seq_info = &task_seq_info,
|
||||
};
|
||||
|
||||
static struct bpf_iter_reg task_file_reg_info = {
|
||||
.target = "task_file",
|
||||
static const struct bpf_iter_seq_info task_file_seq_info = {
|
||||
.seq_ops = &task_file_seq_ops,
|
||||
.init_seq_private = init_seq_pidns,
|
||||
.fini_seq_private = fini_seq_pidns,
|
||||
.seq_priv_size = sizeof(struct bpf_iter_seq_task_file_info),
|
||||
};
|
||||
|
||||
static struct bpf_iter_reg task_file_reg_info = {
|
||||
.target = "task_file",
|
||||
.ctx_arg_info_size = 2,
|
||||
.ctx_arg_info = {
|
||||
{ offsetof(struct bpf_iter__task_file, task),
|
||||
|
@ -345,6 +352,7 @@ static struct bpf_iter_reg task_file_reg_info = {
|
|||
{ offsetof(struct bpf_iter__task_file, file),
|
||||
PTR_TO_BTF_ID_OR_NULL },
|
||||
},
|
||||
.seq_info = &task_file_seq_info,
|
||||
};
|
||||
|
||||
static int __init task_iter_init(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue