diff mbox series

[RFC,03/12] ebpf/uBPF: Introduce userspace ebpf data structure

Message ID 20220617073630.535914-4-chen.zhang@intel.com (mailing list archive)
State New, archived
Headers show
Series Introduce QEMU userspace ebpf support | expand

Commit Message

Zhang Chen June 17, 2022, 7:36 a.m. UTC
Add ebpf/ubpf.h for the UbpfState.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 ebpf/ubpf.h | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 ebpf/ubpf.h
diff mbox series

Patch

diff --git a/ebpf/ubpf.h b/ebpf/ubpf.h
new file mode 100644
index 0000000000..2562fff503
--- /dev/null
+++ b/ebpf/ubpf.h
@@ -0,0 +1,37 @@ 
+/*
+ * QEMU Userspace eBPF Header
+ *
+ * Copyright(C) 2022 Intel Corporation.
+ *
+ * Author:
+ *  Zhang Chen <chen.zhang@intel.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ *
+ */
+
+#ifndef QEMU_UBPF_H
+#define QEMU_UBPF_H
+
+#include <ubpf.h>
+#include <math.h>
+#include <elf.h>
+
+#define MAX_LEN (1024 * 1024)
+
+typedef struct UbpfState {
+    bool jit;
+    char *code_path;
+    void *code;
+    size_t code_len;
+    char *target_path;
+    void *target;
+    size_t target_len;
+    struct ubpf_vm *vm;
+    ubpf_jit_fn fn;
+    int type;
+    char *func;
+} UbpfState;
+
+#endif /* QEMU_UBPF_H */