On Mon, 14 Sept 2026 at 19:37, Stephen Hemminger
<[email protected]> 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.

You can move the new header in lib/eal/linux/include/ and remove the
#ifdef LINUX guards.

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

I agree.

> The new rte_sysfs_parse_XXX routines are exported, but marked
> as internal use only.
>
> v3 - fix doxygen comments

I'll try to review soon, after the VFIO series.


-- 
David Marchand

Reply via email to