Dave Chinner | 10e3839 | 2011-03-02 14:20:59 +1100 | [diff] [blame] | 1 | #ifndef __XFS_MESSAGE_H |
| 2 | #define __XFS_MESSAGE_H 1 |
| 3 | |
| 4 | struct xfs_mount; |
| 5 | |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 6 | extern __printf(2, 3) |
| 7 | void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...); |
| 8 | extern __printf(2, 3) |
| 9 | void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...); |
| 10 | extern __printf(3, 4) |
| 11 | void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...); |
| 12 | extern __printf(2, 3) |
| 13 | void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...); |
| 14 | extern __printf(2, 3) |
| 15 | void xfs_err(const struct xfs_mount *mp, const char *fmt, ...); |
| 16 | extern __printf(2, 3) |
| 17 | void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...); |
| 18 | extern __printf(2, 3) |
| 19 | void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...); |
| 20 | extern __printf(2, 3) |
| 21 | void xfs_info(const struct xfs_mount *mp, const char *fmt, ...); |
Dave Chinner | 10e3839 | 2011-03-02 14:20:59 +1100 | [diff] [blame] | 22 | |
| 23 | #ifdef DEBUG |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 24 | extern __printf(2, 3) |
| 25 | void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...); |
Dave Chinner | 10e3839 | 2011-03-02 14:20:59 +1100 | [diff] [blame] | 26 | #else |
Joe Perches | b9075fa | 2011-10-31 17:11:33 -0700 | [diff] [blame] | 27 | static inline __printf(2, 3) |
| 28 | void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...) |
Christoph Hellwig | 957935d | 2011-04-02 18:13:40 +0000 | [diff] [blame] | 29 | { |
| 30 | } |
Dave Chinner | 10e3839 | 2011-03-02 14:20:59 +1100 | [diff] [blame] | 31 | #endif |
| 32 | |
Rich Johnston | 3d6e036 | 2013-03-27 09:26:49 -0500 | [diff] [blame] | 33 | #define xfs_printk_ratelimited(func, dev, fmt, ...) \ |
| 34 | do { \ |
| 35 | static DEFINE_RATELIMIT_STATE(_rs, \ |
| 36 | DEFAULT_RATELIMIT_INTERVAL, \ |
| 37 | DEFAULT_RATELIMIT_BURST); \ |
| 38 | if (__ratelimit(&_rs)) \ |
| 39 | func(dev, fmt, ##__VA_ARGS__); \ |
| 40 | } while (0) |
| 41 | |
| 42 | #define xfs_emerg_ratelimited(dev, fmt, ...) \ |
| 43 | xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__) |
| 44 | #define xfs_alert_ratelimited(dev, fmt, ...) \ |
| 45 | xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__) |
| 46 | #define xfs_crit_ratelimited(dev, fmt, ...) \ |
| 47 | xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__) |
| 48 | #define xfs_err_ratelimited(dev, fmt, ...) \ |
| 49 | xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__) |
| 50 | #define xfs_warn_ratelimited(dev, fmt, ...) \ |
| 51 | xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__) |
| 52 | #define xfs_notice_ratelimited(dev, fmt, ...) \ |
| 53 | xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__) |
| 54 | #define xfs_info_ratelimited(dev, fmt, ...) \ |
| 55 | xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__) |
| 56 | #define xfs_debug_ratelimited(dev, fmt, ...) \ |
| 57 | xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__) |
| 58 | |
Dave Chinner | 9130090 | 2011-03-07 10:09:35 +1100 | [diff] [blame] | 59 | extern void assfail(char *expr, char *f, int l); |
Dave Chinner | 742ae1e | 2013-04-30 21:39:34 +1000 | [diff] [blame] | 60 | extern void asswarn(char *expr, char *f, int l); |
Dave Chinner | 9130090 | 2011-03-07 10:09:35 +1100 | [diff] [blame] | 61 | |
| 62 | extern void xfs_hex_dump(void *p, int length); |
| 63 | |
Dave Chinner | 10e3839 | 2011-03-02 14:20:59 +1100 | [diff] [blame] | 64 | #endif /* __XFS_MESSAGE_H */ |