debug.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0-or-later */
  2. /*
  3. * debug.h - NTFS kernel debug support. Part of the Linux-NTFS project.
  4. *
  5. * Copyright (c) 2001-2004 Anton Altaparmakov
  6. */
  7. #ifndef _LINUX_NTFS_DEBUG_H
  8. #define _LINUX_NTFS_DEBUG_H
  9. #include <linux/fs.h>
  10. #include "runlist.h"
  11. #ifdef DEBUG
  12. extern int debug_msgs;
  13. extern __printf(4, 5)
  14. void __ntfs_debug(const char *file, int line, const char *function,
  15. const char *format, ...);
  16. /**
  17. * ntfs_debug - write a debug level message to syslog
  18. * @f: a printf format string containing the message
  19. * @...: the variables to substitute into @f
  20. *
  21. * ntfs_debug() writes a DEBUG level message to the syslog but only if the
  22. * driver was compiled with -DDEBUG. Otherwise, the call turns into a NOP.
  23. */
  24. #define ntfs_debug(f, a...) \
  25. __ntfs_debug(__FILE__, __LINE__, __func__, f, ##a)
  26. extern void ntfs_debug_dump_runlist(const runlist_element *rl);
  27. #else /* !DEBUG */
  28. #define ntfs_debug(fmt, ...) \
  29. do { \
  30. if (0) \
  31. no_printk(fmt, ##__VA_ARGS__); \
  32. } while (0)
  33. #define ntfs_debug_dump_runlist(rl) do {} while (0)
  34. #endif /* !DEBUG */
  35. extern __printf(3, 4)
  36. void __ntfs_warning(const char *function, const struct super_block *sb,
  37. const char *fmt, ...);
  38. #define ntfs_warning(sb, f, a...) __ntfs_warning(__func__, sb, f, ##a)
  39. extern __printf(3, 4)
  40. void __ntfs_error(const char *function, const struct super_block *sb,
  41. const char *fmt, ...);
  42. #define ntfs_error(sb, f, a...) __ntfs_error(__func__, sb, f, ##a)
  43. #endif /* _LINUX_NTFS_DEBUG_H */