[PATCH bpf-next 1/4] bpf: export necessary sympols for modules

D. Wythe
2024-10-24T02:43:03Z

From: "D. Wythe" <alibuda@linux.alibaba.com>

This patch exports two necessary symbols for registering struct_ops
or kfunc with tristate subsystem.

Find the corresponding btf_id by name and type with
btf_find_by_name_kind().

And find the string in btf by offset with btf_str_by_offset(),
used to look up the names of structure members.

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
---
kernel/bpf/btf.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 75e4fe8..315e49b 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -567,6 +567,7 @@ s32 btf_find_by_name_kind(const struct btf *btf, const char *name, u8 kind)

return -ENOENT;
}
+EXPORT_SYMBOL_GPL(btf_find_by_name_kind);

s32 bpf_find_btf_id(const char *name, u32 kind, struct btf **btf_p)
{
@@ -789,6 +790,7 @@ const char *btf_str_by_offset(const struct btf *btf, u32 offset)

return NULL;
}
+EXPORT_SYMBOL_GPL(btf_str_by_offset);

static bool btf_name_valid_identifier(const struct btf *btf, u32 offset)
{
--
1.8.3.1