2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-22 04:03:58 +08:00

docs: printk-formats: add ptrdiff_t type to printk-formats

When print the difference between two pointers, we should use
the ptrdiff_t modifier %t.

Signed-off-by: Miles Chen <miles.chen@mediatek.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
Miles Chen 2019-10-01 18:04:49 +08:00 committed by Jonathan Corbet
parent f0ae2cfae5
commit 88288ed050

View File

@ -135,6 +135,20 @@ equivalent to %lx (or %lu). %px is preferred because it is more uniquely
grep'able. If in the future we need to modify the way the kernel handles
printing pointers we will be better equipped to find the call sites.
Pointer Differences
-------------------
::
%td 2560
%tx a00
For printing the pointer differences, use the %t modifier for ptrdiff_t.
Example::
printk("test: difference between pointers: %td\n", ptr2 - ptr1);
Struct Resources
----------------