ceph_debug.h 907 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _FS_CEPH_DEBUG_H
  3. #define _FS_CEPH_DEBUG_H
  4. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  5. #include <linux/string.h>
  6. #ifdef CONFIG_CEPH_LIB_PRETTYDEBUG
  7. /*
  8. * wrap pr_debug to include a filename:lineno prefix on each line.
  9. * this incurs some overhead (kernel size and execution time) due to
  10. * the extra function call at each call site.
  11. */
  12. # if defined(DEBUG) || defined(CONFIG_DYNAMIC_DEBUG)
  13. # define dout(fmt, ...) \
  14. pr_debug("%.*s %12.12s:%-4d : " fmt, \
  15. 8 - (int)sizeof(KBUILD_MODNAME), " ", \
  16. kbasename(__FILE__), __LINE__, ##__VA_ARGS__)
  17. # else
  18. /* faux printk call just to see any compiler warnings. */
  19. # define dout(fmt, ...) do { \
  20. if (0) \
  21. printk(KERN_DEBUG fmt, ##__VA_ARGS__); \
  22. } while (0)
  23. # endif
  24. #else
  25. /*
  26. * or, just wrap pr_debug
  27. */
  28. # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)
  29. #endif
  30. #endif