diff options
| -rw-r--r-- | Makefile | 10 | ||||
| -rw-r--r-- | internal/c/Makefile | 14 | ||||
| -rw-r--r-- | internal/c/flags.h (renamed from internal/flags/flags.bpf.h) | 0 | ||||
| -rw-r--r-- | internal/c/ioriotng.bpf.c (renamed from internal/ioriotng.bpf.c) | 8 | ||||
| -rw-r--r-- | internal/c/maps.h (renamed from internal/types/maps.bpf.h) | 0 | ||||
| -rw-r--r-- | internal/c/types.h (renamed from internal/types/types.bpf.h) | 0 |
6 files changed, 23 insertions, 9 deletions
@@ -11,9 +11,9 @@ build: bpfbuild gobuild .PHONY: bpfbuild bpfbuild: - bpftool btf dump file /sys/kernel/btf/vmlinux format c > ./internal/types/vmlinux.h - if [ ! -e ioriotng.bpf.c ]; then ln -s ./internal/ioriotng.bpf.c .; fi - $(CC) -g -O2 -Wall -fpie -target bpf -D__TARGET_ARCH_amd64 -I$(LIBBPFGO)/output -c ./internal/ioriotng.bpf.c -o ioriotng.bpf.o + make -C ./internal/c + if [ ! -e ioriotng.bpf.c ]; then ln -s ./internal/c/ioriotng.bpf.c .; fi + if [ ! -e ioriotng.bpf.o ]; then ln -s ./internal/c/ioriotng.bpf.o .; fi .PHONY: gobuild gobuild: @@ -22,9 +22,9 @@ gobuild: .PHONY: clean clean: find . -type f -name ioriotng -delete - find . -name \*.o -delete - find . -name vmlinux.h -delete if [ -e ioriotng.bpf.c ]; then rm ioriotng.bpf.c; fi + if [ -e ioriotng.bpf.o ]; then rm ioriotng.bpf.o; fi + make -C ./internal/c clean .PHONY: run run: diff --git a/internal/c/Makefile b/internal/c/Makefile new file mode 100644 index 0000000..196b2d3 --- /dev/null +++ b/internal/c/Makefile @@ -0,0 +1,14 @@ +export LIBBPFGO = $(CURDIR)/../../../libbpfgo +export CC = clang + +all: bpfbuild + +.PHONY: bpfbuild +bpfbuild: + bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h + $(CC) -g -O2 -Wall -fpie -target bpf -D__TARGET_ARCH_amd64 -I$(LIBBPFGO)/output -c ioriotng.bpf.c -o ioriotng.bpf.o + +.PHONY: clean +clean: + find . -name \*.o -delete + find . -name vmlinux.h -delete diff --git a/internal/flags/flags.bpf.h b/internal/c/flags.h index 53b9492..53b9492 100644 --- a/internal/flags/flags.bpf.h +++ b/internal/c/flags.h diff --git a/internal/ioriotng.bpf.c b/internal/c/ioriotng.bpf.c index 3948529..c9c9c88 100644 --- a/internal/ioriotng.bpf.c +++ b/internal/c/ioriotng.bpf.c @@ -1,10 +1,10 @@ //+build ignore -#include "types/vmlinux.h" +#include "vmlinux.h" #include <bpf/bpf_helpers.h> -#include "types/types.bpf.h" -#include "types/maps.bpf.h" -#include "flags/flags.bpf.h" +#include "types.h" +#include "maps.h" +#include "flags.h" static __always_inline int filter() { return (bpf_get_current_uid_gid() & 0xFFFFFFFF) != UID_FILTER; diff --git a/internal/types/maps.bpf.h b/internal/c/maps.h index 7ec871c..7ec871c 100644 --- a/internal/types/maps.bpf.h +++ b/internal/c/maps.h diff --git a/internal/types/types.bpf.h b/internal/c/types.h index 25cfcd8..25cfcd8 100644 --- a/internal/types/types.bpf.h +++ b/internal/c/types.h |
