internal.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * internal.h - declarations internal to debugfs
  4. *
  5. * Copyright (C) 2016 Nicolai Stange <nicstange@gmail.com>
  6. */
  7. #ifndef _DEBUGFS_INTERNAL_H_
  8. #define _DEBUGFS_INTERNAL_H_
  9. #include <linux/list.h>
  10. struct file_operations;
  11. struct debugfs_inode_info {
  12. struct inode vfs_inode;
  13. union {
  14. const void *raw;
  15. const struct file_operations *real_fops;
  16. const struct debugfs_short_fops *short_fops;
  17. debugfs_automount_t automount;
  18. };
  19. void *aux;
  20. };
  21. static inline struct debugfs_inode_info *DEBUGFS_I(struct inode *inode)
  22. {
  23. return container_of(inode, struct debugfs_inode_info, vfs_inode);
  24. }
  25. /* declared over in file.c */
  26. extern const struct file_operations debugfs_noop_file_operations;
  27. extern const struct file_operations debugfs_open_proxy_file_operations;
  28. extern const struct file_operations debugfs_full_proxy_file_operations;
  29. extern const struct file_operations debugfs_full_short_proxy_file_operations;
  30. struct debugfs_fsdata {
  31. const struct file_operations *real_fops;
  32. const struct debugfs_short_fops *short_fops;
  33. struct {
  34. refcount_t active_users;
  35. struct completion active_users_drained;
  36. /* protect cancellations */
  37. struct mutex cancellations_mtx;
  38. struct list_head cancellations;
  39. unsigned int methods;
  40. };
  41. };
  42. enum {
  43. HAS_READ = 1,
  44. HAS_WRITE = 2,
  45. HAS_LSEEK = 4,
  46. HAS_POLL = 8,
  47. HAS_IOCTL = 16
  48. };
  49. #endif /* _DEBUGFS_INTERNAL_H_ */