From: Hou Tao <houtao1@xxxxxxxxxx> both syscall.c and helpers.c have the declaration of __bpf_obj_drop_impl(), so just move it to a common header file. Signed-off-by: Hou Tao <houtao1@xxxxxxxxxx> --- kernel/bpf/helpers.c | 3 +-- kernel/bpf/internal.h | 11 +++++++++++ kernel/bpf/syscall.c | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 kernel/bpf/internal.h diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index dd1c69ee3375..07f49f8831c0 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c @@ -24,6 +24,7 @@ #include <linux/bpf_mem_alloc.h> #include <linux/kasan.h> +#include "internal.h" #include "../../lib/kstrtox.h" /* If kernel subsystem is allowing eBPF programs to call this function, @@ -1808,8 +1809,6 @@ bpf_base_func_proto(enum bpf_func_id func_id) } } -void __bpf_obj_drop_impl(void *p, const struct btf_record *rec); - void bpf_list_head_free(const struct btf_field *field, void *list_head, struct bpf_spin_lock *spin_lock) { diff --git a/kernel/bpf/internal.h b/kernel/bpf/internal.h new file mode 100644 index 000000000000..e233ea83eb0a --- /dev/null +++ b/kernel/bpf/internal.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* Copyright (C) 2023. Huawei Technologies Co., Ltd + */ +#ifndef __BPF_INTERNAL_H_ +#define __BPF_INTERNAL_H_ + +struct btf_record; + +void __bpf_obj_drop_impl(void *p, const struct btf_record *rec); + +#endif /* __BPF_INTERNAL_H_ */ diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 6b5280f14a53..7de4b9f97c8f 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c @@ -39,6 +39,8 @@ #include <net/tcx.h> +#include "internal.h" + #define IS_FD_ARRAY(map) ((map)->map_type == BPF_MAP_TYPE_PERF_EVENT_ARRAY || \ (map)->map_type == BPF_MAP_TYPE_CGROUP_ARRAY || \ (map)->map_type == BPF_MAP_TYPE_ARRAY_OF_MAPS) @@ -626,8 +628,6 @@ void bpf_obj_free_timer(const struct btf_record *rec, void *obj) bpf_timer_cancel_and_free(obj + rec->timer_off); } -extern void __bpf_obj_drop_impl(void *p, const struct btf_record *rec); - void bpf_obj_free_fields(const struct btf_record *rec, void *obj) { const struct btf_field *fields; -- 2.29.2