Subject: Re: major device numbers
To: Dr. Bill Studenmund <>
From: Chris G. Demetriou <>
List: tech-kern
Date: 01/27/1999 21:15:14
"Dr. Bill Studenmund" <> writes:
> [ ... ]
> > 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

No, it doesn't.

I'm not sure where you got that code (it doesn't match anything in the
tree), but it doesn't make sense.  A call to readdisklabel will
usually look somewhat like:

	errstring = readdisklabel(dev, strategy, <other parameters>);

The interesting thing to note there is that 'dev' isn't used to look
up 'strategy', 'strategy' is passed as an argument.

since 'dev' is _not_ used to look up the strategy (or any other *devsw
routine), the major number isn't necessary, and so is passed as 0.  (a
#defined constant indicating "not needed" might be better, but once
you understand the code... 8-)  There's no point in going to the work
to track down the major number if it's not goign to be used.

Chris Demetriou - -
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.