* proc_mknod() replacement @ 2005-05-09 11:17 KC 2005-05-09 15:41 ` Erik Mouw 0 siblings, 1 reply; 7+ messages in thread From: KC @ 2005-05-09 11:17 UTC (permalink / raw) To: linux-kernel Hi, I found that proc_mknod() had been removed from kernel 2.6.x. Any replacement ? Or how can I create file, device node or dir from device driver ? Thanks Regards KC kccheng@LinuxDAQ-Labs.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 11:17 proc_mknod() replacement KC @ 2005-05-09 15:41 ` Erik Mouw 2005-05-09 17:06 ` KC 0 siblings, 1 reply; 7+ messages in thread From: Erik Mouw @ 2005-05-09 15:41 UTC (permalink / raw) To: KC; +Cc: linux-kernel On Mon, May 09, 2005 at 07:17:44PM +0800, KC wrote: > I found that proc_mknod() had been removed from kernel 2.6.x. > Any replacement ? > > Or how can I create file, device node or dir from device driver ? You don't do that from a device driver in the first place. Have a look at udev, it will do what you want from userspace. Erik -- +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 15:41 ` Erik Mouw @ 2005-05-09 17:06 ` KC 2005-05-09 21:07 ` Valdis.Kletnieks 2005-05-09 22:04 ` Jim Crilly 0 siblings, 2 replies; 7+ messages in thread From: KC @ 2005-05-09 17:06 UTC (permalink / raw) To: Erik Mouw; +Cc: linux-kernel Hi, Thanks for reply. On 5/9/05, Erik Mouw <erik@harddisk-recovery.com> wrote: > On Mon, May 09, 2005 at 07:17:44PM +0800, KC wrote: > > I found that proc_mknod() had been removed from kernel 2.6.x. > > Any replacement ? > > > > Or how can I create file, device node or dir from device driver ? > > You don't do that from a device driver in the first place. Have a look > at udev, it will do what you want from userspace. For regular file, I do agree with you. But for device node, I don't see anything wrong by create it directly from kernel space. In fact, I do not understand why proc_mknod() is removed from 2.6.x ... I will be happy if someone can tell me why. Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, which can be downloaded from http://www.sourceforge.net/projects/ovi The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it will create 3 device entries (nodes) automatically at module load time. So number of device entries (nodes) will match number of devices of the system ... well, UNIX/Linux doesn't work that way ... there are a lot of device entries ... but no corresponding hardware existed. The proc_mknod() can fix the problems ... but it was removed from 2.6.x ... too bad ... at least for me. So I'm looking for an alternative way to create device entry under /dev from drivers instead of /proc ... but still don't know how. Anyone know how to do that ? It should be done at module_init() and the entry should be removed at module_exit(). Thanks KC > > Erik > > -- > +-- Erik Mouw -- www.harddisk-recovery.com -- +31 70 370 12 90 -- > | Lab address: Delftechpark 26, 2628 XH, Delft, The Netherlands > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 17:06 ` KC @ 2005-05-09 21:07 ` Valdis.Kletnieks 2005-05-10 2:05 ` KC 2005-05-09 22:04 ` Jim Crilly 1 sibling, 1 reply; 7+ messages in thread From: Valdis.Kletnieks @ 2005-05-09 21:07 UTC (permalink / raw) To: KC; +Cc: Erik Mouw, linux-kernel [-- Attachment #1: Type: text/plain, Size: 596 bytes --] On Tue, 10 May 2005 01:06:08 +0800, KC said: > Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, > which can be downloaded from > http://www.sourceforge.net/projects/ovi > The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it > will create 3 device entries (nodes) automatically at module load time. > So number of device entries (nodes) will match number of devices > of the system ... well, UNIX/Linux doesn't work that way ... there are a lot > of device entries ... but no corresponding hardware existed. Congrats. You've re-invented udev. [-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 21:07 ` Valdis.Kletnieks @ 2005-05-10 2:05 ` KC 0 siblings, 0 replies; 7+ messages in thread From: KC @ 2005-05-10 2:05 UTC (permalink / raw) To: Valdis.Kletnieks@vt.edu; +Cc: Erik Mouw, linux-kernel On 5/10/05, Valdis.Kletnieks@vt.edu <Valdis.Kletnieks@vt.edu> wrote: > On Tue, 10 May 2005 01:06:08 +0800, KC said: > > > Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, > > which can be downloaded from > > http://www.sourceforge.net/projects/ovi > > The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it > > will create 3 device entries (nodes) automatically at module load time. > > So number of device entries (nodes) will match number of devices > > of the system ... well, UNIX/Linux doesn't work that way ... there are a lot > > of device entries ... but no corresponding hardware existed. > > Congrats. You've re-invented udev. No, it's not ... dynamic entry is not my purpose, but a good feature which I want to have in my package and I did it using proc_mknod() for 2.4.x ... Anyway, I'll check udev to see if it's enough for me. Thanks KC > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 17:06 ` KC 2005-05-09 21:07 ` Valdis.Kletnieks @ 2005-05-09 22:04 ` Jim Crilly 2005-05-10 2:43 ` KC 1 sibling, 1 reply; 7+ messages in thread From: Jim Crilly @ 2005-05-09 22:04 UTC (permalink / raw) To: KC; +Cc: Erik Mouw, linux-kernel On 05/10/05 01:06:08AM +0800, KC wrote: > Hi, > > Thanks for reply. > > On 5/9/05, Erik Mouw <erik@harddisk-recovery.com> wrote: > > On Mon, May 09, 2005 at 07:17:44PM +0800, KC wrote: > > > I found that proc_mknod() had been removed from kernel 2.6.x. > > > Any replacement ? > > > > > > Or how can I create file, device node or dir from device driver ? > > > > You don't do that from a device driver in the first place. Have a look > > at udev, it will do what you want from userspace. > > For regular file, I do agree with you. But for device node, I don't see > anything wrong by create it directly from kernel space. > In fact, I do not understand why proc_mknod() is removed from > 2.6.x ... I will be happy if someone can tell me why. Because naming of devices is a policy that shouldn't be defined in the kernel. > > Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, > which can be downloaded from > http://www.sourceforge.net/projects/ovi > The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it > will create 3 device entries (nodes) automatically at module load time. > So number of device entries (nodes) will match number of devices > of the system ... well, UNIX/Linux doesn't work that way ... there are a lot > of device entries ... but no corresponding hardware existed. You must have not have converted to udev, it's sort of like devfs in that device nodes are created dynamicly but it's a userspace daemon that adds/removes device nodes in response to hotplug events generated by the kernel. > > The proc_mknod() can fix the problems ... but it was removed from 2.6.x ... > too bad ... at least for me. So I'm looking for an alternative way to create > device entry under /dev from drivers instead of /proc ... but still don't know > how. Anyone know how to do that ? It should be done at module_init() > and the entry should be removed at module_exit(). I believe if you use the driver core class stuff (i.e. class_simple_device_add) it should add device nodes in sysfs and generate hotplug events for udev. > > > Thanks > KC > Jim. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: proc_mknod() replacement 2005-05-09 22:04 ` Jim Crilly @ 2005-05-10 2:43 ` KC 0 siblings, 0 replies; 7+ messages in thread From: KC @ 2005-05-10 2:43 UTC (permalink / raw) To: KC, Erik Mouw, linux-kernel Hi > > > > For regular file, I do agree with you. But for device node, I don't see > > anything wrong by create it directly from kernel space. > > In fact, I do not understand why proc_mknod() is removed from > > 2.6.x ... I will be happy if someone can tell me why. > > Because naming of devices is a policy that shouldn't be defined in the > kernel. Mmm ... generally speaking, I agree with that ... but IMHO, the better way should be ... kernel or driver writer should provide default policy and allow user space to overwrite the default ... so once the module is loaded, it's ready to use ... without extra deamon's help. For example, in ovi-dev, I scan the PCI bus and if the device is found, create device entries as /proc/ovi/vendor_name/device_name-x.y where vendor_name and device_name is defined by driver writer. x is board ID which is determine by PCI scan. y is sub device ID (similar to minor number) which is defined by driver writer too. This approach may not good for general hardware such as tty, hard disk ... but is useful for DAQ system. By using this trick, I can provide a general deivce interface (APIs) such as ovi_dev_open(vendor_name, device_name, boardID, subID, flags) ovi_dev_write[b,w,l](dev, base, offset, value) ovi_dev_read[b,w,l](dev, base,offset, *value) ovi_dev_close(dev) And if your ISA/PCI/cPCI/PXI device only use I/O and memory access, you can have your driver done in ~ 5 min (maybe less) without any deamon's help ... Just load the driver and use the API to access the devices. > > > > Why I want to use proc_mknod() in driver ? I write a small package, ovi-dev, > > which can be downloaded from > > http://www.sourceforge.net/projects/ovi > > The ovi-dev will scan the PCI bus and if it found, eg, 3 PCI devices, it > > will create 3 device entries (nodes) automatically at module load time. > > So number of device entries (nodes) will match number of devices > > of the system ... well, UNIX/Linux doesn't work that way ... there are a lot > > of device entries ... but no corresponding hardware existed. > > You must have not have converted to udev, it's sort of like devfs in that > device nodes are created dynamicly but it's a userspace daemon that > adds/removes device nodes in response to hotplug events generated by the kernel. > > > > The proc_mknod() can fix the problems ... but it was removed from 2.6.x ... > > too bad ... at least for me. So I'm looking for an alternative way to create > > device entry under /dev from drivers instead of /proc ... but still don't know > > how. Anyone know how to do that ? It should be done at module_init() > > and the entry should be removed at module_exit(). > > I believe if you use the driver core class stuff (i.e. > class_simple_device_add) it should add device nodes in sysfs and generate > hotplug events for udev. Thanks, I will check that. Regards KC kccheng@LinuxDAQ-Labs.org > > Jim. > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2005-05-10 2:43 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2005-05-09 11:17 proc_mknod() replacement KC 2005-05-09 15:41 ` Erik Mouw 2005-05-09 17:06 ` KC 2005-05-09 21:07 ` Valdis.Kletnieks 2005-05-10 2:05 ` KC 2005-05-09 22:04 ` Jim Crilly 2005-05-10 2:43 ` KC
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox