xfs_message.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __XFS_MESSAGE_H
  3. #define __XFS_MESSAGE_H 1
  4. struct xfs_mount;
  5. extern __printf(2, 3)
  6. void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
  7. extern __printf(2, 3)
  8. void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
  9. extern __printf(3, 4)
  10. void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
  11. extern __printf(2, 3)
  12. void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
  13. extern __printf(2, 3)
  14. void xfs_err(const struct xfs_mount *mp, const char *fmt, ...);
  15. extern __printf(2, 3)
  16. void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...);
  17. extern __printf(2, 3)
  18. void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...);
  19. extern __printf(2, 3)
  20. void xfs_info(const struct xfs_mount *mp, const char *fmt, ...);
  21. #ifdef DEBUG
  22. extern __printf(2, 3)
  23. void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
  24. #else
  25. static inline __printf(2, 3)
  26. void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
  27. {
  28. }
  29. #endif
  30. #define xfs_printk_ratelimited(func, dev, fmt, ...) \
  31. do { \
  32. static DEFINE_RATELIMIT_STATE(_rs, \
  33. DEFAULT_RATELIMIT_INTERVAL, \
  34. DEFAULT_RATELIMIT_BURST); \
  35. if (__ratelimit(&_rs)) \
  36. func(dev, fmt, ##__VA_ARGS__); \
  37. } while (0)
  38. #define xfs_emerg_ratelimited(dev, fmt, ...) \
  39. xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
  40. #define xfs_alert_ratelimited(dev, fmt, ...) \
  41. xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
  42. #define xfs_crit_ratelimited(dev, fmt, ...) \
  43. xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)
  44. #define xfs_err_ratelimited(dev, fmt, ...) \
  45. xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
  46. #define xfs_warn_ratelimited(dev, fmt, ...) \
  47. xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
  48. #define xfs_notice_ratelimited(dev, fmt, ...) \
  49. xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
  50. #define xfs_info_ratelimited(dev, fmt, ...) \
  51. xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
  52. #define xfs_debug_ratelimited(dev, fmt, ...) \
  53. xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
  54. extern void assfail(char *expr, char *f, int l);
  55. extern void asswarn(char *expr, char *f, int l);
  56. extern void xfs_hex_dump(void *p, int length);
  57. #endif /* __XFS_MESSAGE_H */