[PATCH v2 4/6] doc: printf() codes: Add bitmap format specifier

Heinrich Schuchardt xypron.glpk at gmx.de
Tue Dec 12 11:25:28 CET 2023


On 12.12.23 09:52, lukas.funke-oss at weidmueller.com wrote:
> From: Lukas Funke <lukas.funke at weidmueller.com>
>
> Add '%*pb[l]' printf format specifier as descriped in [1].
>
> [1] https://www.kernel.org/doc/Documentation/printk-formats.txt
>
> Signed-off-by: Lukas Funke <lukas.funke at weidmueller.com>
> ---
>
> (no changes since v1)
>
>   doc/develop/printf.rst | 6 ++++++
>   1 file changed, 6 insertions(+)
>
> diff --git a/doc/develop/printf.rst b/doc/develop/printf.rst
> index 99d05061b1..c3537b1796 100644
> --- a/doc/develop/printf.rst
> +++ b/doc/develop/printf.rst
> @@ -165,6 +165,12 @@ Pointers
>   	* phys_size_t
>   	* resource_size_t
>
> +%*pb, %*pbl
> +        prints bitmap and its derivatives such as cpumask and nodemask.
> +        '%*pb' outputs the bitmap with field width as the number of bits
> +        and '%*pbl' outputs the bitmap as range list with field width as
> +        the number of bits.

This looks like '*' has to added as character. I would leave it away as
you can always have %<width>.<precision><format specifier>. '*' is only
needed if you want to path the width as extra parameter.

With the given description I would not have expected an output like
'2,5-6' for the number 0x64. Please, add separate entries for %pb and
%pbl and provide examples.

=> setexpr a fmt '%320pb' 100; echo $a
0000555a,00000000,00000000,00000000,00000000,00000080,00007fff,f0094f48,00000000,00000064
=> setexpr a fmt '%3200pb' 100; echo $a
`%3200pb': invalid format
0000555a,00000000,00000000,00000000,00000000,00000080,00007fff,f0094f48,00000000,00000064

Nothing in the documentation makes me assume that width 320 should work
and 3200 should not.

Best regards

Heinrich

> +
>   %pD
>           prints a UEFI device path
>



More information about the U-Boot mailing list