Skip to content

Commit 62ef449

Browse files
kknjhAlexei Starovoitov
authored andcommitted
bpf: Clean up individual BTF_ID code
Use BTF_ID_LIST_SINGLE(a, b, c) instead of BTF_ID_LIST(a) BTF_ID(b, c) Signed-off-by: Feng Yang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 1f48966 commit 62ef449

File tree

8 files changed

+10
-20
lines changed

8 files changed

+10
-20
lines changed

kernel/bpf/btf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6200,8 +6200,7 @@ int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_ty
62006200
return kctx_type_id;
62016201
}
62026202

6203-
BTF_ID_LIST(bpf_ctx_convert_btf_id)
6204-
BTF_ID(struct, bpf_ctx_convert)
6203+
BTF_ID_LIST_SINGLE(bpf_ctx_convert_btf_id, struct, bpf_ctx_convert)
62056204

62066205
static struct btf *btf_parse_base(struct btf_verifier_env *env, const char *name,
62076206
void *data, unsigned int data_size)

kernel/bpf/link_iter.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_link_seq_ops = {
7878
.show = bpf_link_seq_show,
7979
};
8080

81-
BTF_ID_LIST(btf_bpf_link_id)
82-
BTF_ID(struct, bpf_link)
81+
BTF_ID_LIST_SINGLE(btf_bpf_link_id, struct, bpf_link)
8382

8483
static const struct bpf_iter_seq_info bpf_link_seq_info = {
8584
.seq_ops = &bpf_link_seq_ops,

kernel/bpf/prog_iter.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_prog_seq_ops = {
7878
.show = bpf_prog_seq_show,
7979
};
8080

81-
BTF_ID_LIST(btf_bpf_prog_id)
82-
BTF_ID(struct, bpf_prog)
81+
BTF_ID_LIST_SINGLE(btf_bpf_prog_id, struct, bpf_prog)
8382

8483
static const struct bpf_iter_seq_info bpf_prog_seq_info = {
8584
.seq_ops = &bpf_prog_seq_ops,

kernel/kallsyms.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,8 +829,7 @@ static struct bpf_iter_reg ksym_iter_reg_info = {
829829
.seq_info = &ksym_iter_seq_info,
830830
};
831831

832-
BTF_ID_LIST(btf_ksym_iter_id)
833-
BTF_ID(struct, kallsym_iter)
832+
BTF_ID_LIST_SINGLE(btf_ksym_iter_id, struct, kallsym_iter)
834833

835834
static int __init bpf_ksym_iter_register(void)
836835
{

kernel/trace/bpf_trace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,7 @@ BPF_CALL_1(bpf_task_pt_regs, struct task_struct *, task)
781781
return (unsigned long) task_pt_regs(task);
782782
}
783783

784-
BTF_ID_LIST(bpf_task_pt_regs_ids)
785-
BTF_ID(struct, pt_regs)
784+
BTF_ID_LIST_SINGLE(bpf_task_pt_regs_ids, struct, pt_regs)
786785

787786
const struct bpf_func_proto bpf_task_pt_regs_proto = {
788787
.func = bpf_task_pt_regs,

net/ipv6/route.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6805,8 +6805,7 @@ void __init ip6_route_init_special_entries(void)
68056805
#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
68066806
DEFINE_BPF_ITER_FUNC(ipv6_route, struct bpf_iter_meta *meta, struct fib6_info *rt)
68076807

6808-
BTF_ID_LIST(btf_fib6_info_id)
6809-
BTF_ID(struct, fib6_info)
6808+
BTF_ID_LIST_SINGLE(btf_fib6_info_id, struct, fib6_info)
68106809

68116810
static const struct bpf_iter_seq_info ipv6_route_seq_info = {
68126811
.seq_ops = &ipv6_route_seq_ops,

net/netlink/af_netlink.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2869,8 +2869,7 @@ static const struct rhashtable_params netlink_rhashtable_params = {
28692869
};
28702870

28712871
#if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
2872-
BTF_ID_LIST(btf_netlink_sock_id)
2873-
BTF_ID(struct, netlink_sock)
2872+
BTF_ID_LIST_SINGLE(btf_netlink_sock_id, struct, netlink_sock)
28742873

28752874
static const struct bpf_iter_seq_info netlink_seq_info = {
28762875
.seq_ops = &netlink_seq_ops,

net/sched/bpf_qdisc.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,7 @@ static int bpf_qdisc_btf_struct_access(struct bpf_verifier_log *log,
130130
return 0;
131131
}
132132

133-
BTF_ID_LIST(bpf_qdisc_init_prologue_ids)
134-
BTF_ID(func, bpf_qdisc_init_prologue)
133+
BTF_ID_LIST_SINGLE(bpf_qdisc_init_prologue_ids, func, bpf_qdisc_init_prologue)
135134

136135
static int bpf_qdisc_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
137136
const struct bpf_prog *prog)
@@ -161,8 +160,7 @@ static int bpf_qdisc_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
161160
return insn - insn_buf;
162161
}
163162

164-
BTF_ID_LIST(bpf_qdisc_reset_destroy_epilogue_ids)
165-
BTF_ID(func, bpf_qdisc_reset_destroy_epilogue)
163+
BTF_ID_LIST_SINGLE(bpf_qdisc_reset_destroy_epilogue_ids, func, bpf_qdisc_reset_destroy_epilogue)
166164

167165
static int bpf_qdisc_gen_epilogue(struct bpf_insn *insn_buf, const struct bpf_prog *prog,
168166
s16 ctx_stack_off)
@@ -451,8 +449,7 @@ static struct bpf_struct_ops bpf_Qdisc_ops = {
451449
.owner = THIS_MODULE,
452450
};
453451

454-
BTF_ID_LIST(bpf_sk_buff_dtor_ids)
455-
BTF_ID(func, bpf_kfree_skb)
452+
BTF_ID_LIST_SINGLE(bpf_sk_buff_dtor_ids, func, bpf_kfree_skb)
456453

457454
static int __init bpf_qdisc_kfunc_init(void)
458455
{

0 commit comments

Comments
 (0)