Subject: Re: major device numbers
To: Valentin Pepelea <valentin@netcom.com>
From: Dr. Bill Studenmund <wrstuden@loki.stanford.edu>
List: tech-kern
Date: 01/27/1999 20:19:31
On Wed, 27 Jan 1999, Valentin Pepelea 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

Actually it implies that wd uses major number 0. :-)

I don't understand what you saw in your ls. On what architecture did you
check? Wait, did you check on arm32? On an i386, I saw:

crw-r-----  1 root  operator  3, 0 Dec 16  1997 rwd0a
crw-r-----  1 root  operator  3, 1 Dec 16  1997 rwd0b
crw-r-----  1 root  operator  3, 2 Dec 16  1997 rwd0c
crw-r-----  1 root  operator  3, 3 Dec 16  1997 rwd0d
crw-r-----  1 root  operator  3, 4 Jan 19 04:49 rwd0e
crw-r-----  1 root  operator  3, 5 Jan 19 04:50 rwd0f
crw-r-----  1 root  operator  3, 6 Jan 19 04:50 rwd0g
crw-r-----  1 root  operator  3, 7 Dec 16  1997 rwd0h
brw-r-----  1 root  operator  0, 0 Dec 16  1997 wd0a
brw-r-----  1 root  operator  0, 1 Dec 16  1997 wd0b
brw-r-----  1 root  operator  0, 2 Dec 16  1997 wd0c
brw-r-----  1 root  operator  0, 3 Dec 16  1997 wd0d
brw-r-----  1 root  operator  0, 4 Dec 16  1997 wd0e
brw-r-----  1 root  operator  0, 5 Jan 25 04:30 wd0f
brw-r-----  1 root  operator  0, 6 Dec 16  1997 wd0g
brw-r-----  1 root  operator  0, 7 Dec 16  1997 wd0h

Also, block and character devices are derived from different tables,
bdevsw and cdevsw, so the same major number can be used by different
drivers.

I'm not sure where the magic happens that translates block dev 0 to 16.

Take care,

Bill