Re: [PATCH v3 02/25] printk: Add print format (%par) for struct range
From: Andy Shevchenko
Date: Mon Aug 26 2024 - 09:24:50 EST
On Mon, Aug 26, 2024 at 03:17:26PM +0200, Petr Mladek wrote:
> On Thu 2024-08-22 12:53:32, Ira Weiny wrote:
> > Petr Mladek wrote:
> > > On Fri 2024-08-16 09:44:10, Ira Weiny wrote:
[...]
> > > > + static const struct printf_spec range_spec = {
> > > > + .base = 16,
> > > > + .field_width = RANGE_PRINTK_SIZE,
> >
> > However, my testing indicates this needs to be.
> >
> > .field_width = 18, /* 2 (0x) + 2 * 8 (bytes) */
>
> Makes sense. Great catch!
Which effectively means usage of special_hex_number().
But again, consider to unite this with %pR/r implementation(s).
> > ... to properly zero pad the value. Does that make sense?
> >
> > > > + .precision = -1,
> > > > + .flags = SPECIAL | SMALL | ZEROPAD,
> > > > + };
--
With Best Regards,
Andy Shevchenko