* Singaravelan Nallasellan <[email protected]> wrote:
Hi,
> The driver needs to assign an id for each open and create a sysfs
> entry based on that id and expose some properties.
>
> For example, if the driver assigns an id 2, the sysfs entry will be as below:
> /sys/class/xxx/<drivername>/2/version
>
> When the driver close is invoked, it will have to remove the entry.
>
> The issue here is that the application needs:
> 1. To know the id it should use to access properties after the open.
> 2. To have exclusive access to the sysfs entries. No other application
> should and open the entry and use it. There is a chance the the other
> application could open the entries before this application opens it.
Simply add an clone file, reading from it creates new context and
sends back its ID.
box:/ # cat /sys/class/xxx/foodriver/clone
3
box:/ # cat /sys/class/xxx/foodriver/3/version
1.0
...
To destroy the context:
box:/ # echo "release" > /sys/class/xxx/foodriver/3/ctl
cu
--
---------------------------------------------------------------------
Enrico Weigelt == metux IT service - http://www.metux.de/
---------------------------------------------------------------------
Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
---------------------------------------------------------------------