Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <yangfeng@kylinos.cn>
Link: https://lore.kernel.org/r/20250710055419.70544-1-yangfeng59949@163.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Feng Yang and committed by
Alexei Starovoitov
62ef449b 1f489662

+10 -20
+1 -2
kernel/bpf/btf.c
··· 6200 6200 return kctx_type_id; 6201 6201 } 6202 6202 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) 6205 6204 6206 6205 static struct btf *btf_parse_base(struct btf_verifier_env *env, const char *name, 6207 6206 void *data, unsigned int data_size)
+1 -2
kernel/bpf/prog_iter.c
··· 78 78 .show = bpf_prog_seq_show, 79 79 }; 80 80 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) 83 82 84 83 static const struct bpf_iter_seq_info bpf_prog_seq_info = { 85 84 .seq_ops = &bpf_prog_seq_ops,
+1 -2
kernel/kallsyms.c
··· 829 829 .seq_info = &ksym_iter_seq_info, 830 830 }; 831 831 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) 834 833 835 834 static int __init bpf_ksym_iter_register(void) 836 835 {
+1 -2
kernel/trace/bpf_trace.c
··· 781 781 return (unsigned long) task_pt_regs(task); 782 782 } 783 783 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) 786 785 787 786 const struct bpf_func_proto bpf_task_pt_regs_proto = { 788 787 .func = bpf_task_pt_regs,
+1 -2
net/ipv6/route.c
··· 6805 6805 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS) 6806 6806 DEFINE_BPF_ITER_FUNC(ipv6_route, struct bpf_iter_meta *meta, struct fib6_info *rt) 6807 6807 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) 6810 6809 6811 6810 static const struct bpf_iter_seq_info ipv6_route_seq_info = { 6812 6811 .seq_ops = &ipv6_route_seq_ops,
+1 -2
net/netlink/af_netlink.c
··· 2869 2869 }; 2870 2870 2871 2871 #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) 2874 2873 2875 2874 static const struct bpf_iter_seq_info netlink_seq_info = { 2876 2875 .seq_ops = &netlink_seq_ops,
+3 -6
net/sched/bpf_qdisc.c
··· 130 130 return 0; 131 131 } 132 132 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) 135 134 136 135 static int bpf_qdisc_gen_prologue(struct bpf_insn *insn_buf, bool direct_write, 137 136 const struct bpf_prog *prog) ··· 160 161 return insn - insn_buf; 161 162 } 162 163 163 - BTF_ID_LIST(bpf_qdisc_reset_destroy_epilogue_ids) 164 - BTF_ID(func, bpf_qdisc_reset_destroy_epilogue) 164 + BTF_ID_LIST_SINGLE(bpf_qdisc_reset_destroy_epilogue_ids, func, bpf_qdisc_reset_destroy_epilogue) 165 165 166 166 static int bpf_qdisc_gen_epilogue(struct bpf_insn *insn_buf, const struct bpf_prog *prog, 167 167 s16 ctx_stack_off) ··· 449 451 .owner = THIS_MODULE, 450 452 }; 451 453 452 - BTF_ID_LIST(bpf_sk_buff_dtor_ids) 453 - BTF_ID(func, bpf_kfree_skb) 454 + BTF_ID_LIST_SINGLE(bpf_sk_buff_dtor_ids, func, bpf_kfree_skb) 454 455 455 456 static int __init bpf_qdisc_kfunc_init(void) 456 457 {