diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/printk-formats.txt | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/Documentation/printk-formats.txt b/Documentation/printk-formats.txt index 71438f3eb0c0..56804e40cb18 100644 --- a/Documentation/printk-formats.txt +++ b/Documentation/printk-formats.txt | |||
@@ -8,6 +8,21 @@ If variable is of Type, use printk format specifier: | |||
8 | unsigned long long %llu or %llx | 8 | unsigned long long %llu or %llx |
9 | size_t %zu or %zx | 9 | size_t %zu or %zx |
10 | ssize_t %zd or %zx | 10 | ssize_t %zd or %zx |
11 | s32 %d or %x | ||
12 | u32 %u or %x | ||
13 | s64 %lld or %llx | ||
14 | u64 %llu or %llx | ||
15 | |||
16 | If <type> is dependent on a config option for its size (e.g., sector_t, | ||
17 | blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a | ||
18 | format specifier of its largest possible type and explicitly cast to it. | ||
19 | Example: | ||
20 | |||
21 | printk("test: sector number/total blocks: %llu/%llu\n", | ||
22 | (unsigned long long)sector, (unsigned long long)blockcount); | ||
23 | |||
24 | Reminder: sizeof() result is of type size_t. | ||
25 | |||
11 | 26 | ||
12 | Raw pointer value SHOULD be printed with %p. The kernel supports | 27 | Raw pointer value SHOULD be printed with %p. The kernel supports |
13 | the following extended format specifiers for pointer types: | 28 | the following extended format specifiers for pointer types: |
@@ -246,23 +261,6 @@ struct va_format: | |||
246 | 261 | ||
247 | Passed by reference. | 262 | Passed by reference. |
248 | 263 | ||
249 | u64 SHOULD be printed with %llu/%llx: | ||
250 | |||
251 | printk("%llu", u64_var); | ||
252 | |||
253 | s64 SHOULD be printed with %lld/%llx: | ||
254 | |||
255 | printk("%lld", s64_var); | ||
256 | |||
257 | If <type> is dependent on a config option for its size (e.g., sector_t, | ||
258 | blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a | ||
259 | format specifier of its largest possible type and explicitly cast to it. | ||
260 | Example: | ||
261 | |||
262 | printk("test: sector number/total blocks: %llu/%llu\n", | ||
263 | (unsigned long long)sector, (unsigned long long)blockcount); | ||
264 | |||
265 | Reminder: sizeof() result is of type size_t. | ||
266 | 264 | ||
267 | Thank you for your cooperation and attention. | 265 | Thank you for your cooperation and attention. |
268 | 266 | ||