提交 88288ed0 编写于 作者: M Miles Chen 提交者: Jonathan Corbet

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: NMiles Chen <miles.chen@mediatek.com>
Signed-off-by: NJonathan Corbet <corbet@lwn.net>
上级 f0ae2cfa
...@@ -135,6 +135,20 @@ equivalent to %lx (or %lu). %px is preferred because it is more uniquely ...@@ -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 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. 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 Struct Resources
---------------- ----------------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册