Commit 71dc4c30 authored by Joe Stringer's avatar Joe Stringer Committed by Arnaldo Carvalho de Melo

tools lib api fs: Add bpf_fs filesystem detector

Allow mounting of the BPF filesystem at /sys/fs/bpf.
Signed-off-by: default avatarJoe Stringer <joe@ovn.org>
Cc: Alexei Starovoitov <ast@fb.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: netdev@vger.kernel.org
Link: http://lkml.kernel.org/r/20170126212001.14103-6-joe@ovn.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 9a9c733d
...@@ -38,6 +38,10 @@ ...@@ -38,6 +38,10 @@
#define HUGETLBFS_MAGIC 0x958458f6 #define HUGETLBFS_MAGIC 0x958458f6
#endif #endif
#ifndef BPF_FS_MAGIC
#define BPF_FS_MAGIC 0xcafe4a11
#endif
static const char * const sysfs__fs_known_mountpoints[] = { static const char * const sysfs__fs_known_mountpoints[] = {
"/sys", "/sys",
0, 0,
...@@ -75,6 +79,11 @@ static const char * const hugetlbfs__known_mountpoints[] = { ...@@ -75,6 +79,11 @@ static const char * const hugetlbfs__known_mountpoints[] = {
0, 0,
}; };
static const char * const bpf_fs__known_mountpoints[] = {
"/sys/fs/bpf",
0,
};
struct fs { struct fs {
const char *name; const char *name;
const char * const *mounts; const char * const *mounts;
...@@ -89,6 +98,7 @@ enum { ...@@ -89,6 +98,7 @@ enum {
FS__DEBUGFS = 2, FS__DEBUGFS = 2,
FS__TRACEFS = 3, FS__TRACEFS = 3,
FS__HUGETLBFS = 4, FS__HUGETLBFS = 4,
FS__BPF_FS = 5,
}; };
#ifndef TRACEFS_MAGIC #ifndef TRACEFS_MAGIC
...@@ -121,6 +131,11 @@ static struct fs fs__entries[] = { ...@@ -121,6 +131,11 @@ static struct fs fs__entries[] = {
.mounts = hugetlbfs__known_mountpoints, .mounts = hugetlbfs__known_mountpoints,
.magic = HUGETLBFS_MAGIC, .magic = HUGETLBFS_MAGIC,
}, },
[FS__BPF_FS] = {
.name = "bpf",
.mounts = bpf_fs__known_mountpoints,
.magic = BPF_FS_MAGIC,
},
}; };
static bool fs__read_mounts(struct fs *fs) static bool fs__read_mounts(struct fs *fs)
...@@ -280,6 +295,7 @@ FS(procfs, FS__PROCFS); ...@@ -280,6 +295,7 @@ FS(procfs, FS__PROCFS);
FS(debugfs, FS__DEBUGFS); FS(debugfs, FS__DEBUGFS);
FS(tracefs, FS__TRACEFS); FS(tracefs, FS__TRACEFS);
FS(hugetlbfs, FS__HUGETLBFS); FS(hugetlbfs, FS__HUGETLBFS);
FS(bpf_fs, FS__BPF_FS);
int filename__read_int(const char *filename, int *value) int filename__read_int(const char *filename, int *value)
{ {
......
...@@ -22,6 +22,7 @@ FS(procfs) ...@@ -22,6 +22,7 @@ FS(procfs)
FS(debugfs) FS(debugfs)
FS(tracefs) FS(tracefs)
FS(hugetlbfs) FS(hugetlbfs)
FS(bpf_fs)
#undef FS #undef FS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment