]> Gentwo Git Trees - linux/.git/commit
bpf: Allow struct_ops to get map id by kdata
authorAmery Hung <ameryhung@gmail.com>
Wed, 6 Aug 2025 16:25:38 +0000 (09:25 -0700)
committerMartin KaFai Lau <martin.lau@kernel.org>
Wed, 6 Aug 2025 20:39:58 +0000 (13:39 -0700)
commitd87a513d093726d121dd5c816e26803111a259d0
tree478265f73c6c33b13dd6e234d8dc7bd57a63a39f
parentf3af62b6cee8af9f07012051874af2d2a451f0e5
bpf: Allow struct_ops to get map id by kdata

Add bpf_struct_ops_id() to enable struct_ops implementors to use
struct_ops map id as the unique id of a struct_ops in their subsystem.
A subsystem that wishes to create a mapping between id and struct_ops
instance pointer can update the mapping accordingly during
bpf_struct_ops::reg(), unreg(), and update().

Signed-off-by: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20250806162540.681679-2-ameryhung@gmail.com
include/linux/bpf.h
kernel/bpf/bpf_struct_ops.c