blob: 34447dca97d136bb36016bfadc5e7312e4b6e5db [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Dave Chinner10e38392011-03-02 14:20:59 +11002#ifndef __XFS_MESSAGE_H
3#define __XFS_MESSAGE_H 1
4
5struct xfs_mount;
6
Joe Perchesb9075fa2011-10-31 17:11:33 -07007extern __printf(2, 3)
8void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
9extern __printf(2, 3)
10void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
11extern __printf(3, 4)
12void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
13extern __printf(2, 3)
14void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
15extern __printf(2, 3)
16void xfs_err(const struct xfs_mount *mp, const char *fmt, ...);
17extern __printf(2, 3)
18void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...);
19extern __printf(2, 3)
20void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...);
21extern __printf(2, 3)
22void xfs_info(const struct xfs_mount *mp, const char *fmt, ...);
Dave Chinner10e38392011-03-02 14:20:59 +110023
24#ifdef DEBUG
Joe Perchesb9075fa2011-10-31 17:11:33 -070025extern __printf(2, 3)
26void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
Dave Chinner10e38392011-03-02 14:20:59 +110027#else
Joe Perchesb9075fa2011-10-31 17:11:33 -070028static inline __printf(2, 3)
29void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
Christoph Hellwig957935d2011-04-02 18:13:40 +000030{
31}
Dave Chinner10e38392011-03-02 14:20:59 +110032#endif
33
Rich Johnston3d6e0362013-03-27 09:26:49 -050034#define xfs_printk_ratelimited(func, dev, fmt, ...) \
35do { \
36 static DEFINE_RATELIMIT_STATE(_rs, \
37 DEFAULT_RATELIMIT_INTERVAL, \
38 DEFAULT_RATELIMIT_BURST); \
39 if (__ratelimit(&_rs)) \
40 func(dev, fmt, ##__VA_ARGS__); \
41} while (0)
42
43#define xfs_emerg_ratelimited(dev, fmt, ...) \
44 xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
45#define xfs_alert_ratelimited(dev, fmt, ...) \
46 xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
47#define xfs_crit_ratelimited(dev, fmt, ...) \
48 xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)
49#define xfs_err_ratelimited(dev, fmt, ...) \
50 xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
51#define xfs_warn_ratelimited(dev, fmt, ...) \
52 xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
53#define xfs_notice_ratelimited(dev, fmt, ...) \
54 xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
55#define xfs_info_ratelimited(dev, fmt, ...) \
56 xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
57#define xfs_debug_ratelimited(dev, fmt, ...) \
58 xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
59
Dave Chinner91300902011-03-07 10:09:35 +110060extern void assfail(char *expr, char *f, int l);
Dave Chinner742ae1e2013-04-30 21:39:34 +100061extern void asswarn(char *expr, char *f, int l);
Dave Chinner91300902011-03-07 10:09:35 +110062
63extern void xfs_hex_dump(void *p, int length);
64
Dave Chinner10e38392011-03-02 14:20:59 +110065#endif /* __XFS_MESSAGE_H */