similarity index 85%
rename from kernel/bpf/preload/bpf_preload.h
rename to include/linux/bpf_preload.h
@@ -11,6 +11,10 @@ struct bpf_preload_ops {
int (*preload)(struct bpf_preload_info *);
struct module *owner;
};
+
+#ifdef CONFIG_BPF_SYSCALL
extern struct bpf_preload_ops *bpf_preload_ops;
+#endif /*CONFIG_BPF_SYSCALL*/
+
#define BPF_PRELOAD_LINKS 2
#endif
@@ -20,7 +20,7 @@
#include <linux/filter.h>
#include <linux/bpf.h>
#include <linux/bpf_trace.h>
-#include "preload/bpf_preload.h"
+#include <linux/bpf_preload.h>
enum bpf_type {
BPF_TYPE_UNSPEC = 0,
@@ -2,7 +2,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/init.h>
#include <linux/module.h>
-#include "bpf_preload.h"
+#include <linux/bpf_preload.h>
#include "iterators/iterators.lskel.h"
static struct bpf_link *maps_link, *progs_link;
Move bpf_preload.h to include/linux, so that third-party providers can develop out-of-tree kernel modules to preload eBPF programs. Export the bpf_preload_ops global variable if CONFIG_BPF_SYSCALL is defined. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- {kernel/bpf/preload => include/linux}/bpf_preload.h | 4 ++++ kernel/bpf/inode.c | 2 +- kernel/bpf/preload/bpf_preload_kern.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) rename {kernel/bpf/preload => include/linux}/bpf_preload.h (85%)