Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Joe Stringer and committed by
Arnaldo Carvalho de Melo
71dc4c30 9a9c733d

+17
+16
tools/lib/api/fs/fs.c
··· 38 38 #define HUGETLBFS_MAGIC 0x958458f6 39 39 #endif 40 40 41 + #ifndef BPF_FS_MAGIC 42 + #define BPF_FS_MAGIC 0xcafe4a11 43 + #endif 44 + 41 45 static const char * const sysfs__fs_known_mountpoints[] = { 42 46 "/sys", 43 47 0, ··· 79 75 0, 80 76 }; 81 77 78 + static const char * const bpf_fs__known_mountpoints[] = { 79 + "/sys/fs/bpf", 80 + 0, 81 + }; 82 + 82 83 struct fs { 83 84 const char *name; 84 85 const char * const *mounts; ··· 98 89 FS__DEBUGFS = 2, 99 90 FS__TRACEFS = 3, 100 91 FS__HUGETLBFS = 4, 92 + FS__BPF_FS = 5, 101 93 }; 102 94 103 95 #ifndef TRACEFS_MAGIC ··· 130 120 .name = "hugetlbfs", 131 121 .mounts = hugetlbfs__known_mountpoints, 132 122 .magic = HUGETLBFS_MAGIC, 123 + }, 124 + [FS__BPF_FS] = { 125 + .name = "bpf", 126 + .mounts = bpf_fs__known_mountpoints, 127 + .magic = BPF_FS_MAGIC, 133 128 }, 134 129 }; 135 130 ··· 295 280 FS(debugfs, FS__DEBUGFS); 296 281 FS(tracefs, FS__TRACEFS); 297 282 FS(hugetlbfs, FS__HUGETLBFS); 283 + FS(bpf_fs, FS__BPF_FS); 298 284 299 285 int filename__read_int(const char *filename, int *value) 300 286 {
+1
tools/lib/api/fs/fs.h
··· 22 22 FS(debugfs) 23 23 FS(tracefs) 24 24 FS(hugetlbfs) 25 + FS(bpf_fs) 25 26 26 27 #undef FS 27 28