xfs_message.h 2.3 KB

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