Support fuse prog types am: 9548f9fbed am: f691bedf1d am: 3c639df877

Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1894086

Change-Id: I88f01738e70527c69f3fe1e82dba86c728447e02
This commit is contained in:
Paul Lawrence 2021-11-29 16:58:46 +00:00 committed by Automerger Merge Worker
commit 848edf331f

View file

@ -28,9 +28,9 @@
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
// This is BpfLoader v0.7 // This is BpfLoader v0.8
#define BPFLOADER_VERSION_MAJOR 0u #define BPFLOADER_VERSION_MAJOR 0u
#define BPFLOADER_VERSION_MINOR 7u #define BPFLOADER_VERSION_MINOR 8u
#define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR) #define BPFLOADER_VERSION ((BPFLOADER_VERSION_MAJOR << 16) | BPFLOADER_VERSION_MINOR)
#include "../progs/include/bpf_map_def.h" #include "../progs/include/bpf_map_def.h"
@ -283,6 +283,13 @@ static enum bpf_prog_type getSectionType(string& name) {
for (auto& snt : sectionNameTypes) for (auto& snt : sectionNameTypes)
if (StartsWith(name, snt.name)) return snt.type; if (StartsWith(name, snt.name)) return snt.type;
// TODO Remove this code when fuse-bpf is upstream and this BPF_PROG_TYPE_FUSE is fixed
if (StartsWith(name, "fuse/")) {
int result = BPF_PROG_TYPE_UNSPEC;
ifstream("/sys/fs/fuse/bpf_prog_type_fuse") >> result;
return static_cast<bpf_prog_type>(result);
}
return BPF_PROG_TYPE_UNSPEC; return BPF_PROG_TYPE_UNSPEC;
} }