[dpdk-dev] [PATCH 2/5] eal: extract function eal_parse_sysfs_valuef

Shreyansh Jain shreyansh.jain at nxp.com
Thu Sep 1 11:01:27 CEST 2016


Hi Stephen,

On Thursday 01 September 2016 12:00 PM, Stephen Hemminger wrote:
> On Thu, 1 Sep 2016 10:11:52 +0530
> Shreyansh Jain <shreyansh.jain at nxp.com> wrote:
>
>> From: Jan Viktorin <viktorin at rehivetech.com>
>>
>> From: Jan Viktorin <viktorin at rehivetech.com>
>>
>> The eal_parse_sysfs_value function accepts a filename however, such
>> interface introduces race-conditions to the code. Introduce the
>> variant of this function that accepts an already opened file instead of
>> a filename.
>>
>> Signed-off-by: Jan Viktorin <viktorin at rehivetech.com>
>> Signed-off-by: Shreyansh Jain <shreyansh.jain at nxp.com>
>> ---
>
> You introduce new API, but don't use it in your other patches.

Indeed - I have not used this API anywhere in my patches. As highlighted 
in the covering letter, these are some proposed changes which *might* 
help in future (for e.g., introducing new SoC infra).
Patches don't depend on each other.

> I don't see where passing filename is racy. sysfs files only get created/destroyed
> when device is added/removed.
>

Agree that 'race-condition' is not the right word.

parse_sysfs_value reads a single integer from a given sysfs file and is 
a useful helper for EAL layer, specifically for non-PCI infra as and 
when it is introduced (reading through custom sysfs files).
At that time, it may be possible that caller keeps the context of the 
call rather than open the file every time - for reading more than an 
integer, for example.

-
Shreyansh


More information about the dev mailing list