printk 格式中 %pa[p] 中 p 的含义

meaning of p in %pa[p] in the printk formats

问题是关于 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.

%pa[p]中的[p]代表什么?这是什么意思?

[p]中的p%pap中代表phys_addr_t。这类似于 %pad 中的 d 代表 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.