diff options
| -rw-r--r-- | arch/x86/mm/debug_pagetables.c | 58 |
1 files changed, 7 insertions, 51 deletions
diff --git a/arch/x86/mm/debug_pagetables.c b/arch/x86/mm/debug_pagetables.c index 225fe2f0bfec..cd84f067e41d 100644 --- a/arch/x86/mm/debug_pagetables.c +++ b/arch/x86/mm/debug_pagetables.c | |||
| @@ -10,20 +10,9 @@ static int ptdump_show(struct seq_file *m, void *v) | |||
| 10 | return 0; | 10 | return 0; |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | static int ptdump_open(struct inode *inode, struct file *filp) | 13 | DEFINE_SHOW_ATTRIBUTE(ptdump); |
| 14 | { | ||
| 15 | return single_open(filp, ptdump_show, NULL); | ||
| 16 | } | ||
| 17 | |||
| 18 | static const struct file_operations ptdump_fops = { | ||
| 19 | .owner = THIS_MODULE, | ||
| 20 | .open = ptdump_open, | ||
| 21 | .read = seq_read, | ||
| 22 | .llseek = seq_lseek, | ||
| 23 | .release = single_release, | ||
| 24 | }; | ||
| 25 | 14 | ||
| 26 | static int ptdump_show_curknl(struct seq_file *m, void *v) | 15 | static int ptdump_curknl_show(struct seq_file *m, void *v) |
| 27 | { | 16 | { |
| 28 | if (current->mm->pgd) { | 17 | if (current->mm->pgd) { |
| 29 | down_read(¤t->mm->mmap_sem); | 18 | down_read(¤t->mm->mmap_sem); |
| @@ -33,23 +22,12 @@ static int ptdump_show_curknl(struct seq_file *m, void *v) | |||
| 33 | return 0; | 22 | return 0; |
| 34 | } | 23 | } |
| 35 | 24 | ||
| 36 | static int ptdump_open_curknl(struct inode *inode, struct file *filp) | 25 | DEFINE_SHOW_ATTRIBUTE(ptdump_curknl); |
| 37 | { | ||
| 38 | return single_open(filp, ptdump_show_curknl, NULL); | ||
| 39 | } | ||
| 40 | |||
| 41 | static const struct file_operations ptdump_curknl_fops = { | ||
| 42 | .owner = THIS_MODULE, | ||
| 43 | .open = ptdump_open_curknl, | ||
| 44 | .read = seq_read, | ||
| 45 | .llseek = seq_lseek, | ||
| 46 | .release = single_release, | ||
| 47 | }; | ||
| 48 | 26 | ||
| 49 | #ifdef CONFIG_PAGE_TABLE_ISOLATION | 27 | #ifdef CONFIG_PAGE_TABLE_ISOLATION |
| 50 | static struct dentry *pe_curusr; | 28 | static struct dentry *pe_curusr; |
| 51 | 29 | ||
| 52 | static int ptdump_show_curusr(struct seq_file *m, void *v) | 30 | static int ptdump_curusr_show(struct seq_file *m, void *v) |
| 53 | { | 31 | { |
| 54 | if (current->mm->pgd) { | 32 | if (current->mm->pgd) { |
| 55 | down_read(¤t->mm->mmap_sem); | 33 | down_read(¤t->mm->mmap_sem); |
| @@ -59,42 +37,20 @@ static int ptdump_show_curusr(struct seq_file *m, void *v) | |||
| 59 | return 0; | 37 | return 0; |
| 60 | } | 38 | } |
| 61 | 39 | ||
| 62 | static int ptdump_open_curusr(struct inode *inode, struct file *filp) | 40 | DEFINE_SHOW_ATTRIBUTE(ptdump_curusr); |
| 63 | { | ||
| 64 | return single_open(filp, ptdump_show_curusr, NULL); | ||
| 65 | } | ||
| 66 | |||
| 67 | static const struct file_operations ptdump_curusr_fops = { | ||
| 68 | .owner = THIS_MODULE, | ||
| 69 | .open = ptdump_open_curusr, | ||
| 70 | .read = seq_read, | ||
| 71 | .llseek = seq_lseek, | ||
| 72 | .release = single_release, | ||
| 73 | }; | ||
| 74 | #endif | 41 | #endif |
| 75 | 42 | ||
| 76 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) | 43 | #if defined(CONFIG_EFI) && defined(CONFIG_X86_64) |
| 77 | static struct dentry *pe_efi; | 44 | static struct dentry *pe_efi; |
| 78 | 45 | ||
| 79 | static int ptdump_show_efi(struct seq_file *m, void *v) | 46 | static int ptdump_efi_show(struct seq_file *m, void *v) |
| 80 | { | 47 | { |
| 81 | if (efi_mm.pgd) | 48 | if (efi_mm.pgd) |
| 82 | ptdump_walk_pgd_level_debugfs(m, efi_mm.pgd, false); | 49 | ptdump_walk_pgd_level_debugfs(m, efi_mm.pgd, false); |
| 83 | return 0; | 50 | return 0; |
| 84 | } | 51 | } |
| 85 | 52 | ||
| 86 | static int ptdump_open_efi(struct inode *inode, struct file *filp) | 53 | DEFINE_SHOW_ATTRIBUTE(ptdump_efi); |
| 87 | { | ||
| 88 | return single_open(filp, ptdump_show_efi, NULL); | ||
| 89 | } | ||
| 90 | |||
| 91 | static const struct file_operations ptdump_efi_fops = { | ||
| 92 | .owner = THIS_MODULE, | ||
| 93 | .open = ptdump_open_efi, | ||
| 94 | .read = seq_read, | ||
| 95 | .llseek = seq_lseek, | ||
| 96 | .release = single_release, | ||
| 97 | }; | ||
| 98 | #endif | 54 | #endif |
| 99 | 55 | ||
| 100 | static struct dentry *dir, *pe_knl, *pe_curknl; | 56 | static struct dentry *dir, *pe_knl, *pe_curknl; |
