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

Tomasz Duszynski tduszynski at marvell.com
Thu Jan 26 09:30:01 CET 2023


>-----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. 

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? 


More information about the dev mailing list