Re: [PATCH 2/2] netcons: Add udp send fail statistics to netconsole

From: Jakub Kicinski
Date: Tue Aug 27 2024 - 09:59:50 EST


On Mon, 26 Aug 2024 19:55:36 -0400 Maksym Kutsevol wrote:
> > > +static ssize_t stats_show(struct config_item *item, char *buf)
> > > +{
> > > + struct netconsole_target *nt = to_target(item);
> > > +
> > > + return
> > > + nt->stats.xmit_drop_count, nt->stats.enomem_count);
> >
> > does configfs require value per file like sysfs or this is okay?
>
> Docs say (Documentation/filesystems/sysfs.txt):
>
> Attributes should be ASCII text files, preferably with only one value
> per file. It is noted that it may not be efficient to contain only one
> value per file, so it is socially acceptable to express an array of
> values of the same type.

Right, but this is for sysfs, main question is whether configfs has
the same expectations.

> Given those are of the same type, I thought it's ok. To make it less
> "fancy" maybe move to
> just values separated by whitespace + a block in
> Documentation/networking/netconsole.rst describing the format?
> E.g. sysfs_emit(buf, "%lu %lu\n", .....) ? I really don't want to have
> multiple files for it.
> What do you think?

Stats as an array are quite hard to read / understand