Rev 6102 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6102 | Rev 6936 | ||
---|---|---|---|
1 | #ifndef __KERNEL_PRINTK__ |
1 | #ifndef __KERNEL_PRINTK__ |
2 | #define __KERNEL_PRINTK__ |
2 | #define __KERNEL_PRINTK__ |
3 | 3 | ||
4 | #include |
4 | #include |
5 | #include |
5 | #include |
6 | #include |
6 | #include |
7 | #include |
7 | #include |
8 | 8 | ||
9 | extern const char linux_banner[]; |
9 | extern const char linux_banner[]; |
10 | extern const char linux_proc_banner[]; |
10 | extern const char linux_proc_banner[]; |
11 | 11 | ||
12 | extern char *log_buf_addr_get(void); |
12 | extern char *log_buf_addr_get(void); |
13 | extern u32 log_buf_len_get(void); |
13 | extern u32 log_buf_len_get(void); |
14 | 14 | ||
15 | /* printk's without a loglevel use this.. */ |
15 | /* printk's without a loglevel use this.. */ |
16 | #define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT |
16 | #define MESSAGE_LOGLEVEL_DEFAULT CONFIG_MESSAGE_LOGLEVEL_DEFAULT |
17 | 17 | ||
18 | /* We show everything that is MORE important than this.. */ |
18 | /* We show everything that is MORE important than this.. */ |
19 | #define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ |
19 | #define CONSOLE_LOGLEVEL_SILENT 0 /* Mum's the word */ |
20 | #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ |
20 | #define CONSOLE_LOGLEVEL_MIN 1 /* Minimum loglevel we let people use */ |
21 | #define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */ |
21 | #define CONSOLE_LOGLEVEL_QUIET 4 /* Shhh ..., when booted with "quiet" */ |
22 | #define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */ |
22 | #define CONSOLE_LOGLEVEL_DEFAULT 7 /* anything MORE serious than KERN_DEBUG */ |
23 | #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ |
23 | #define CONSOLE_LOGLEVEL_DEBUG 10 /* issue debug messages */ |
24 | #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ |
24 | #define CONSOLE_LOGLEVEL_MOTORMOUTH 15 /* You can't shut this one up */ |
25 | 25 | ||
26 | struct va_format { |
26 | struct va_format { |
27 | const char *fmt; |
27 | const char *fmt; |
28 | va_list *va; |
28 | va_list *va; |
29 | }; |
29 | }; |
30 | 30 | ||
31 | /* |
31 | /* |
32 | * FW_BUG |
32 | * FW_BUG |
33 | * Add this to a message where you are sure the firmware is buggy or behaves |
33 | * Add this to a message where you are sure the firmware is buggy or behaves |
34 | * really stupid or out of spec. Be aware that the responsible BIOS developer |
34 | * really stupid or out of spec. Be aware that the responsible BIOS developer |
35 | * should be able to fix this issue or at least get a concrete idea of the |
35 | * should be able to fix this issue or at least get a concrete idea of the |
36 | * problem by reading your message without the need of looking at the kernel |
36 | * problem by reading your message without the need of looking at the kernel |
37 | * code. |
37 | * code. |
38 | * |
38 | * |
39 | * Use it for definite and high priority BIOS bugs. |
39 | * Use it for definite and high priority BIOS bugs. |
40 | * |
40 | * |
41 | * FW_WARN |
41 | * FW_WARN |
42 | * Use it for not that clear (e.g. could the kernel messed up things already?) |
42 | * Use it for not that clear (e.g. could the kernel messed up things already?) |
43 | * and medium priority BIOS bugs. |
43 | * and medium priority BIOS bugs. |
44 | * |
44 | * |
45 | * FW_INFO |
45 | * FW_INFO |
46 | * Use this one if you want to tell the user or vendor about something |
46 | * Use this one if you want to tell the user or vendor about something |
47 | * suspicious, but generally harmless related to the firmware. |
47 | * suspicious, but generally harmless related to the firmware. |
48 | * |
48 | * |
49 | * Use it for information or very low priority BIOS bugs. |
49 | * Use it for information or very low priority BIOS bugs. |
50 | */ |
50 | */ |
51 | #define FW_BUG "[Firmware Bug]: " |
51 | #define FW_BUG "[Firmware Bug]: " |
52 | #define FW_WARN "[Firmware Warn]: " |
52 | #define FW_WARN "[Firmware Warn]: " |
53 | #define FW_INFO "[Firmware Info]: " |
53 | #define FW_INFO "[Firmware Info]: " |
54 | 54 | ||
55 | /* |
55 | /* |
56 | * HW_ERR |
56 | * HW_ERR |
57 | * Add this to a message for hardware errors, so that user can report |
57 | * Add this to a message for hardware errors, so that user can report |
58 | * it to hardware vendor instead of LKML or software vendor. |
58 | * it to hardware vendor instead of LKML or software vendor. |
59 | */ |
59 | */ |
60 | #define HW_ERR "[Hardware Error]: " |
60 | #define HW_ERR "[Hardware Error]: " |
61 | 61 | ||
62 | /* |
62 | /* |
63 | * DEPRECATED |
63 | * DEPRECATED |
64 | * Add this to a message whenever you want to warn user space about the use |
64 | * Add this to a message whenever you want to warn user space about the use |
65 | * of a deprecated aspect of an API so they can stop using it |
65 | * of a deprecated aspect of an API so they can stop using it |
66 | */ |
66 | */ |
67 | #define DEPRECATED "[Deprecated]: " |
67 | #define DEPRECATED "[Deprecated]: " |
68 | 68 | ||
69 | /* |
69 | /* |
70 | * Dummy printk for disabled debugging statements to use whilst maintaining |
70 | * Dummy printk for disabled debugging statements to use whilst maintaining |
71 | * gcc's format and side-effect checking. |
71 | * gcc's format checking. |
72 | */ |
72 | */ |
73 | static inline __printf(1, 2) |
73 | #define no_printk(fmt, ...) \ |
- | 74 | do { \ |
|
- | 75 | if (0) \ |
|
74 | int no_printk(const char *fmt, ...) |
76 | printk(fmt, ##__VA_ARGS__); \ |
- | 77 | } while (0) |
|
75 | { |
78 | |
76 | return 0; |
- | |
77 | } |
79 | |
78 | 80 | ||
79 | __printf(1, 2) int dbgprintf(const char *fmt, ...); |
81 | __printf(1, 2) int dbgprintf(const char *fmt, ...); |
80 | 82 | ||
81 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
83 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
82 | 84 | ||
83 | #ifndef pr_fmt |
85 | #ifndef pr_fmt |
84 | #define pr_fmt(fmt) fmt |
86 | #define pr_fmt(fmt) fmt |
85 | #endif |
87 | #endif |
86 | 88 | ||
87 | #define pr_debug(fmt, ...) \ |
89 | #define pr_debug(fmt, ...) \ |
88 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
90 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
89 | 91 | ||
90 | /* |
92 | /* |
91 | * These can be used to print at the various log levels. |
93 | * These can be used to print at the various log levels. |
92 | * All of these will print unconditionally, although note that pr_debug() |
94 | * All of these will print unconditionally, although note that pr_debug() |
93 | * and other debug macros are compiled out unless either DEBUG is defined |
95 | * and other debug macros are compiled out unless either DEBUG is defined |
94 | * or CONFIG_DYNAMIC_DEBUG is set. |
96 | * or CONFIG_DYNAMIC_DEBUG is set. |
95 | */ |
97 | */ |
96 | #define pr_emerg(fmt, ...) \ |
98 | #define pr_emerg(fmt, ...) \ |
97 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
99 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
98 | #define pr_alert(fmt, ...) \ |
100 | #define pr_alert(fmt, ...) \ |
99 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
101 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
100 | #define pr_crit(fmt, ...) \ |
102 | #define pr_crit(fmt, ...) \ |
101 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
103 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
102 | #define pr_err(fmt, ...) \ |
104 | #define pr_err(fmt, ...) \ |
103 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
105 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
104 | #define pr_warning(fmt, ...) \ |
106 | #define pr_warning(fmt, ...) \ |
105 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
107 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
106 | #define pr_warn pr_warning |
108 | #define pr_warn pr_warning |
107 | #define pr_notice(fmt, ...) \ |
109 | #define pr_notice(fmt, ...) \ |
108 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
110 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
109 | #define pr_info(fmt, ...) \ |
111 | #define pr_info(fmt, ...) \ |
110 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
112 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
111 | /* |
113 | /* |
112 | * Like KERN_CONT, pr_cont() should only be used when continuing |
114 | * Like KERN_CONT, pr_cont() should only be used when continuing |
113 | * a line with no newline ('\n') enclosed. Otherwise it defaults |
115 | * a line with no newline ('\n') enclosed. Otherwise it defaults |
114 | * back to KERN_DEFAULT. |
116 | * back to KERN_DEFAULT. |
115 | */ |
117 | */ |
116 | #define pr_cont(fmt, ...) \ |
118 | #define pr_cont(fmt, ...) \ |
117 | printk(KERN_CONT fmt, ##__VA_ARGS__) |
119 | printk(KERN_CONT fmt, ##__VA_ARGS__) |
118 | 120 | ||
119 | /* pr_devel() should produce zero code unless DEBUG is defined */ |
121 | /* pr_devel() should produce zero code unless DEBUG is defined */ |
120 | #ifdef DEBUG |
122 | #ifdef DEBUG |
121 | #define pr_devel(fmt, ...) \ |
123 | #define pr_devel(fmt, ...) \ |
122 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
124 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
123 | #else |
125 | #else |
124 | #define pr_devel(fmt, ...) \ |
126 | #define pr_devel(fmt, ...) \ |
125 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
127 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
126 | #endif |
128 | #endif |
127 | 129 | ||
128 | /* |
130 | /* |
129 | * Print a one-time message (analogous to WARN_ONCE() et al): |
131 | * Print a one-time message (analogous to WARN_ONCE() et al): |
130 | */ |
132 | */ |
131 | 133 | ||
132 | #ifdef CONFIG_PRINTK |
134 | #ifdef CONFIG_PRINTK |
133 | #define printk_once(fmt, ...) \ |
135 | #define printk_once(fmt, ...) \ |
134 | ({ \ |
136 | ({ \ |
135 | static bool __print_once __read_mostly; \ |
137 | static bool __print_once __read_mostly; \ |
136 | \ |
138 | \ |
137 | if (!__print_once) { \ |
139 | if (!__print_once) { \ |
138 | __print_once = true; \ |
140 | __print_once = true; \ |
139 | printk(fmt, ##__VA_ARGS__); \ |
141 | printk(fmt, ##__VA_ARGS__); \ |
140 | } \ |
142 | } \ |
141 | }) |
143 | }) |
142 | #define printk_deferred_once(fmt, ...) \ |
144 | #define printk_deferred_once(fmt, ...) \ |
143 | ({ \ |
145 | ({ \ |
144 | static bool __print_once __read_mostly; \ |
146 | static bool __print_once __read_mostly; \ |
145 | \ |
147 | \ |
146 | if (!__print_once) { \ |
148 | if (!__print_once) { \ |
147 | __print_once = true; \ |
149 | __print_once = true; \ |
148 | printk_deferred(fmt, ##__VA_ARGS__); \ |
150 | printk_deferred(fmt, ##__VA_ARGS__); \ |
149 | } \ |
151 | } \ |
150 | }) |
152 | }) |
151 | #else |
153 | #else |
152 | #define printk_once(fmt, ...) \ |
154 | #define printk_once(fmt, ...) \ |
153 | no_printk(fmt, ##__VA_ARGS__) |
155 | no_printk(fmt, ##__VA_ARGS__) |
154 | #define printk_deferred_once(fmt, ...) \ |
156 | #define printk_deferred_once(fmt, ...) \ |
155 | no_printk(fmt, ##__VA_ARGS__) |
157 | no_printk(fmt, ##__VA_ARGS__) |
156 | #endif |
158 | #endif |
157 | 159 | ||
158 | #define pr_emerg_once(fmt, ...) \ |
160 | #define pr_emerg_once(fmt, ...) \ |
159 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
161 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
160 | #define pr_alert_once(fmt, ...) \ |
162 | #define pr_alert_once(fmt, ...) \ |
161 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
163 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
162 | #define pr_crit_once(fmt, ...) \ |
164 | #define pr_crit_once(fmt, ...) \ |
163 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
165 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
164 | #define pr_err_once(fmt, ...) \ |
166 | #define pr_err_once(fmt, ...) \ |
165 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
167 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
166 | #define pr_warn_once(fmt, ...) \ |
168 | #define pr_warn_once(fmt, ...) \ |
167 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
169 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
168 | #define pr_notice_once(fmt, ...) \ |
170 | #define pr_notice_once(fmt, ...) \ |
169 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
171 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
170 | #define pr_info_once(fmt, ...) \ |
172 | #define pr_info_once(fmt, ...) \ |
171 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
173 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
172 | #define pr_cont_once(fmt, ...) \ |
174 | #define pr_cont_once(fmt, ...) \ |
173 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) |
175 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) |
174 | 176 | ||
175 | #if defined(DEBUG) |
177 | #if defined(DEBUG) |
176 | #define pr_devel_once(fmt, ...) \ |
178 | #define pr_devel_once(fmt, ...) \ |
177 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
179 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
178 | #else |
180 | #else |
179 | #define pr_devel_once(fmt, ...) \ |
181 | #define pr_devel_once(fmt, ...) \ |
180 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
182 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
181 | #endif |
183 | #endif |
182 | 184 | ||
183 | /* If you are writing a driver, please use dev_dbg instead */ |
185 | /* If you are writing a driver, please use dev_dbg instead */ |
184 | #if defined(DEBUG) |
186 | #if defined(DEBUG) |
185 | #define pr_debug_once(fmt, ...) \ |
187 | #define pr_debug_once(fmt, ...) \ |
186 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
188 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
187 | #else |
189 | #else |
188 | #define pr_debug_once(fmt, ...) \ |
190 | #define pr_debug_once(fmt, ...) \ |
189 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
191 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
190 | #endif |
192 | #endif |
191 | 193 | ||
192 | /* |
194 | /* |
193 | * ratelimited messages with local ratelimit_state, |
195 | * ratelimited messages with local ratelimit_state, |
194 | * no local ratelimit_state used in the !PRINTK case |
196 | * no local ratelimit_state used in the !PRINTK case |
195 | */ |
197 | */ |
196 | #ifdef CONFIG_PRINTK |
198 | #ifdef CONFIG_PRINTK |
197 | #define printk_ratelimited(fmt, ...) \ |
199 | #define printk_ratelimited(fmt, ...) \ |
198 | ({ \ |
200 | ({ \ |
199 | static DEFINE_RATELIMIT_STATE(_rs, \ |
201 | static DEFINE_RATELIMIT_STATE(_rs, \ |
200 | DEFAULT_RATELIMIT_INTERVAL, \ |
202 | DEFAULT_RATELIMIT_INTERVAL, \ |
201 | DEFAULT_RATELIMIT_BURST); \ |
203 | DEFAULT_RATELIMIT_BURST); \ |
202 | \ |
204 | \ |
203 | if (__ratelimit(&_rs)) \ |
205 | if (__ratelimit(&_rs)) \ |
204 | printk(fmt, ##__VA_ARGS__); \ |
206 | printk(fmt, ##__VA_ARGS__); \ |
205 | }) |
207 | }) |
206 | #else |
208 | #else |
207 | #define printk_ratelimited(fmt, ...) \ |
209 | #define printk_ratelimited(fmt, ...) \ |
208 | no_printk(fmt, ##__VA_ARGS__) |
210 | no_printk(fmt, ##__VA_ARGS__) |
209 | #endif |
211 | #endif |
210 | 212 | ||
211 | #define pr_emerg_ratelimited(fmt, ...) \ |
213 | #define pr_emerg_ratelimited(fmt, ...) \ |
212 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
214 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
213 | #define pr_alert_ratelimited(fmt, ...) \ |
215 | #define pr_alert_ratelimited(fmt, ...) \ |
214 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
216 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
215 | #define pr_crit_ratelimited(fmt, ...) \ |
217 | #define pr_crit_ratelimited(fmt, ...) \ |
216 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
218 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
217 | #define pr_err_ratelimited(fmt, ...) \ |
219 | #define pr_err_ratelimited(fmt, ...) \ |
218 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
220 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
219 | #define pr_warn_ratelimited(fmt, ...) \ |
221 | #define pr_warn_ratelimited(fmt, ...) \ |
220 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
222 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
221 | #define pr_notice_ratelimited(fmt, ...) \ |
223 | #define pr_notice_ratelimited(fmt, ...) \ |
222 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
224 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
223 | #define pr_info_ratelimited(fmt, ...) \ |
225 | #define pr_info_ratelimited(fmt, ...) \ |
224 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
226 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
225 | /* no pr_cont_ratelimited, don't do that... */ |
227 | /* no pr_cont_ratelimited, don't do that... */ |
226 | 228 | ||
227 | #if defined(DEBUG) |
229 | #if defined(DEBUG) |
228 | #define pr_devel_ratelimited(fmt, ...) \ |
230 | #define pr_devel_ratelimited(fmt, ...) \ |
229 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
231 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
230 | #else |
232 | #else |
231 | #define pr_devel_ratelimited(fmt, ...) \ |
233 | #define pr_devel_ratelimited(fmt, ...) \ |
232 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
234 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
233 | #endif |
235 | #endif |
234 | 236 | ||
235 | /* If you are writing a driver, please use dev_dbg instead */ |
237 | /* If you are writing a driver, please use dev_dbg instead */ |
236 | #if defined(CONFIG_DYNAMIC_DEBUG) |
238 | #if defined(CONFIG_DYNAMIC_DEBUG) |
237 | /* descriptor check is first to prevent flooding with "callbacks suppressed" */ |
239 | /* descriptor check is first to prevent flooding with "callbacks suppressed" */ |
238 | #define pr_debug_ratelimited(fmt, ...) \ |
240 | #define pr_debug_ratelimited(fmt, ...) \ |
239 | do { \ |
241 | do { \ |
240 | static DEFINE_RATELIMIT_STATE(_rs, \ |
242 | static DEFINE_RATELIMIT_STATE(_rs, \ |
241 | DEFAULT_RATELIMIT_INTERVAL, \ |
243 | DEFAULT_RATELIMIT_INTERVAL, \ |
242 | DEFAULT_RATELIMIT_BURST); \ |
244 | DEFAULT_RATELIMIT_BURST); \ |
243 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
245 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
244 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ |
246 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ |
245 | __ratelimit(&_rs)) \ |
247 | __ratelimit(&_rs)) \ |
246 | __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \ |
248 | __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \ |
247 | } while (0) |
249 | } while (0) |
248 | #elif defined(DEBUG) |
250 | #elif defined(DEBUG) |
249 | #define pr_debug_ratelimited(fmt, ...) \ |
251 | #define pr_debug_ratelimited(fmt, ...) \ |
250 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
252 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
251 | #else |
253 | #else |
252 | #define pr_debug_ratelimited(fmt, ...) \ |
254 | #define pr_debug_ratelimited(fmt, ...) \ |
253 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
255 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
254 | #endif |
256 | #endif |
255 | 257 | ||
256 | extern const struct file_operations kmsg_fops; |
258 | extern const struct file_operations kmsg_fops; |
257 | 259 | ||
258 | enum { |
260 | enum { |
259 | DUMP_PREFIX_NONE, |
261 | DUMP_PREFIX_NONE, |
260 | DUMP_PREFIX_ADDRESS, |
262 | DUMP_PREFIX_ADDRESS, |
261 | DUMP_PREFIX_OFFSET |
263 | DUMP_PREFIX_OFFSET |
262 | }; |
264 | }; |
263 | extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, |
265 | extern int hex_dump_to_buffer(const void *buf, size_t len, int rowsize, |
264 | int groupsize, char *linebuf, size_t linebuflen, |
266 | int groupsize, char *linebuf, size_t linebuflen, |
265 | bool ascii); |
267 | bool ascii); |
266 | 268 | ||
267 | extern void print_hex_dump(const char *level, const char *prefix_str, |
269 | extern void print_hex_dump(const char *level, const char *prefix_str, |
268 | int prefix_type, int rowsize, int groupsize, |
270 | int prefix_type, int rowsize, int groupsize, |
269 | const void *buf, size_t len, bool ascii); |
271 | const void *buf, size_t len, bool ascii); |
270 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
272 | extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type, |
271 | const void *buf, size_t len); |
273 | const void *buf, size_t len); |
272 | 274 | ||
273 | 275 | ||
274 | #endif |
276 | #endif |