1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __XFS_MESSAGE_H
3 #define __XFS_MESSAGE_H 1
5 #include <linux/once_lite.h>
10 void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
12 void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
14 void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
16 void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
18 void xfs_err(const struct xfs_mount *mp, const char *fmt, ...);
20 void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...);
22 void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...);
24 void xfs_info(const struct xfs_mount *mp, const char *fmt, ...);
28 void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
30 static inline __printf(2, 3)
31 void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
36 #define xfs_printk_ratelimited(func, dev, fmt, ...) \
38 static DEFINE_RATELIMIT_STATE(_rs, \
39 DEFAULT_RATELIMIT_INTERVAL, \
40 DEFAULT_RATELIMIT_BURST); \
41 if (__ratelimit(&_rs)) \
42 func(dev, fmt, ##__VA_ARGS__); \
45 #define xfs_printk_once(func, dev, fmt, ...) \
46 DO_ONCE_LITE(func, dev, fmt, ##__VA_ARGS__)
48 #define xfs_emerg_ratelimited(dev, fmt, ...) \
49 xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
50 #define xfs_alert_ratelimited(dev, fmt, ...) \
51 xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
52 #define xfs_crit_ratelimited(dev, fmt, ...) \
53 xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)
54 #define xfs_err_ratelimited(dev, fmt, ...) \
55 xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
56 #define xfs_warn_ratelimited(dev, fmt, ...) \
57 xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
58 #define xfs_notice_ratelimited(dev, fmt, ...) \
59 xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
60 #define xfs_info_ratelimited(dev, fmt, ...) \
61 xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
62 #define xfs_debug_ratelimited(dev, fmt, ...) \
63 xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
65 #define xfs_warn_once(dev, fmt, ...) \
66 xfs_printk_once(xfs_warn, dev, fmt, ##__VA_ARGS__)
67 #define xfs_notice_once(dev, fmt, ...) \
68 xfs_printk_once(xfs_notice, dev, fmt, ##__VA_ARGS__)
69 #define xfs_info_once(dev, fmt, ...) \
70 xfs_printk_once(xfs_info, dev, fmt, ##__VA_ARGS__)
72 void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
73 void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
75 extern void xfs_hex_dump(const void *p, int length);
77 void xfs_buf_alert_ratelimited(struct xfs_buf *bp, const char *rlmsg,
78 const char *fmt, ...);
80 #endif /* __XFS_MESSAGE_H */