blob: eee4d864350c3e03d1d1f1d0e3bf4f2479ed2efe [file] [log] [blame]
Laura Abbott4ddb9bf2016-10-27 09:27:31 -07001#include <linux/debugfs.h>
2#include <linux/seq_file.h>
3
4#include <asm/ptdump.h>
5
6static int ptdump_show(struct seq_file *m, void *v)
7{
8 struct ptdump_info *info = m->private;
9 ptdump_walk_pgd(m, info);
10 return 0;
11}
12
13static int ptdump_open(struct inode *inode, struct file *file)
14{
15 return single_open(file, ptdump_show, inode->i_private);
16}
17
18static const struct file_operations ptdump_fops = {
19 .open = ptdump_open,
20 .read = seq_read,
21 .llseek = seq_lseek,
22 .release = single_release,
23};
24
25int ptdump_debugfs_register(struct ptdump_info *info, const char *name)
26{
27 struct dentry *pe;
28 pe = debugfs_create_file(name, 0400, NULL, info, &ptdump_fops);
29 return pe ? 0 : -ENOMEM;
30
31}