public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Enrico Weigelt <weigelt@metux.de>
To: linux kernel list <linux-kernel@vger.kernel.org>
Subject: Re: New IOCTLs
Date: Mon, 1 Dec 2008 22:14:34 +0100	[thread overview]
Message-ID: <20081201211434.GD31710@nibiru.local> (raw)
In-Reply-To: <3baf3d760809172123q5445780dldaaa51d59c0b688a@mail.gmail.com>

* Singaravelan Nallasellan <singaravelann@gmail.com> 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/
---------------------------------------------------------------------

  parent reply	other threads:[~2008-12-01 21:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-17 16:55 New IOCTLs Singaravelan Nallasellan
2008-09-17 17:08 ` Alan Cox
2008-09-17 17:45 ` Valdis.Kletnieks
2008-09-17 20:12 ` Chris Snook
2008-09-18  4:23   ` Singaravelan Nallasellan
2008-09-18  9:11     ` Louis Rilling
2008-09-19 19:22     ` Chris Snook
2008-12-01 21:14     ` Enrico Weigelt [this message]
     [not found] <bd8Hz-6QR-17@gated-at.bofh.it>
     [not found] ` <bdbFu-2cb-23@gated-at.bofh.it>
     [not found]   ` <bdjjC-3tt-7@gated-at.bofh.it>
     [not found]     ` <bdnQd-13j-17@gated-at.bofh.it>
2008-09-18 14:54       ` Bodo Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081201211434.GD31710@nibiru.local \
    --to=weigelt@metux.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox