Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: printk-formats: update size-casting examples

Since commit 72deb455b5ec ("block: remove CONFIG_LBDAF") sector_t and
blkcnt_t types are no longer variable in size, making them unsuitable
examples for casting to the largest possible type. This patch replaces
such examples with cycles_t and blk_status_t types, whose sizes depend
on architecture and config options respectively.

Signed-off-by: Carlos Llamas <cmllamas@google.com>
Link: https://lore.kernel.org/r/20210609195058.3518943-1-cmllamas@google.com
Signed-off-by: Jonathan Corbet <corbet@lwn.net>

authored by

Carlos Llamas and committed by
Jonathan Corbet
d7c176e9 a9edc03f

+4 -5
+4 -5
Documentation/core-api/printk-formats.rst
··· 37 37 u64 %llu or %llx 38 38 39 39 40 - If <type> is dependent on a config option for its size (e.g., sector_t, 41 - blkcnt_t) or is architecture-dependent for its size (e.g., tcflag_t), use a 42 - format specifier of its largest possible type and explicitly cast to it. 40 + If <type> is architecture-dependent for its size (e.g., cycles_t, tcflag_t) or 41 + is dependent on a config option for its size (e.g., blk_status_t), use a format 42 + specifier of its largest possible type and explicitly cast to it. 43 43 44 44 Example:: 45 45 46 - printk("test: sector number/total blocks: %llu/%llu\n", 47 - (unsigned long long)sector, (unsigned long long)blockcount); 46 + printk("test: latency: %llu cycles\n", (unsigned long long)time); 48 47 49 48 Reminder: sizeof() returns type size_t. 50 49