Re: [PATCH net-next v3 2/8] selftests/net: Provide test_snprintf() helper
From: Simon Horman
Date: Thu Aug 22 2024 - 06:13:54 EST
On Wed, Aug 21, 2024 at 10:35:10PM +0100, Dmitry Safonov wrote:
> Hi Simon,
>
> On Wed, 21 Aug 2024 at 20:10, Simon Horman <horms@xxxxxxxxxx> wrote:
> >
> > On Thu, Aug 15, 2024 at 10:32:27PM +0100, Dmitry Safonov via B4 Relay wrote:
> > > From: Dmitry Safonov <0x7f454c46@xxxxxxxxx>
> > >
> > > Instead of pre-allocating a fixed-sized buffer of TEST_MSG_BUFFER_SIZE
> > > and printing into it, call vsnprintf() with str = NULL, which will
> > > return the needed size of the buffer. This hack is documented in
> > > man 3 vsnprintf.
> > >
> > > Essentially, in C++ terms, it re-invents std::stringstream, which is
> > > going to be used to print different tracing paths and formatted strings.
> > > Use it straight away in __test_print() - which is thread-safe version of
> > > printing in selftests.
> > >
> > > Signed-off-by: Dmitry Safonov <0x7f454c46@xxxxxxxxx>
> >
> > Hi Dmitry,
> >
> > Some minor nits, as it looks like there will be a v4.
>
> Thanks, both seem reasonable.
> Did you get them with checkpatch.pl or with your trained eyes? :)
>
> These days I run b4 prep --check and on latest version it just gave a
> bunch of fmt-strings with columns > 100.
Hi Dimitry,
For networking code I usually run:
checkpatch.pl --strict --codespell --min-conf-desc-length=80
Where 80 is, I believe, still in line with preferences for Networking code.
Although I'm not entirely sure it is applicable to this patch.
As to your question, in this case I think it is the --strict that causes
checkpatch to flag the issues I raised. Sorry for not mentioning that in my
previous email.