[EXT] Re: [PATCH 1/2] lib: add helper to read strings from sysfs files

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Jan 26 18:21:00 CET 2023


On Thu, Jan 26, 2023 at 08:30:01AM +0000, Tomasz Duszynski wrote:
> 
> >-----Original Message-----
> >From: Tyler Retzlaff <roretzla at linux.microsoft.com>
> >Sent: Wednesday, January 25, 2023 5:16 PM
> >To: Thomas Monjalon <thomas at monjalon.net>
> >Cc: Tomasz Duszynski <tduszynski at marvell.com>; dev at dpdk.org; Jerin Jacob Kollanukkaran
> ><jerinj at marvell.com>; stephen at networkplumber.org; chenbo.xia at intel.com; david.marchand at redhat.com;
> >bruce.richardson at intel.com
> >Subject: [EXT] Re: [PATCH 1/2] lib: add helper to read strings from sysfs files
> >
> >External Email
> >
> >----------------------------------------------------------------------
> >On Wed, Jan 25, 2023 at 11:39:30AM +0100, Thomas Monjalon wrote:
> >> 25/01/2023 11:33, Tomasz Duszynski:
> >> > Reading strings from sysfs files is a re-occurring pattern hence add
> >> > helper for doing that.
> >>
> >> In general it would be to nice to clean sysfs parsing in libs and
> >> drivers, so they all use some functions from EAL.
> >
> >maybe there should be a general utility library for dealing with sysfs separate from the core EAL
> >that drivers / platform specific libs can share?
> 
> reading/writing of sysfs files is scattered around the codebase and this has been piling up
> with each and and every new pmd/lib that requires it. So generally a few simple utility functions 
> in one place may be a good idea. 

i'm an advocate of smaller libraries that tackle a subject area and do
so well. even better if they can be unit tested without dragging in a
lot of dependencies or bootstrapping other unrelated subsystems.

it is also in alignment with trying to de-bloat eal which i think there
is increasing interest in.

> 
> Would following make sense?
> 
> rte_sysfs_write_int()
> rte_sysfs_write_string()
> rte_sysfs_read_int()
> rte_sysfs_read_string() 
> 
> Also seems that pattern where file gets opened once and keeps being written to until closed is 
> reoccurring as well. So there might be some utils for that as well. Thoughts? 

i guess the answer here is whatever makes a simple intuitive api for
sysfs access, i don't contribute much on the linux side to dpdk so can't
speak to what makes a good api here, but i imagine others can in review.

thanks


More information about the dev mailing list