fla*_*urn 2 c linux device-driver linux-device-driver linux-kernel
问题是关于printk格式.我正在阅读的文档位于此处
以下是我要问的摘录:
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.
Run Code Online (Sandbox Code Playgroud)
是什么[p]在%pa[p]立场?这是什么意思?
将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.
Run Code Online (Sandbox Code Playgroud)
由于它没有提供%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.
Run Code Online (Sandbox Code Playgroud)