[vortex] Duplicate major numbers and resolving device file names

Manish Madan mmadan@novell.com
Tue Oct 22 00:54:01 2002


Hello,
        I am new to kernel programming. I had a couple of questions. When I try to add device special files to /dev using mknod, it allows me to add files with the same major number and even the same major and minor numbers. How is this possible ? Won't having two drivers for the same device (same major-minor pair for a character device, say) cause a conflict ?
        Second question is also related to the first. How exactly does the kernel look up a device once a user has "opened" the requisite file in /dev ? The book says that it looks up the character or block switch tables. and then goes through major and minor numbers. If so, the above point means that there will be a conflict when resolving which driver to use.
        I also wanted to find out how I can determine which is the correct file in /dev for a particular device (say hard disk). Since I can name a hard disk hda or any other name I choose in /dev, how do I determine which file refers to the hard disk ? Is this information stored somewhere in the system in user space ? If not in user space, how can I get at this info in kernel space ?

Thank You
Manish