Subject: Re: major device numbers
To: Valentin Pepelea <valentin@netcom.com>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 01/28/1999 12:01:09
On Wed, 27 Jan 1999 15:30:40 -0800 (PST) 
 Valentin Pepelea <valentin@netcom.com> wrote:

 > I'm confused about major device numbers. The 'ls -l /dev/*wd0*' command shows
 > both character and block disk devices using major number 16. How is this
 > possible? Attempting to clear out the confusion, I read /dev/ata/wd.c to see
 > what numbers it uses. There I can find the statement
 > 
 >   wdstrategy = readdisklabel(MAKEWDDEV(0, wd->sc_dev.dv_unit, RAW_PART), ...
 > 
 > which implies that /dev/rwd0c uses major number 0. Ok, I give up. :-P

Character and block devices are in different tables altogether, so having
the same major both both does not constitute a collision.

On the issue of hard-coding major 0 into wd.c, "who thought that was a good
idea?!"  It's certainly not correct on all ports.

Also, for the most part, once you're IN a driver, the major number doesn't
matter a whole lot... note that the line in wdgetdisklabel() _passes in_
a pointer to wdstrategy()... the major number is only used to select which
driver is used, and since the driver is being referenced directly, it's
effectively ignored.

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>