]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bpf: Clean up individual BTF_ID code
authorFeng Yang <yangfeng@kylinos.cn>
Thu, 10 Jul 2025 05:54:19 +0000 (13:54 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 17 Jul 2025 01:34:42 +0000 (18:34 -0700)
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>
kernel/bpf/btf.c
kernel/bpf/link_iter.c
kernel/bpf/prog_iter.c
kernel/kallsyms.c
kernel/trace/bpf_trace.c
net/ipv6/route.c
net/netlink/af_netlink.c
net/sched/bpf_qdisc.c

index 2dd13eea7b0ea2b276202d8b792c2a1ed93dc4d9..0aff814cb53a0eb81b1f58bcd7596e4213adebb8 100644 (file)
@@ -6200,8 +6200,7 @@ int get_kern_ctx_btf_id(struct bpf_verifier_log *log, enum bpf_prog_type prog_ty
        return kctx_type_id;
 }
 
-BTF_ID_LIST(bpf_ctx_convert_btf_id)
-BTF_ID(struct, bpf_ctx_convert)
+BTF_ID_LIST_SINGLE(bpf_ctx_convert_btf_id, struct, bpf_ctx_convert)
 
 static struct btf *btf_parse_base(struct btf_verifier_env *env, const char *name,
                                  void *data, unsigned int data_size)
index fec8005a121c3208d22ab87f0947553df063b3d9..8158e9c1af7bfd9486aebaf0591836ed4cf96208 100644 (file)
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_link_seq_ops = {
        .show   = bpf_link_seq_show,
 };
 
-BTF_ID_LIST(btf_bpf_link_id)
-BTF_ID(struct, bpf_link)
+BTF_ID_LIST_SINGLE(btf_bpf_link_id, struct, bpf_link)
 
 static const struct bpf_iter_seq_info bpf_link_seq_info = {
        .seq_ops                = &bpf_link_seq_ops,
index 53a73c841c13790777734472d2146c0191051813..85d8fcb56fb742ecfcecf5ff75d776127086968f 100644 (file)
@@ -78,8 +78,7 @@ static const struct seq_operations bpf_prog_seq_ops = {
        .show   = bpf_prog_seq_show,
 };
 
-BTF_ID_LIST(btf_bpf_prog_id)
-BTF_ID(struct, bpf_prog)
+BTF_ID_LIST_SINGLE(btf_bpf_prog_id, struct, bpf_prog)
 
 static const struct bpf_iter_seq_info bpf_prog_seq_info = {
        .seq_ops                = &bpf_prog_seq_ops,
index 4198f30aac3cabe6b782751725e4bdcfee7af4db..1e76358641247fcbc243e5d7d1a67638118fa3d9 100644 (file)
@@ -829,8 +829,7 @@ static struct bpf_iter_reg ksym_iter_reg_info = {
        .seq_info               = &ksym_iter_seq_info,
 };
 
-BTF_ID_LIST(btf_ksym_iter_id)
-BTF_ID(struct, kallsym_iter)
+BTF_ID_LIST_SINGLE(btf_ksym_iter_id, struct, kallsym_iter)
 
 static int __init bpf_ksym_iter_register(void)
 {
index ffdde840abb8ef00a920690cc75c4b324a20d570..3ae52978cae61a5d60b43c764d3e267bd32e1085 100644 (file)
@@ -781,8 +781,7 @@ BPF_CALL_1(bpf_task_pt_regs, struct task_struct *, task)
        return (unsigned long) task_pt_regs(task);
 }
 
-BTF_ID_LIST(bpf_task_pt_regs_ids)
-BTF_ID(struct, pt_regs)
+BTF_ID_LIST_SINGLE(bpf_task_pt_regs_ids, struct, pt_regs)
 
 const struct bpf_func_proto bpf_task_pt_regs_proto = {
        .func           = bpf_task_pt_regs,
index 79c8f1acf8a35e465ab1a21aca50a554ca6f513b..0d5464c64965242c1c216d2ef026b7f9d503c71e 100644 (file)
@@ -6805,8 +6805,7 @@ void __init ip6_route_init_special_entries(void)
 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
 DEFINE_BPF_ITER_FUNC(ipv6_route, struct bpf_iter_meta *meta, struct fib6_info *rt)
 
-BTF_ID_LIST(btf_fib6_info_id)
-BTF_ID(struct, fib6_info)
+BTF_ID_LIST_SINGLE(btf_fib6_info_id, struct, fib6_info)
 
 static const struct bpf_iter_seq_info ipv6_route_seq_info = {
        .seq_ops                = &ipv6_route_seq_ops,
index e8972a857e51e9e2e70a2f72a40f99db409dfa7a..bea064febf801d753f2553947aa121bca0794129 100644 (file)
@@ -2869,8 +2869,7 @@ static const struct rhashtable_params netlink_rhashtable_params = {
 };
 
 #if defined(CONFIG_BPF_SYSCALL) && defined(CONFIG_PROC_FS)
-BTF_ID_LIST(btf_netlink_sock_id)
-BTF_ID(struct, netlink_sock)
+BTF_ID_LIST_SINGLE(btf_netlink_sock_id, struct, netlink_sock)
 
 static const struct bpf_iter_seq_info netlink_seq_info = {
        .seq_ops                = &netlink_seq_ops,
index 7ea8b54b2ab1f7f2efb59ea850f3a246e79bd946..adcb618a2bfca0ffeec514387e30df6a12ddf613 100644 (file)
@@ -130,8 +130,7 @@ static int bpf_qdisc_btf_struct_access(struct bpf_verifier_log *log,
        return 0;
 }
 
-BTF_ID_LIST(bpf_qdisc_init_prologue_ids)
-BTF_ID(func, bpf_qdisc_init_prologue)
+BTF_ID_LIST_SINGLE(bpf_qdisc_init_prologue_ids, func, bpf_qdisc_init_prologue)
 
 static int bpf_qdisc_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
                                  const struct bpf_prog *prog)
@@ -161,8 +160,7 @@ static int bpf_qdisc_gen_prologue(struct bpf_insn *insn_buf, bool direct_write,
        return insn - insn_buf;
 }
 
-BTF_ID_LIST(bpf_qdisc_reset_destroy_epilogue_ids)
-BTF_ID(func, bpf_qdisc_reset_destroy_epilogue)
+BTF_ID_LIST_SINGLE(bpf_qdisc_reset_destroy_epilogue_ids, func, bpf_qdisc_reset_destroy_epilogue)
 
 static int bpf_qdisc_gen_epilogue(struct bpf_insn *insn_buf, const struct bpf_prog *prog,
                                  s16 ctx_stack_off)
@@ -451,8 +449,7 @@ static struct bpf_struct_ops bpf_Qdisc_ops = {
        .owner = THIS_MODULE,
 };
 
-BTF_ID_LIST(bpf_sk_buff_dtor_ids)
-BTF_ID(func, bpf_kfree_skb)
+BTF_ID_LIST_SINGLE(bpf_sk_buff_dtor_ids, func, bpf_kfree_skb)
 
 static int __init bpf_qdisc_kfunc_init(void)
 {