Commit 5e7be3e1 authored by Wang Nan's avatar Wang Nan Committed by Arnaldo Carvalho de Melo

tools lib api fs: Add hugetlbfs filesystem detector

Detect hugetlbfs. hugetlbfs__mountpoint() will be used during recording
to help identifying hugetlb mmaps: which should be recognized as anon
mapping.
Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
Reviewed-by: default avatarNilay Vaish <nilayvaish@gmail.com>
Cc: He Kuang <hekuang@huawei.com>
Cc: Hou Pengyang <houpengyang@huawei.com>
Cc: Zefan Li <lizefan@huawei.com>
Link: http://lkml.kernel.org/r/1473137909-142064-3-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 0ac3348e
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#define TRACEFS_MAGIC 0x74726163 #define TRACEFS_MAGIC 0x74726163
#endif #endif
#ifndef HUGETLBFS_MAGIC
#define HUGETLBFS_MAGIC 0x958458f6
#endif
static const char * const sysfs__fs_known_mountpoints[] = { static const char * const sysfs__fs_known_mountpoints[] = {
"/sys", "/sys",
0, 0,
...@@ -67,6 +71,10 @@ static const char * const tracefs__known_mountpoints[] = { ...@@ -67,6 +71,10 @@ static const char * const tracefs__known_mountpoints[] = {
0, 0,
}; };
static const char * const hugetlbfs__known_mountpoints[] = {
0,
};
struct fs { struct fs {
const char *name; const char *name;
const char * const *mounts; const char * const *mounts;
...@@ -80,6 +88,7 @@ enum { ...@@ -80,6 +88,7 @@ enum {
FS__PROCFS = 1, FS__PROCFS = 1,
FS__DEBUGFS = 2, FS__DEBUGFS = 2,
FS__TRACEFS = 3, FS__TRACEFS = 3,
FS__HUGETLBFS = 4,
}; };
#ifndef TRACEFS_MAGIC #ifndef TRACEFS_MAGIC
...@@ -107,6 +116,11 @@ static struct fs fs__entries[] = { ...@@ -107,6 +116,11 @@ static struct fs fs__entries[] = {
.mounts = tracefs__known_mountpoints, .mounts = tracefs__known_mountpoints,
.magic = TRACEFS_MAGIC, .magic = TRACEFS_MAGIC,
}, },
[FS__HUGETLBFS] = {
.name = "hugetlbfs",
.mounts = hugetlbfs__known_mountpoints,
.magic = HUGETLBFS_MAGIC,
},
}; };
static bool fs__read_mounts(struct fs *fs) static bool fs__read_mounts(struct fs *fs)
...@@ -265,6 +279,7 @@ FS(sysfs, FS__SYSFS); ...@@ -265,6 +279,7 @@ FS(sysfs, FS__SYSFS);
FS(procfs, FS__PROCFS); FS(procfs, FS__PROCFS);
FS(debugfs, FS__DEBUGFS); FS(debugfs, FS__DEBUGFS);
FS(tracefs, FS__TRACEFS); FS(tracefs, FS__TRACEFS);
FS(hugetlbfs, FS__HUGETLBFS);
int filename__read_int(const char *filename, int *value) int filename__read_int(const char *filename, int *value)
{ {
......
...@@ -21,6 +21,7 @@ FS(sysfs) ...@@ -21,6 +21,7 @@ FS(sysfs)
FS(procfs) FS(procfs)
FS(debugfs) FS(debugfs)
FS(tracefs) FS(tracefs)
FS(hugetlbfs)
#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