aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/printk-formats.txt32
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
16If <type> is dependent on a config option for its size (e.g., sector_t,
17blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
18format specifier of its largest possible type and explicitly cast to it.
19Example:
20
21 printk("test: sector number/total blocks: %llu/%llu\n",
22 (unsigned long long)sector, (unsigned long long)blockcount);
23
24Reminder: sizeof() result is of type size_t.
25
11 26
12Raw pointer value SHOULD be printed with %p. The kernel supports 27Raw pointer value SHOULD be printed with %p. The kernel supports
13the following extended format specifiers for pointer types: 28the 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
249u64 SHOULD be printed with %llu/%llx:
250
251 printk("%llu", u64_var);
252
253s64 SHOULD be printed with %lld/%llx:
254
255 printk("%lld", s64_var);
256
257If <type> is dependent on a config option for its size (e.g., sector_t,
258blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a
259format specifier of its largest possible type and explicitly cast to it.
260Example:
261
262 printk("test: sector number/total blocks: %llu/%llu\n",
263 (unsigned long long)sector, (unsigned long long)blockcount);
264
265Reminder: sizeof() result is of type size_t.
266 264
267Thank you for your cooperation and attention. 265Thank you for your cooperation and attention.
268 266