Re: [PATCH v2 07/28] lib/printbuf: Unit specifiers

From: Kent Overstreet
Date: Thu May 19 2022 - 16:26:38 EST


On Thu, May 19, 2022 at 11:21:41PM +0300, Andy Shevchenko wrote:
> On Thu, May 19, 2022 at 01:24:00PM -0400, Kent Overstreet wrote:
> > +void pr_human_readable_s64(struct printbuf *buf, s64 v)
> > +{
> > + if (v < 0)
> > + pr_char(buf, '-');
> > + pr_human_readable_u64(buf, abs(v));
>
> Wouldn't -v work?

This is a bit terser

> > + * pr_human_readable_u64 - Print out a u64 according to printbuf unit options
>
> Have you ever compile this? We have kernel doc validator running when compiling
> the code...

Yes I have, but I've never seen the kernel doc validator - can you point me to
something so I can get that working?

> > +void pr_units_s64(struct printbuf *out, s64 v)
> > +{
> > + if (v < 0)
> > + pr_char(out, '-');
> > + pr_units_u64(out, v);
>
> Please, start with test cases.

I suppose now that we've got kunit I should learn how to use it :) And thanks,
good catch