Skip to content

Commit 71dc4c3

Browse files
joestringeracmel
authored andcommitted
tools lib api fs: Add bpf_fs filesystem detector
Allow mounting of the BPF filesystem at /sys/fs/bpf. Signed-off-by: Joe 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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 9a9c733 commit 71dc4c3

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

‎tools/lib/api/fs/fs.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#define HUGETLBFS_MAGIC 0x958458f6
3939
#endif
4040

41+
#ifndef BPF_FS_MAGIC
42+
#define BPF_FS_MAGIC 0xcafe4a11
43+
#endif
44+
4145
static const char * const sysfs__fs_known_mountpoints[] = {
4246
"/sys",
4347
0,
@@ -75,6 +79,11 @@ static const char * const hugetlbfs__known_mountpoints[] = {
7579
0,
7680
};
7781

82+
static const char * const bpf_fs__known_mountpoints[] = {
83+
"/sys/fs/bpf",
84+
0,
85+
};
86+
7887
struct fs {
7988
const char *name;
8089
const char * const *mounts;
@@ -89,6 +98,7 @@ enum {
8998
FS__DEBUGFS = 2,
9099
FS__TRACEFS = 3,
91100
FS__HUGETLBFS = 4,
101+
FS__BPF_FS = 5,
92102
};
93103

94104
#ifndef TRACEFS_MAGIC
@@ -121,6 +131,11 @@ static struct fs fs__entries[] = {
121131
.mounts = hugetlbfs__known_mountpoints,
122132
.magic = HUGETLBFS_MAGIC,
123133
},
134+
[FS__BPF_FS] = {
135+
.name = "bpf",
136+
.mounts = bpf_fs__known_mountpoints,
137+
.magic = BPF_FS_MAGIC,
138+
},
124139
};
125140

126141
static bool fs__read_mounts(struct fs *fs)
@@ -280,6 +295,7 @@ FS(procfs, FS__PROCFS);
280295
FS(debugfs, FS__DEBUGFS);
281296
FS(tracefs, FS__TRACEFS);
282297
FS(hugetlbfs, FS__HUGETLBFS);
298+
FS(bpf_fs, FS__BPF_FS);
283299

284300
int filename__read_int(const char *filename, int *value)
285301
{

‎tools/lib/api/fs/fs.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ FS(procfs)
2222
FS(debugfs)
2323
FS(tracefs)
2424
FS(hugetlbfs)
25+
FS(bpf_fs)
2526

2627
#undef FS
2728

0 commit comments

Comments
 (0)