Support fuse prog types
When fuse-bpf lands in the kernel, support reading its bpf program type from /sys/fs/fuse/bpf_prog_type_fuse and load such programs. This is to allow development of fuse-bpf to continue, and is needed until such time as fuse-bpf is upstreamed and this value is fixed. Bug: 202785178 Test: Along with change to bpfprogs, prog_fuse_media_fuse_media appears in /sys/fs/bpf Change-Id: I83636f25b0a0c678b3ee48c6450d9c8dc157387b
This commit is contained in:
parent
2b203138cb
commit
9548f9fbed
1 changed files with 9 additions and 2 deletions
|
|
@ -28,9 +28,9 @@
|
|||
#include <sys/utsname.h>
|
||||
#include <unistd.h>
|
||||
|
||||
// This is BpfLoader v0.7
|
||||
// This is BpfLoader v0.8
|
||||
#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)
|
||||
|
||||
#include "../progs/include/bpf_map_def.h"
|
||||
|
|
@ -283,6 +283,13 @@ static enum bpf_prog_type getSectionType(string& name) {
|
|||
for (auto& snt : sectionNameTypes)
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue