lkml.org 
[lkml]   [2022]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] gpiolib: cdev: add fdinfo output for line request file descriptors
On Tue, Sep 20, 2022 at 10:35:25PM +0200, Bartosz Golaszewski wrote:
> On Tue, Sep 20, 2022 at 7:19 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Sep 20, 2022 at 03:54:35PM +0200, Bartosz Golaszewski wrote:

...

> > > + seq_printf(out, "gpio-device:\t%s\n", dev_name(dev));
> > > +
> > > + for (i = 0; i < lr->num_lines; i++)
> > > + seq_printf(out, "gpio-line:\t%d\n",
> > > + gpio_chip_hwgpio(lr->lines[i].desc));
> >
> > Hmm... Not sure which variant is better (as for machine parsing and for human),
> > but I was thinking of
>
> IMO it's pretty clear that the variant in this patch is easier for
> machine parsing - one less tokenization.

For human it's harder in my opinion... But okay.

> > gpio-lines: 1,4,6, ...
> >
> > Also don't forget that sizes over PAGE_SIZE in sysfs sometimes problematic and
> > racy.(the commit 888be6067b97 ("ACPI: sysfs: Fix a buffer overrun problem with
> > description_show()") for the reference).
>
> In most systems PAGE_SIZE will be at least 4096 bytes. With this patch
> a single "gpio-line:\t65535\n" is at most 17 bytes long x max 64 lines
> = 1088 bytes. We're still way below the size where it would be
> problematic.

Okay, for now it's 64, but it will be problematic starting from ~300 requested
lines. Also, in case we add something more, who knows?

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2022-09-21 16:45    [W:0.043 / U:2.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site