Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ generated*/
*/__pycache__
.idea
.vscode
venv
venv

# for clangd
compile_commands.json
.cache
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ LDFLAGS := $(DBGFLAGS) -lz3 -lpthread -lz
## Building Targets
########################################################################

.PHONY: clean all lib fgen pgen bins gen-func-set gen-func-set-check-ubs gen-prog-set gen-prog-set-check
.PHONY: clean all lib fgen pgen bins gen-func-set gen-func-set-check-ubs gen-prog-set gen-prog-set-check bpf_test

all: lib bins

Expand Down Expand Up @@ -107,11 +107,17 @@ $(BIN_DIR)/pgen: $(LIB_OBJ) $(OBJ_DIR)/prog_gen.o
@mkdir -p $(dir $@)
$(CXX) -o $@ $^ $(LDFLAGS)

$(BIN_DIR)/bpf_test: $(LIB_OBJ) $(OBJ_DIR)/bpf_test.o
@mkdir -p $(dir $@)
$(CXX) -o $@ $^ $(LDFLAGS)

fgen: $(BIN_DIR)/fgen

pgen: $(BIN_DIR)/pgen

bins: fgen pgen
bpf_test: $(BIN_DIR)/bpf_test

bins: fgen pgen bpf_test


########################################################################
Expand Down
13 changes: 13 additions & 0 deletions include/global.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ static std::filesystem::path GetProgramsDir(const std::filesystem::path &output)
return output / "programs";
}

static std::filesystem::path GeteBPFDir(const std::filesystem::path &output) {
return output / "ebpf_progs";
}

static std::string GetFunctionName(const std::string &uuid, const std::string &sno) {
return std::string(FUNCTION_NAME_PREFIX) + "_" + uuid + "_" + sno;
}
Expand Down Expand Up @@ -489,6 +493,15 @@ static std::filesystem::path GetProgramPath(
return GetProgramsDir(output) / GetProgramNameForFunctionName(GetFunctionName(uuid, sno));
}

static std::string GeteBPFProgramNameForFunctionName(const std::string &functionName) {
return functionName.substr(std::string(FUNCTION_NAME_PREFIX).size() + 1) + ".bpf";
}

static std::filesystem::path
GeteBPFPath(const std::string &uuid, const std::string &sno, const std::filesystem::path &output) {
return GeteBPFDir(output) / GeteBPFProgramNameForFunctionName(GetFunctionName(uuid, sno));
}

static std::filesystem::path
GetGetProgramPathPathForFunctionPath(const std::filesystem::path &functionPath) {
return GetProgramsDir(functionPath.parent_path().parent_path()) /
Expand Down
Loading