aboutgitcodelistschat:MatrixIRC
path: root/cooker/filter.h
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-05-16 18:05:46 +0200
committerAlice Frosi <afrosi@redhat.com>2023-05-17 10:55:11 +0200
commit16346c99a674d95970cfc59b0aa5d00e91cc4e0f (patch)
treec10f01f1d33108ac17bec484ac570e4a431ded0b /cooker/filter.h
parentaeaeda81af25fdc105d4157dc9e679423fdef761 (diff)
downloadseitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar.gz
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar.bz2
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar.lz
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar.xz
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.tar.zst
seitan-16346c99a674d95970cfc59b0aa5d00e91cc4e0f.zip
filter: refactoring filter
Attempt to simplify the filter build: - storing all the bpf_args in a common array and saving the index of each entry in filter_input - added new flag to filter_add_arg for append an argument to an entry - split large loop in filter_build in multiple functions - adjust and refactor tests/units/test_filter The tests in test_filter_build.c still need to be fixed
Diffstat (limited to 'cooker/filter.h')
-rw-r--r--cooker/filter.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/cooker/filter.h b/cooker/filter.h
index 7059a7c..0ec1204 100644
--- a/cooker/filter.h
+++ b/cooker/filter.h
@@ -44,6 +44,10 @@
#define MAX_JUMPS 128
#define EMPTY -1
+#define N_SYSCALL 512
+#define MAX_ENTRIES_SYSCALL 16
+#define MAX_ENTRIES N_SYSCALL * MAX_ENTRIES_SYSCALL
+
enum bpf_type { BPF_U32, BPF_U64 };
union bpf_value {
@@ -60,12 +64,13 @@ struct bpf_arg {
union bpf_value op2;
};
+struct bpf_entry {
+ struct bpf_arg args[6];
+};
+
void filter_notify(long nr);
void filter_needs_deref(void);
-void filter_add_arg(int index, struct bpf_arg arg);
+void filter_add_arg(int index, struct bpf_arg arg, bool append);
void filter_write(const char *path);
-void create_lookup_nodes(int jumps[], unsigned int n);
-unsigned int left_child(unsigned int parent_index);
-unsigned int right_child(unsigned int parent_index);
#endif