Re: [PATCH v2 1/8] lib/printbuf: New data structure for heap-allocated strings

From: Joe Perches
Date: Mon Apr 25 2022 - 00:49:55 EST


On Mon, 2022-04-25 at 00:19 -0400, Kent Overstreet wrote:
> On Mon, Apr 25, 2022 at 03:44:34AM +0100, Matthew Wilcox wrote:
> > On Sun, Apr 24, 2022 at 04:46:03PM -0700, Joe Perches wrote:
> > > > + * pr_human_readable_u64, pr_human_readable_s64: Print an integer with human
> > > > + * readable units.
> > >
> > > Why not extend vsprintf for this using something like %pH[8|16|32|64]
> > > or %pH[c|s|l|ll|uc|us|ul|ull] ?
> >
> > The %pX extension we have is _cute_, but ultimately a bad idea. It
> > centralises all kinds of unrelated things in vsprintf.c, eg bdev_name()
> > and clock() and ip_addr_string().
>
> And it's not remotely discoverable. I didn't realize we had bdev_name()
> available as a format string until just now or I would've been using it!

Documentation/core-api/printk-formats.rst