Re: Issue with limitation of 256 minors per major in LiS 2.16 on Linu x 2.4
Dave Grothe <[email protected]>
| Newsgroups | gmane.linux.kernel.streams |
|---|---|
| Message-ID | <6.1.2.0.2.20041006135729.0cffc528@localhost> |
LiS has the status of a file system in the Linux kernel. That means that it can define its own interpretation for dev_t structures. Since LiS-2.17 it has maintained an internal dev_t with 12 bits of major and 20 bits of minor. If you are operating clone devices then the external 8/8 restrictiveness is not something that you have to be concerned about. With clone devices you only need one node in /dev for your clone device, and this can fit into the 8/8 representation of the ext2 file system. Internally in your driver's open routine you can just compute a 20 bit minor device number and return it. If you need thousands of visible device nodes in /dev then you still need to use the multiple-major trick because the external ext2 file system is still 8/8. -- Dave At 01:25 PM 10/6/2004, Eashwaran, P wrote: >I tried to check if this issue has been addressed in previous archives, >but clicking on ><http://gsyc.escet.urjc.es/mailarchive/linux-streams>http://gsyc.escet.urjc.es/mailarchive/linux-streams >gives me a "Forbidden" error page! So, here it is again! Please feel >free to forward me links of older archives if this issue has been >previously discussed in this forum. > >Linux 2.4 allows only 256 minors per major. This is a severe restriction >for us. Our driver ports on other OSes allow for 1000+ devices. With the >current major/minor allocation scheme on Linux 2.4 we are now limited to >only 256 devices. > >Our user applications know only to open one device file which has major of >the LiS clone_drvr and minor as the actual STREAMS device's major number. > >In other discussions of this topic, I have seen suggestions where the user >application opens different device names. >All our applications work with one device file, so we cannot have multiple >device files with differing major numbers each supporting 256 devices. > >Currently, the driver uses dynamic allocation with lis_register_strdev >(with 0 arg) to obtain they major number dynamically. Reading a few links >on the web related to this (like ><http://www.mail-archive.com/[email protected]/msg00269.html>http://www.mail-archive.com/[email protected]/msg00269.html) >I've found that one can call the lis_register_strdev multiple times to get >multiple major numbers. > >I can do that in my driver and have an array of 4 major numbers each >capable of 256 minor numbers. My question is: when I return from >device_open routine, if I change the major number of the device to another >major number (allocated for the same driver) will it work? > >Lets say that I've majors 248, 250, 247, 253 in that order in my array of >4 allocated major numbers for my driver, because I called >lis_register_strdev 4 times. Also, lets say that I'm able to lookup an >internal array of 1024 minor devices and am able to determine which one is >free to use. Having said that, if I modify the *devp parameter in the >device_open by changing the major number AND minor number and returning >from the routine, will that work? Note that the major/minor pair is still >going to map to one of the major numbers that I've allocated dynamically. > >Even if the above strategy is alright, do you think it will still work >even if my driver uses locks. Currently I use 2 lis_rw_lock_t and 1 >lis_spin_lock_t structures to safeguard common data and critical sections. > >The only disadvantage is that there are a limited number of major numbers >available. Linux 2.6 is supposedly going to address this shortage by >increasing the number of minors per major and also increasing the number >of majors in the system. > >Any help is appreciated. > >Thanks & Regards, >Eashwaran. >