Jinbum Park | 4fb69cc | 2017-12-12 01:41:09 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | #include <linux/debugfs.h> |
| 3 | #include <linux/seq_file.h> |
| 4 | |
| 5 | #include <asm/ptdump.h> |
| 6 | |
| 7 | static int ptdump_show(struct seq_file *m, void *v) |
| 8 | { |
| 9 | struct ptdump_info *info = m->private; |
| 10 | |
| 11 | ptdump_walk_pgd(m, info); |
| 12 | return 0; |
| 13 | } |
| 14 | |
| 15 | static int ptdump_open(struct inode *inode, struct file *file) |
| 16 | { |
| 17 | return single_open(file, ptdump_show, inode->i_private); |
| 18 | } |
| 19 | |
| 20 | static const struct file_operations ptdump_fops = { |
| 21 | .open = ptdump_open, |
| 22 | .read = seq_read, |
| 23 | .llseek = seq_lseek, |
| 24 | .release = single_release, |
| 25 | }; |
| 26 | |
Greg Kroah-Hartman | db0487a | 2019-01-22 15:41:12 +0100 | [diff] [blame^] | 27 | void ptdump_debugfs_register(struct ptdump_info *info, const char *name) |
Jinbum Park | 4fb69cc | 2017-12-12 01:41:09 +0100 | [diff] [blame] | 28 | { |
Greg Kroah-Hartman | db0487a | 2019-01-22 15:41:12 +0100 | [diff] [blame^] | 29 | debugfs_create_file(name, 0400, NULL, info, &ptdump_fops); |
Jinbum Park | 4fb69cc | 2017-12-12 01:41:09 +0100 | [diff] [blame] | 30 | } |