ptdump_debugfs.c 680 B

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