summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorPu Lehui <pulehui@huawei.com>2026-07-08 06:44:30 +0000
committerKumar Kartikeya Dwivedi <memxor@gmail.com>2026-07-21 20:17:45 +0200
commit6bcecae4b65d80f4474c42a026a5ba229ded347e (patch)
tree6b72c6e77bbb7e9f46afcf29721890320c2febf0 /include/linux
parent7c25590d03abcb5424723f90641fda5b6cefffc8 (diff)
bpf: Extract the is_struct_ops_tramp helper
Extract the is_struct_ops_tramp helper, and use it in riscv as the current checks are somewhat hacky. Signed-off-by: Pu Lehui <pulehui@huawei.com> Reviewed-by: Björn Töpel <bjorn@kernel.org> Acked-by: Björn Töpel <bjorn@kernel.org> Link: https://lore.kernel.org/bpf/20260708064436.2971933-2-pulehui@huaweicloud.com Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/bpf.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index d9542127dfdf..e066f44a9c05 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -2196,6 +2196,12 @@ static inline bool is_tracing_multi(enum bpf_attach_type type)
type == BPF_TRACE_FSESSION_MULTI;
}
+static inline bool is_struct_ops_tramp(const struct bpf_tramp_nodes *fentry_nodes)
+{
+ return fentry_nodes->nr_nodes == 1 &&
+ fentry_nodes->nodes[0]->link->type == BPF_LINK_TYPE_STRUCT_OPS;
+}
+
#if defined(CONFIG_BPF_JIT) && defined(CONFIG_BPF_SYSCALL)
/* This macro helps developer to register a struct_ops type and generate
* type information correctly. Developers should use this macro to register