Rev 6936 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6936 | Rev 7143 | ||
---|---|---|---|
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 checking. |
71 | * gcc's format checking. |
72 | */ |
72 | */ |
73 | #define no_printk(fmt, ...) \ |
73 | #define no_printk(fmt, ...) \ |
74 | do { \ |
74 | do { \ |
75 | if (0) \ |
75 | if (0) \ |
76 | printk(fmt, ##__VA_ARGS__); \ |
76 | printk(fmt, ##__VA_ARGS__); \ |
77 | } while (0) |
77 | } while (0) |
78 | 78 | ||
79 | 79 | ||
80 | 80 | ||
81 | __printf(1, 2) int dbgprintf(const char *fmt, ...); |
81 | __printf(1, 2) int dbgprintf(const char *fmt, ...); |
82 | 82 | ||
83 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
83 | #define printk(fmt, arg...) dbgprintf(fmt , ##arg) |
84 | 84 | ||
85 | #ifndef pr_fmt |
85 | #ifndef pr_fmt |
86 | #define pr_fmt(fmt) fmt |
86 | #define pr_fmt(fmt) fmt |
87 | #endif |
87 | #endif |
88 | 88 | ||
89 | #define pr_debug(fmt, ...) \ |
89 | #define pr_debug(fmt, ...) \ |
90 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
90 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
91 | 91 | ||
92 | /* |
92 | /* |
93 | * These can be used to print at the various log levels. |
93 | * These can be used to print at the various log levels. |
94 | * All of these will print unconditionally, although note that pr_debug() |
94 | * All of these will print unconditionally, although note that pr_debug() |
95 | * 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 |
96 | * or CONFIG_DYNAMIC_DEBUG is set. |
96 | * or CONFIG_DYNAMIC_DEBUG is set. |
97 | */ |
97 | */ |
98 | #define pr_emerg(fmt, ...) \ |
98 | #define pr_emerg(fmt, ...) \ |
99 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
99 | printk(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
100 | #define pr_alert(fmt, ...) \ |
100 | #define pr_alert(fmt, ...) \ |
101 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
101 | printk(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
102 | #define pr_crit(fmt, ...) \ |
102 | #define pr_crit(fmt, ...) \ |
103 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
103 | printk(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
104 | #define pr_err(fmt, ...) \ |
104 | #define pr_err(fmt, ...) \ |
105 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
105 | printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
106 | #define pr_warning(fmt, ...) \ |
106 | #define pr_warning(fmt, ...) \ |
107 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
107 | printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
108 | #define pr_warn pr_warning |
108 | #define pr_warn pr_warning |
109 | #define pr_notice(fmt, ...) \ |
109 | #define pr_notice(fmt, ...) \ |
110 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
110 | printk(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
111 | #define pr_info(fmt, ...) \ |
111 | #define pr_info(fmt, ...) \ |
112 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
112 | printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
113 | /* |
113 | /* |
114 | * Like KERN_CONT, pr_cont() should only be used when continuing |
114 | * Like KERN_CONT, pr_cont() should only be used when continuing |
115 | * a line with no newline ('\n') enclosed. Otherwise it defaults |
115 | * a line with no newline ('\n') enclosed. Otherwise it defaults |
116 | * back to KERN_DEFAULT. |
116 | * back to KERN_DEFAULT. |
117 | */ |
117 | */ |
118 | #define pr_cont(fmt, ...) \ |
118 | #define pr_cont(fmt, ...) \ |
119 | printk(KERN_CONT fmt, ##__VA_ARGS__) |
119 | printk(KERN_CONT fmt, ##__VA_ARGS__) |
120 | 120 | ||
121 | /* pr_devel() should produce zero code unless DEBUG is defined */ |
121 | /* pr_devel() should produce zero code unless DEBUG is defined */ |
122 | #ifdef DEBUG |
122 | #ifdef DEBUG |
123 | #define pr_devel(fmt, ...) \ |
123 | #define pr_devel(fmt, ...) \ |
124 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
124 | printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
125 | #else |
125 | #else |
126 | #define pr_devel(fmt, ...) \ |
126 | #define pr_devel(fmt, ...) \ |
127 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
127 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
128 | #endif |
128 | #endif |
129 | 129 | ||
130 | /* |
130 | /* |
131 | * Print a one-time message (analogous to WARN_ONCE() et al): |
131 | * Print a one-time message (analogous to WARN_ONCE() et al): |
132 | */ |
132 | */ |
133 | 133 | ||
134 | #ifdef CONFIG_PRINTK |
134 | #ifdef CONFIG_PRINTK |
135 | #define printk_once(fmt, ...) \ |
135 | #define printk_once(fmt, ...) \ |
136 | ({ \ |
136 | ({ \ |
137 | static bool __print_once __read_mostly; \ |
137 | static bool __print_once __read_mostly; \ |
138 | \ |
138 | \ |
139 | if (!__print_once) { \ |
139 | if (!__print_once) { \ |
140 | __print_once = true; \ |
140 | __print_once = true; \ |
141 | printk(fmt, ##__VA_ARGS__); \ |
141 | printk(fmt, ##__VA_ARGS__); \ |
142 | } \ |
142 | } \ |
143 | }) |
143 | }) |
144 | #define printk_deferred_once(fmt, ...) \ |
144 | #define printk_deferred_once(fmt, ...) \ |
145 | ({ \ |
145 | ({ \ |
146 | static bool __print_once __read_mostly; \ |
146 | static bool __print_once __read_mostly; \ |
147 | \ |
147 | \ |
148 | if (!__print_once) { \ |
148 | if (!__print_once) { \ |
149 | __print_once = true; \ |
149 | __print_once = true; \ |
150 | printk_deferred(fmt, ##__VA_ARGS__); \ |
150 | printk_deferred(fmt, ##__VA_ARGS__); \ |
151 | } \ |
151 | } \ |
152 | }) |
152 | }) |
153 | #else |
153 | #else |
154 | #define printk_once(fmt, ...) \ |
154 | #define printk_once(fmt, ...) \ |
155 | no_printk(fmt, ##__VA_ARGS__) |
155 | no_printk(fmt, ##__VA_ARGS__) |
156 | #define printk_deferred_once(fmt, ...) \ |
156 | #define printk_deferred_once(fmt, ...) \ |
157 | no_printk(fmt, ##__VA_ARGS__) |
157 | no_printk(fmt, ##__VA_ARGS__) |
158 | #endif |
158 | #endif |
159 | 159 | ||
160 | #define pr_emerg_once(fmt, ...) \ |
160 | #define pr_emerg_once(fmt, ...) \ |
161 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
161 | printk_once(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
162 | #define pr_alert_once(fmt, ...) \ |
162 | #define pr_alert_once(fmt, ...) \ |
163 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
163 | printk_once(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
164 | #define pr_crit_once(fmt, ...) \ |
164 | #define pr_crit_once(fmt, ...) \ |
165 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
165 | printk_once(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
166 | #define pr_err_once(fmt, ...) \ |
166 | #define pr_err_once(fmt, ...) \ |
167 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
167 | printk_once(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
168 | #define pr_warn_once(fmt, ...) \ |
168 | #define pr_warn_once(fmt, ...) \ |
169 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
169 | printk_once(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
170 | #define pr_notice_once(fmt, ...) \ |
170 | #define pr_notice_once(fmt, ...) \ |
171 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
171 | printk_once(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
172 | #define pr_info_once(fmt, ...) \ |
172 | #define pr_info_once(fmt, ...) \ |
173 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
173 | printk_once(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
174 | #define pr_cont_once(fmt, ...) \ |
174 | #define pr_cont_once(fmt, ...) \ |
175 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) |
175 | printk_once(KERN_CONT pr_fmt(fmt), ##__VA_ARGS__) |
176 | 176 | ||
177 | #if defined(DEBUG) |
177 | #if defined(DEBUG) |
178 | #define pr_devel_once(fmt, ...) \ |
178 | #define pr_devel_once(fmt, ...) \ |
179 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
179 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
180 | #else |
180 | #else |
181 | #define pr_devel_once(fmt, ...) \ |
181 | #define pr_devel_once(fmt, ...) \ |
182 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
182 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
183 | #endif |
183 | #endif |
184 | 184 | ||
185 | /* If you are writing a driver, please use dev_dbg instead */ |
185 | /* If you are writing a driver, please use dev_dbg instead */ |
186 | #if defined(DEBUG) |
186 | #if defined(DEBUG) |
187 | #define pr_debug_once(fmt, ...) \ |
187 | #define pr_debug_once(fmt, ...) \ |
188 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
188 | printk_once(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
189 | #else |
189 | #else |
190 | #define pr_debug_once(fmt, ...) \ |
190 | #define pr_debug_once(fmt, ...) \ |
191 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
191 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
192 | #endif |
192 | #endif |
193 | 193 | ||
194 | /* |
194 | /* |
195 | * ratelimited messages with local ratelimit_state, |
195 | * ratelimited messages with local ratelimit_state, |
196 | * no local ratelimit_state used in the !PRINTK case |
196 | * no local ratelimit_state used in the !PRINTK case |
197 | */ |
197 | */ |
198 | #ifdef CONFIG_PRINTK |
198 | #ifdef CONFIG_PRINTK |
199 | #define printk_ratelimited(fmt, ...) \ |
199 | #define printk_ratelimited(fmt, ...) \ |
200 | ({ \ |
200 | ({ \ |
201 | static DEFINE_RATELIMIT_STATE(_rs, \ |
201 | static DEFINE_RATELIMIT_STATE(_rs, \ |
202 | DEFAULT_RATELIMIT_INTERVAL, \ |
202 | DEFAULT_RATELIMIT_INTERVAL, \ |
203 | DEFAULT_RATELIMIT_BURST); \ |
203 | DEFAULT_RATELIMIT_BURST); \ |
204 | \ |
204 | \ |
205 | if (__ratelimit(&_rs)) \ |
205 | if (__ratelimit(&_rs)) \ |
206 | printk(fmt, ##__VA_ARGS__); \ |
206 | printk(fmt, ##__VA_ARGS__); \ |
207 | }) |
207 | }) |
208 | #else |
208 | #else |
209 | #define printk_ratelimited(fmt, ...) \ |
209 | #define printk_ratelimited(fmt, ...) \ |
210 | no_printk(fmt, ##__VA_ARGS__) |
210 | no_printk(fmt, ##__VA_ARGS__) |
211 | #endif |
211 | #endif |
212 | 212 | ||
213 | #define pr_emerg_ratelimited(fmt, ...) \ |
213 | #define pr_emerg_ratelimited(fmt, ...) \ |
214 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
214 | printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__) |
215 | #define pr_alert_ratelimited(fmt, ...) \ |
215 | #define pr_alert_ratelimited(fmt, ...) \ |
216 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
216 | printk_ratelimited(KERN_ALERT pr_fmt(fmt), ##__VA_ARGS__) |
217 | #define pr_crit_ratelimited(fmt, ...) \ |
217 | #define pr_crit_ratelimited(fmt, ...) \ |
218 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
218 | printk_ratelimited(KERN_CRIT pr_fmt(fmt), ##__VA_ARGS__) |
219 | #define pr_err_ratelimited(fmt, ...) \ |
219 | #define pr_err_ratelimited(fmt, ...) \ |
220 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
220 | printk_ratelimited(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__) |
221 | #define pr_warn_ratelimited(fmt, ...) \ |
221 | #define pr_warn_ratelimited(fmt, ...) \ |
222 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
222 | printk_ratelimited(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) |
223 | #define pr_notice_ratelimited(fmt, ...) \ |
223 | #define pr_notice_ratelimited(fmt, ...) \ |
224 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
224 | printk_ratelimited(KERN_NOTICE pr_fmt(fmt), ##__VA_ARGS__) |
225 | #define pr_info_ratelimited(fmt, ...) \ |
225 | #define pr_info_ratelimited(fmt, ...) \ |
226 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
226 | printk_ratelimited(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
227 | /* no pr_cont_ratelimited, don't do that... */ |
227 | /* no pr_cont_ratelimited, don't do that... */ |
228 | 228 | ||
229 | #if defined(DEBUG) |
229 | #if defined(DEBUG) |
230 | #define pr_devel_ratelimited(fmt, ...) \ |
230 | #define pr_devel_ratelimited(fmt, ...) \ |
231 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
231 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
232 | #else |
232 | #else |
233 | #define pr_devel_ratelimited(fmt, ...) \ |
233 | #define pr_devel_ratelimited(fmt, ...) \ |
234 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
234 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
235 | #endif |
235 | #endif |
236 | 236 | ||
237 | /* If you are writing a driver, please use dev_dbg instead */ |
237 | /* If you are writing a driver, please use dev_dbg instead */ |
238 | #if defined(CONFIG_DYNAMIC_DEBUG) |
238 | #if defined(CONFIG_DYNAMIC_DEBUG) |
239 | /* descriptor check is first to prevent flooding with "callbacks suppressed" */ |
239 | /* descriptor check is first to prevent flooding with "callbacks suppressed" */ |
240 | #define pr_debug_ratelimited(fmt, ...) \ |
240 | #define pr_debug_ratelimited(fmt, ...) \ |
241 | do { \ |
241 | do { \ |
242 | static DEFINE_RATELIMIT_STATE(_rs, \ |
242 | static DEFINE_RATELIMIT_STATE(_rs, \ |
243 | DEFAULT_RATELIMIT_INTERVAL, \ |
243 | DEFAULT_RATELIMIT_INTERVAL, \ |
244 | DEFAULT_RATELIMIT_BURST); \ |
244 | DEFAULT_RATELIMIT_BURST); \ |
245 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \ |
245 | DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, pr_fmt(fmt)); \ |
246 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ |
246 | if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \ |
247 | __ratelimit(&_rs)) \ |
247 | __ratelimit(&_rs)) \ |
248 | __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \ |
248 | __dynamic_pr_debug(&descriptor, pr_fmt(fmt), ##__VA_ARGS__); \ |
249 | } while (0) |
249 | } while (0) |
250 | #elif defined(DEBUG) |
250 | #elif defined(DEBUG) |
251 | #define pr_debug_ratelimited(fmt, ...) \ |
251 | #define pr_debug_ratelimited(fmt, ...) \ |
252 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
252 | printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
253 | #else |
253 | #else |
254 | #define pr_debug_ratelimited(fmt, ...) \ |
254 | #define pr_debug_ratelimited(fmt, ...) \ |
255 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
255 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
256 | #endif |
256 | #endif |
257 | 257 | ||
258 | extern const struct file_operations kmsg_fops; |
258 | extern const struct file_operations kmsg_fops; |
259 | 259 | ||
260 | enum { |
260 | enum { |
261 | DUMP_PREFIX_NONE, |
261 | DUMP_PREFIX_NONE, |
262 | DUMP_PREFIX_ADDRESS, |
262 | DUMP_PREFIX_ADDRESS, |
263 | DUMP_PREFIX_OFFSET |
263 | DUMP_PREFIX_OFFSET |
264 | }; |
264 | }; |
265 | 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, |
266 | int groupsize, char *linebuf, size_t linebuflen, |
266 | int groupsize, char *linebuf, size_t linebuflen, |
267 | bool ascii); |
267 | bool ascii); |
268 | 268 | ||
269 | 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, |
270 | int prefix_type, int rowsize, int groupsize, |
270 | int prefix_type, int rowsize, int groupsize, |
271 | const void *buf, size_t len, bool ascii); |
271 | const void *buf, size_t len, bool ascii); |
272 | 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, |
273 | const void *buf, size_t len); |
273 | const void *buf, size_t len); |
274 | 274 | ||
275 | 275 | ||
276 | #endif |
276 | #endif |