问题在于printk格式。我正在阅读的文档位于here
以下是我要问的摘录:
Physical addresses types phys_addr_t:
%pa[p] 0x01234567 or 0x0123456789abcdef
For printing a phys_addr_t type (and its derivatives, such as
resource_size_t) which can vary based on build options, regardless of
the width of the CPU data path. Passed by reference.
[p]
中的%pa[p]
代表什么?这是什么意思?
答案 0 :(得分:5)
p
中的[p]
代表<{>} phys_addr_t
,用于%pap
。这类似于d
中的%pad
代表 dma_addr_t
,如引用文档中所示:
DMA addresses types dma_addr_t:
%pad 0x01234567 or 0x0123456789abcdef
For printing a dma_addr_t type which can vary based on build options,
regardless of the width of the CPU data path. Passed by reference.
由于%pa
和%pap
之间没有记录的差异,这意味着它们的行为相同。括号内的内容表示可选修饰符。这可以在文档后面的%*pE
定义中看到:
Raw buffer as an escaped string:
%*pE[achnops]
...
The conversion rules are applied according to an optional combination
of flags (see string_escape_mem() kernel documentation for the
details):
a - ESCAPE_ANY
c - ESCAPE_SPECIAL
h - ESCAPE_HEX
n - ESCAPE_NULL
o - ESCAPE_OCTAL
p - ESCAPE_NP
s - ESCAPE_SPACE
By default ESCAPE_ANY_NP is used.