>-----Original Message----- >From: Tyler Retzlaff <roret...@linux.microsoft.com> >Sent: Wednesday, January 25, 2023 5:16 PM >To: Thomas Monjalon <tho...@monjalon.net> >Cc: Tomasz Duszynski <tduszyn...@marvell.com>; dev@dpdk.org; Jerin Jacob >Kollanukkaran ><jer...@marvell.com>; step...@networkplumber.org; chenbo....@intel.com; >david.march...@redhat.com; >bruce.richard...@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?