Linux Audio

Check our new training course

Loading...
v4.10.11
 
 1#ifndef __XFS_MESSAGE_H
 2#define __XFS_MESSAGE_H 1
 3
 4struct xfs_mount;
 5
 6extern __printf(2, 3)
 7void xfs_emerg(const struct xfs_mount *mp, const char *fmt, ...);
 8extern __printf(2, 3)
 9void xfs_alert(const struct xfs_mount *mp, const char *fmt, ...);
10extern __printf(3, 4)
11void xfs_alert_tag(const struct xfs_mount *mp, int tag, const char *fmt, ...);
12extern __printf(2, 3)
13void xfs_crit(const struct xfs_mount *mp, const char *fmt, ...);
14extern __printf(2, 3)
15void xfs_err(const struct xfs_mount *mp, const char *fmt, ...);
16extern __printf(2, 3)
17void xfs_warn(const struct xfs_mount *mp, const char *fmt, ...);
18extern __printf(2, 3)
19void xfs_notice(const struct xfs_mount *mp, const char *fmt, ...);
20extern __printf(2, 3)
21void xfs_info(const struct xfs_mount *mp, const char *fmt, ...);
22
23#ifdef DEBUG
24extern __printf(2, 3)
25void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
26#else
27static inline __printf(2, 3)
28void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
29{
30}
31#endif
32
33#define xfs_printk_ratelimited(func, dev, fmt, ...)		\
34do {									\
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
59extern void assfail(char *expr, char *f, int l);
60extern void asswarn(char *expr, char *f, int l);
 
 
 
 
 
 
 
61
62extern void xfs_hex_dump(void *p, int length);
 
63
64#endif	/* __XFS_MESSAGE_H */
v5.9
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __XFS_MESSAGE_H
 3#define __XFS_MESSAGE_H 1
 4
 5struct xfs_mount;
 6
 7extern __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, ...);
23
24#ifdef DEBUG
25extern __printf(2, 3)
26void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...);
27#else
28static inline __printf(2, 3)
29void xfs_debug(const struct xfs_mount *mp, const char *fmt, ...)
30{
31}
32#endif
33
34#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_printk_once(func, dev, fmt, ...)			\
44({								\
45	static bool __section(.data.once) __print_once;		\
46	bool __ret_print_once = !__print_once; 			\
47								\
48	if (!__print_once) {					\
49		__print_once = true;				\
50		func(dev, fmt, ##__VA_ARGS__);			\
51	}							\
52	unlikely(__ret_print_once);				\
53})
54
55#define xfs_emerg_ratelimited(dev, fmt, ...)				\
56	xfs_printk_ratelimited(xfs_emerg, dev, fmt, ##__VA_ARGS__)
57#define xfs_alert_ratelimited(dev, fmt, ...)				\
58	xfs_printk_ratelimited(xfs_alert, dev, fmt, ##__VA_ARGS__)
59#define xfs_crit_ratelimited(dev, fmt, ...)				\
60	xfs_printk_ratelimited(xfs_crit, dev, fmt, ##__VA_ARGS__)
61#define xfs_err_ratelimited(dev, fmt, ...)				\
62	xfs_printk_ratelimited(xfs_err, dev, fmt, ##__VA_ARGS__)
63#define xfs_warn_ratelimited(dev, fmt, ...)				\
64	xfs_printk_ratelimited(xfs_warn, dev, fmt, ##__VA_ARGS__)
65#define xfs_notice_ratelimited(dev, fmt, ...)				\
66	xfs_printk_ratelimited(xfs_notice, dev, fmt, ##__VA_ARGS__)
67#define xfs_info_ratelimited(dev, fmt, ...)				\
68	xfs_printk_ratelimited(xfs_info, dev, fmt, ##__VA_ARGS__)
69#define xfs_debug_ratelimited(dev, fmt, ...)				\
70	xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
71
72#define xfs_warn_once(dev, fmt, ...)				\
73	xfs_printk_once(xfs_warn, dev, fmt, ##__VA_ARGS__)
74#define xfs_notice_once(dev, fmt, ...)				\
75	xfs_printk_once(xfs_notice, dev, fmt, ##__VA_ARGS__)
76
77void assfail(struct xfs_mount *mp, char *expr, char *f, int l);
78void asswarn(struct xfs_mount *mp, char *expr, char *f, int l);
79
80extern void xfs_hex_dump(const void *p, int length);
81
82void xfs_buf_alert_ratelimited(struct xfs_buf *bp, const char *rlmsg,
83			       const char *fmt, ...);
84
85#endif	/* __XFS_MESSAGE_H */