LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-17-2003, 09:18 PM   #1
devershetty
LQ Newbie
 
Registered: Jun 2003
Location: Gangavathi, Karnataka(state), INDIA
Distribution: Redhat 7.3
Posts: 28

Rep: Reputation: 15
Question devfs max major/minor numbers


Hi All..

As of now Linux kernel supports 8 bits for Major and 8 bits for minor numbers ...but using devfs support for Linux kernel is it possible to increase this limit???
i need to support 1024 devices using one major number ? how?

-thanks in advacne.
-Kotresh.
 
Old 06-17-2003, 09:37 PM   #2
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
devfs doesn't do its thing using Major and minor numbers, those are there just for backward compatibility.
From the kernel documentation, /usr/src/linux/Documentation/filesystems/devfs/README:
Quote:

Linux *must* move beyond the 8 bit major and minor barrier,
somehow. If we simply increase each to 16 bits, then the indexing
scheme used for major driver lookup becomes untenable, because the
major tables (one each for character and block devices) would need to
be 64 k entries long (512 kBytes on x86, 1 MByte for 64 bit
systems). So we would have to use a scheme like that used for
miscellaneous character devices, which means the search time goes up
linearly with the average number of major device drivers on your
system. Not all "devices" are hardware, some are higher-level drivers
like KGI, so you can get more "devices" without adding hardware
You can improve this by creating an ordered (balanced:-)
binary tree, in which case your search time becomes log(N).
Alternatively, you can use hashing to speed up the search.
But why do that search at all if you don't have to? Once again, it
seems pointless.

Note that devfs doesn't use the major&minor system. For devfs
entries, the connection is done when you lookup the /dev entry. When
devfs_register() is called, an internal table is appended which has
the entry name and the file_operations. If the dentry cache doesn't
have the /dev entry already, this internal table is scanned to get the
file_operations, and an inode is created. If the dentry cache already
has the entry, there is *no lookup time* (other than the dentry scan
itself, but we can't avoid that anyway, and besides Linux dentries
cream other OS's which don't have them:-). Furthermore, the number of
node entries in a devfs is only the number of available device
entries, not the number of *conceivable* entries. Even if you remove
unnecessary entries in a disc-based /dev, the number of conceivable
entries remains the same: you just limit yourself in order to save
space.

Last edited by moses; 06-17-2003 at 09:41 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why i cant get man major() or minor() henryluo Programming 5 06-27-2005 02:39 AM
How to determine major, minor programatically markjuggles Programming 1 04-15-2005 01:09 PM
Mouse mknod major/minor numbers? BlurredWeasel Linux - Hardware 2 11-06-2003 02:22 PM
major/minor number zyan Linux - Newbie 2 06-25-2001 06:57 PM
major /minor number zyan Linux - General 0 06-22-2001 02:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration