Subject: Re: Another changer, another changer problem
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Greg A. Woods <woods@most.weird.com>
List: current-users
Date: 10/04/1998 17:32:42
[ On Sun, October 4, 1998 at 12:38:46 (-0700), Bill Studenmund wrote: ]
> Subject: Re: Another changer, another changer problem
>
> Ok. That explanation didn't work. So here's a question: how exactly do you
> have an "out of band" device node? How can we have an "out of band" 
> device node for the raw disk? Since device nodes for disks are processed
> as major number / unit / partition, we have to be able to indicate we want
> the "raw"  partition somehow. Right now, we make one of the partitions
> special. You were wanting to do something different. So if blessing a
> partition isn't ok, we have to do something using either the unit number
> or the major number to indicate "raw" drive.  Both of those strike me as
> wasteful.

I think all of Bill's confusion comes from a simple off-by-one
assumption he's making.  I don't quite know why, since I *never*
mentioned "major" numbers when talking about the idea of having a fixed
"minor" number to reference the raw disk....

How about we explain it this way:  If you count your partitions from
"one" (1), then there's a spare minor number for each ``unit'' (0).
I.e. one could simply assume there are 17 (or 23) slices per unit and
use the 0'th [or 17'th (or 23'rd) if you detest counting from one] unit
as the raw disk.

	SCSI-raw-minor = bus * target * LUN * 23
	SCSI-part-minor = bus * target * LUN * 23 + part (where part is origin 1)

There.  Understand?  Don't like "23" as a magic number?  Then pick 32 or
64 or some such "nicer" number that's also larger and deal with the
empty space (i.e. return ENXIO)....

Of course this means for SCSI-3 (with 16 targets/bus and 8 LUNs/target
-- or are there more?) that we need a minimum of 2944 minor numbers per
SCSI bus.

That's why I think it's a good idea to put every SCSI bus on a separate
major number (regardless of how close we are to hitting the maximum size
of a minor number).  Also by doing so one is certain to wire down the
location of drives by bus.

It may be the case that nobody ever puts more than two or four SCSI
cards in any given system, but *I* don't ever want to make it impossible
for users of those really big servers to put in 10, 20, 30, 100, or more
host adapters in a given system.

I note with glee that this idea of having a fixed "raw" disk partition
that's not really a partition (i.e. it's not in the disklabel) does
indeed eliminate the need for having a "convention" of defining a 0-max
partition, and thus as others have already mentioned it also eliminates
the need for the current confusion of different platforms having
different conventions (i.e. the 'c' vs. 'd' mess).

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>