On Mon, Sep 14, 2026 at 10:36:13AM -0700, Stephen Hemminger wrote: > After reviewing lots of drivers and seeing sloppy string handling > resorted to AI assistance to unify and consolidate the parsing > of sysfs values. Many drivers open code this with similar pattern > but lacked any coherent error handling. The kernel API is > consistent and won't give bad data, but it make sense to > check for garbage. > > Add one set of routines in EAL that build the path from a printf > style format and convert with strtoul()/strtol(), then convert the > existing callers. > > Since the new routines are Linux only, a driver that uses sysfs while > advertising support on FreeBSD or Windows now fails to link. Two such > cases turned up and are fixed here: the eal_fs test and common/ionic. > > Note: existing eal_parse_sysfs_value() goes away with this. > It was exported as a stable symbol, which was a mistake: > the eal_ prefix and the private eal_filesystem.h both say it is internal, > and nothing outside the tree should have been calling it. > The new rte_sysfs_parse_XXX routines are exported, but marked > as internal use only. > > v3 - fix doxygen comments > > Stephen Hemminger (9): > eal: add common sysfs value routines > dma/idxd: use common sysfs routines > common/ionic: use common sysfs routines > bus/vmbus: use common sysfs routines > power: use common sysfs routines > drivers/bus: remove duplicate sysfs string helpers > common/mlx5: use common sysfs routines > net/mlx5: use common sysfs routines > net/mana: use common sysfs routines > Series-acked-by: Bruce Richardson <[email protected]>
I double-checked this v3 again (as with v2) by running the unit tests against a device using idxd driver which reads parameters from sysfs. No issues seen. /Bruce

