The question is with regard to the printk formats. The documentation that I’m reading is located here
Here is an excerpt that I’m asking about:
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.
What does [p] in %pa[p] stand for? What does it mean?
Advertisement
Answer
The p in [p] stands for phys_addr_t when used in %pap. This is analogous to the d in %pad stands for dma_addr_t, as seen in the cited document:
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.
Since it provides no documented difference between %pa and %pap, it means that they behave the same. The contents inside the brackets indicate optional modifiers. This is seen in the definition of %*pE later in the document:
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.