b/include/uapi/linux/bpf_functions.h
new file mode 100644
@@ -0,0 +1,2 @@
+DEFINE_BPF_FUNC(void *, map_lookup_elem, void *, void *)
+DEFINE_BPF_FUNC(int, map_update_elem, void *, void *, void *, int)
[SNIP]
@@ -133,143 +133,23 @@ union bpf_attr {
};
} __attribute__((aligned(8)));
+#define DEFINE_BPF_FUNC(rettype, name, arglist...) BPF_FUNC_##name
+
+enum bpf_func_id {
+BPF_FUNC_unspec,
+#include "bpf_functions.h"
+__BPF_FUNC_MAX_ID,
+};
+
+#ifdef __BPF_SOURCE__
+#undef DEFINE_BPF_FUNC
+#define DEFINE_BPF_FUNC(rettype, name, arglist...) static rettype
(*name)(arglist) = (void *)BPF_FUNC_##name
+#include "bpf_functions.h"
+#endif
/* integer value in 'imm' field of BPF_CALL instruction selects which
helper
* function eBPF program intends to call
*/
enum bpf_func_id {
- BPF_FUNC_unspec,
[SNIP]
And when compiling BPF source file we add a __BPF_SOURCE__ directive?
Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/