orangefs-debug.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * (C) 2001 Clemson University and The University of Chicago
  3. *
  4. * See COPYING in top-level directory.
  5. */
  6. /* This file just defines debugging masks to be used with the gossip
  7. * logging utility. All debugging masks for ORANGEFS are kept here to make
  8. * sure we don't have collisions.
  9. */
  10. #ifndef __ORANGEFS_DEBUG_H
  11. #define __ORANGEFS_DEBUG_H
  12. #ifdef __KERNEL__
  13. #include <linux/types.h>
  14. #else
  15. #include <stdint.h>
  16. #endif
  17. #define GOSSIP_NO_DEBUG (__u64)0
  18. #define GOSSIP_SUPER_DEBUG ((__u64)1 << 0)
  19. #define GOSSIP_INODE_DEBUG ((__u64)1 << 1)
  20. #define GOSSIP_FILE_DEBUG ((__u64)1 << 2)
  21. #define GOSSIP_DIR_DEBUG ((__u64)1 << 3)
  22. #define GOSSIP_UTILS_DEBUG ((__u64)1 << 4)
  23. #define GOSSIP_WAIT_DEBUG ((__u64)1 << 5)
  24. #define GOSSIP_ACL_DEBUG ((__u64)1 << 6)
  25. #define GOSSIP_DCACHE_DEBUG ((__u64)1 << 7)
  26. #define GOSSIP_DEV_DEBUG ((__u64)1 << 8)
  27. #define GOSSIP_NAME_DEBUG ((__u64)1 << 9)
  28. #define GOSSIP_BUFMAP_DEBUG ((__u64)1 << 10)
  29. #define GOSSIP_CACHE_DEBUG ((__u64)1 << 11)
  30. #define GOSSIP_DEBUGFS_DEBUG ((__u64)1 << 12)
  31. #define GOSSIP_XATTR_DEBUG ((__u64)1 << 13)
  32. #define GOSSIP_INIT_DEBUG ((__u64)1 << 14)
  33. #define GOSSIP_SYSFS_DEBUG ((__u64)1 << 15)
  34. #define GOSSIP_MAX_NR 16
  35. #define GOSSIP_MAX_DEBUG (((__u64)1 << GOSSIP_MAX_NR) - 1)
  36. /*function prototypes*/
  37. __u64 ORANGEFS_kmod_eventlog_to_mask(const char *event_logging);
  38. __u64 ORANGEFS_debug_eventlog_to_mask(const char *event_logging);
  39. char *ORANGEFS_debug_mask_to_eventlog(__u64 mask);
  40. char *ORANGEFS_kmod_mask_to_eventlog(__u64 mask);
  41. /* a private internal type */
  42. struct __keyword_mask_s {
  43. const char *keyword;
  44. __u64 mask_val;
  45. };
  46. /*
  47. * Map all kmod keywords to kmod debug masks here. Keep this
  48. * structure "packed":
  49. *
  50. * "all" is always last...
  51. *
  52. * keyword mask_val index
  53. * foo 1 0
  54. * bar 2 1
  55. * baz 4 2
  56. * qux 8 3
  57. * . . .
  58. */
  59. static struct __keyword_mask_s s_kmod_keyword_mask_map[] = {
  60. {"super", GOSSIP_SUPER_DEBUG},
  61. {"inode", GOSSIP_INODE_DEBUG},
  62. {"file", GOSSIP_FILE_DEBUG},
  63. {"dir", GOSSIP_DIR_DEBUG},
  64. {"utils", GOSSIP_UTILS_DEBUG},
  65. {"wait", GOSSIP_WAIT_DEBUG},
  66. {"acl", GOSSIP_ACL_DEBUG},
  67. {"dcache", GOSSIP_DCACHE_DEBUG},
  68. {"dev", GOSSIP_DEV_DEBUG},
  69. {"name", GOSSIP_NAME_DEBUG},
  70. {"bufmap", GOSSIP_BUFMAP_DEBUG},
  71. {"cache", GOSSIP_CACHE_DEBUG},
  72. {"debugfs", GOSSIP_DEBUGFS_DEBUG},
  73. {"xattr", GOSSIP_XATTR_DEBUG},
  74. {"init", GOSSIP_INIT_DEBUG},
  75. {"sysfs", GOSSIP_SYSFS_DEBUG},
  76. {"none", GOSSIP_NO_DEBUG},
  77. {"all", GOSSIP_MAX_DEBUG}
  78. };
  79. static const int num_kmod_keyword_mask_map = (int)
  80. (sizeof(s_kmod_keyword_mask_map) / sizeof(struct __keyword_mask_s));
  81. #endif /* __ORANGEFS_DEBUG_H */