* New IOCTLs
@ 2008-09-17 16:55 Singaravelan Nallasellan
2008-09-17 17:08 ` Alan Cox
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Singaravelan Nallasellan @ 2008-09-17 16:55 UTC (permalink / raw)
To: linux-kernel
I need to send device control messages to the driver. I am planning to
use the IOCTLs. But I came to know that Linux community does not
accept any new IOCTLs anymore.
Can somebody provide the reason behind the decision? Are there any
better approach to implement the device control interface other than
sysfs interface. I have some issues in using the sysfs interface.
Thanks in advance.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: New IOCTLs 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 2 siblings, 0 replies; 9+ messages in thread From: Alan Cox @ 2008-09-17 17:08 UTC (permalink / raw) To: Singaravelan Nallasellan; +Cc: linux-kernel On Wed, 17 Sep 2008 22:25:35 +0530 "Singaravelan Nallasellan" <singaravelann@gmail.com> wrote: > I need to send device control messages to the driver. I am planning to > use the IOCTLs. But I came to know that Linux community does not > accept any new IOCTLs anymore. I don't know who told you that but its not true. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 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 2 siblings, 0 replies; 9+ messages in thread From: Valdis.Kletnieks @ 2008-09-17 17:45 UTC (permalink / raw) To: Singaravelan Nallasellan; +Cc: linux-kernel [-- Attachment #1: Type: text/plain, Size: 1062 bytes --] On Wed, 17 Sep 2008 22:25:35 +0530, Singaravelan Nallasellan said: > I need to send device control messages to the driver. I am planning to > use the IOCTLs. But I came to know that Linux community does not > accept any new IOCTLs anymore. New IOCTL's are *not* in the "not accepting any new" state. However, there *will* be questioning whether a new IOCTL is the proper API, or if there should be some other interface instead (sysfs, debugfs, netlink, and so on). The basic problem with IOCTLs is that they tend to quickly become ugly design, with little attention paid to things like proper 32/64 bit interfaces (what happens when a 32-bit program tries to pass a parameter to a 32-bit kernel, and to a 64-bit kernel?). Maybe an ioctl is the right way to send your device control messages. Maybe some other API is better. What sort of messages need to be sent, and what sort of throughput/latency requirements are there, and so on? If you tell us more about what you're trying to get to/from userspace and the device, we can better suggest what to do... [-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 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 2 siblings, 1 reply; 9+ messages in thread From: Chris Snook @ 2008-09-17 20:12 UTC (permalink / raw) To: Singaravelan Nallasellan; +Cc: linux-kernel Singaravelan Nallasellan wrote: > I need to send device control messages to the driver. I am planning to > use the IOCTLs. But I came to know that Linux community does not > accept any new IOCTLs anymore. > Can somebody provide the reason behind the decision? Are there any > better approach to implement the device control interface other than > sysfs interface. I have some issues in using the sysfs interface. > Thanks in advance. IOCTLs are discouraged, but not strictly forbidden. Is there something about sysfs that would make it an unsuitable interface, or are you just having trouble finding good documentation on using it? -- Chris ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 2008-09-17 20:12 ` Chris Snook @ 2008-09-18 4:23 ` Singaravelan Nallasellan 2008-09-18 9:11 ` Louis Rilling ` (2 more replies) 0 siblings, 3 replies; 9+ messages in thread From: Singaravelan Nallasellan @ 2008-09-18 4:23 UTC (permalink / raw) To: Chris Snook; +Cc: linux-kernel Thank you for your response. 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. The driver allows multiple opens and assigns any random id. I appreciate your suggestion on alternate ways to implement the functionality. On Thu, Sep 18, 2008 at 1:42 AM, Chris Snook <csnook@redhat.com> wrote: > Singaravelan Nallasellan wrote: >> >> I need to send device control messages to the driver. I am planning to >> use the IOCTLs. But I came to know that Linux community does not >> accept any new IOCTLs anymore. >> Can somebody provide the reason behind the decision? Are there any >> better approach to implement the device control interface other than >> sysfs interface. I have some issues in using the sysfs interface. >> Thanks in advance. > > IOCTLs are discouraged, but not strictly forbidden. Is there something > about sysfs that would make it an unsuitable interface, or are you just > having trouble finding good documentation on using it? > > -- Chris > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 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 2 siblings, 0 replies; 9+ messages in thread From: Louis Rilling @ 2008-09-18 9:11 UTC (permalink / raw) To: Singaravelan Nallasellan; +Cc: Chris Snook, linux-kernel [-- Attachment #1: Type: text/plain, Size: 2561 bytes --] On Thu, Sep 18, 2008 at 09:53:51AM +0530, Singaravelan Nallasellan wrote: > Thank you for your response. > > 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. > > The driver allows multiple opens and assigns any random id. > > I appreciate your suggestion on alternate ways to implement the functionality. What about using configfs? A user could create an id using mkdir in the driver's configfs subsystem, and this would make the driver create the matching sysfs entry. # mkdir /sys/kernel/config/<driver_subsys>/2 -> reserve id 2 for the caller, and create /sys/class/xxx/<drivername>/2 You could even put whatever configuration items inside configfs instead of sysfs. Louis > > > On Thu, Sep 18, 2008 at 1:42 AM, Chris Snook <csnook@redhat.com> wrote: > > Singaravelan Nallasellan wrote: > >> > >> I need to send device control messages to the driver. I am planning to > >> use the IOCTLs. But I came to know that Linux community does not > >> accept any new IOCTLs anymore. > >> Can somebody provide the reason behind the decision? Are there any > >> better approach to implement the device control interface other than > >> sysfs interface. I have some issues in using the sysfs interface. > >> Thanks in advance. > > > > IOCTLs are discouraged, but not strictly forbidden. Is there something > > about sysfs that would make it an unsuitable interface, or are you just > > having trouble finding good documentation on using it? > > > > -- Chris > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Dr Louis Rilling Kerlabs Skype: louis.rilling Batiment Germanium Phone: (+33|0) 6 80 89 08 23 80 avenue des Buttes de Coesmes http://www.kerlabs.com/ 35700 Rennes [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 189 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 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 2 siblings, 0 replies; 9+ messages in thread From: Chris Snook @ 2008-09-19 19:22 UTC (permalink / raw) To: Singaravelan Nallasellan; +Cc: linux-kernel Singaravelan Nallasellan wrote: > Thank you for your response. > > 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. > > The driver allows multiple opens and assigns any random id. > > I appreciate your suggestion on alternate ways to implement the functionality. If you really need for each file descriptor that opens your device to have a unique context and set of properties that may be different from the rest, then an IOCTL might be legitimate here. If the device behaves the same way independent of context, then it's really just a locking issue, sysfs is the way to go. -- Chris > On Thu, Sep 18, 2008 at 1:42 AM, Chris Snook <csnook@redhat.com> wrote: >> Singaravelan Nallasellan wrote: >>> I need to send device control messages to the driver. I am planning to >>> use the IOCTLs. But I came to know that Linux community does not >>> accept any new IOCTLs anymore. >>> Can somebody provide the reason behind the decision? Are there any >>> better approach to implement the device control interface other than >>> sysfs interface. I have some issues in using the sysfs interface. >>> Thanks in advance. >> IOCTLs are discouraged, but not strictly forbidden. Is there something >> about sysfs that would make it an unsuitable interface, or are you just >> having trouble finding good documentation on using it? >> >> -- Chris >> > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: New IOCTLs 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 2 siblings, 0 replies; 9+ messages in thread From: Enrico Weigelt @ 2008-12-01 21:14 UTC (permalink / raw) To: linux kernel list * 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/ --------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <bd8Hz-6QR-17@gated-at.bofh.it>]
[parent not found: <bdbFu-2cb-23@gated-at.bofh.it>]
[parent not found: <bdjjC-3tt-7@gated-at.bofh.it>]
[parent not found: <bdnQd-13j-17@gated-at.bofh.it>]
* Re: New IOCTLs [not found] ` <bdnQd-13j-17@gated-at.bofh.it> @ 2008-09-18 14:54 ` Bodo Eggert 0 siblings, 0 replies; 9+ messages in thread From: Bodo Eggert @ 2008-09-18 14:54 UTC (permalink / raw) To: Louis.Rilling, Chris Snook, linux-kernel, Singaravelan Nallasellan Louis Rilling <Louis.Rilling@kerlabs.com> wrote: > On Thu, Sep 18, 2008 at 09:53:51AM +0530, Singaravelan Nallasellan wrote: >> Thank you for your response. >> >> The driver needs to assign an id for each open and create a sysfs >> entry based on that id and expose some properties. > What about using configfs? A user could create an id using mkdir in the > driver's configfs subsystem, and this would make the driver create the > matching sysfs entry. > > # mkdir /sys/kernel/config/<driver_subsys>/2 > -> reserve id 2 for the caller, and create /sys/class/xxx/<drivername>/2 > > You could even put whatever configuration items inside configfs instead of > sysfs. Sounds like simulating file descriptors, with more overhead and less functionality, just for having non-atomic access to name->value pairs. Besides that, we don't yet know the purpose of the IOCTL, and even less about the driver. Maybe the user will need to read or write, too, or pass the fd to other processes. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-12-01 21:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
[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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox