[PATCH V2 bpf-next] bpf: export btf_find_by_name_kind and bpf_base_func_proto

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Almost all existed struct_ops users(hid, sched_ext, ...) need the two APIs.

In-tree hid-bpf code(drivers/hid/bpf/hid_bpf_struct_ops.c) can't be built
as module because the two APIs aren't exported.

Export btf_find_by_name_kind and bpf_base_func_proto, so that any kernel
module can use them given bpf community is supporting to register
struct_ops in module, see the patchset "Registrating struct_ops types from
modules"[1], which is merged to v6.9.

Cc: Yonghong Song <yonghong.song@xxxxxxxxx>
Cc: Benjamin Tissoires <bentiss@xxxxxxxxxx>
Cc: Jiri Kosina <jikos@xxxxxxxxxx>
Signed-off-by: Ming Lei <ming.lei@xxxxxxxxxx>
---
V2:
	- add more details in commit log (Yonghong)
	- add 'bpf-next' in patch title (Yonghong)

 kernel/bpf/btf.c     | 1 +
 kernel/bpf/helpers.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 520f49f422fe..519c6e5a57d5 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)
 {
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index b5f0adae8293..18d1a76f96d2 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -2033,6 +2033,7 @@ bpf_base_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
 		return NULL;
 	}
 }
+EXPORT_SYMBOL_GPL(bpf_base_func_proto);
 
 void bpf_list_head_free(const struct btf_field *field, void *list_head,
 			struct bpf_spin_lock *spin_lock)
-- 
2.42.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux