internal.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * internal.h - declarations internal to debugfs
  4. *
  5. * Copyright (C) 2016 Nicolai Stange <[email protected]>
  6. */
  7. #ifndef _DEBUGFS_INTERNAL_H_
  8. #define _DEBUGFS_INTERNAL_H_
  9. struct file_operations;
  10. /* declared over in file.c */
  11. extern const struct file_operations debugfs_noop_file_operations;
  12. extern const struct file_operations debugfs_open_proxy_file_operations;
  13. extern const struct file_operations debugfs_full_proxy_file_operations;
  14. struct debugfs_fsdata {
  15. const struct file_operations *real_fops;
  16. refcount_t active_users;
  17. struct completion active_users_drained;
  18. };
  19. /*
  20. * A dentry's ->d_fsdata either points to the real fops or to a
  21. * dynamically allocated debugfs_fsdata instance.
  22. * In order to distinguish between these two cases, a real fops
  23. * pointer gets its lowest bit set.
  24. */
  25. #define DEBUGFS_FSDATA_IS_REAL_FOPS_BIT BIT(0)
  26. /* Access BITS */
  27. #define DEBUGFS_ALLOW_API BIT(0)
  28. #define DEBUGFS_ALLOW_MOUNT BIT(1)
  29. #ifdef CONFIG_DEBUG_FS_ALLOW_ALL
  30. #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_MOUNT | DEBUGFS_ALLOW_API)
  31. #endif
  32. #ifdef CONFIG_DEBUG_FS_DISALLOW_MOUNT
  33. #define DEFAULT_DEBUGFS_ALLOW_BITS (DEBUGFS_ALLOW_API)
  34. #endif
  35. #ifdef CONFIG_DEBUG_FS_ALLOW_NONE
  36. #define DEFAULT_DEBUGFS_ALLOW_BITS (0)
  37. #endif
  38. #endif /* _DEBUGFS_INTERNAL_H_ */