Issue with limitation of 256 minors per major in LiS 2.16 on Linu x 2.4

"Eashwaran, P" <[email protected]>
Newsgroups gmane.linux.kernel.streams
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.