Subject: Re: Another changer, another changer problem
To: Robert Elz <kre@munnari.OZ.AU>
From: Todd Whitesel <toddpw@best.com>
List: current-users
Date: 10/04/1998 20:47:29
>     Once again, look at the code. We do provide that minor number; it's
>     the one attached to /dev/xdNc. That partition need not start at
>     zero, and it doesn't matter what's in the disklabel in memory or
>     on the disk. The start/end data for that partition are ignored.
> 
> That's fine - but it is a waste of a partition label on the disk
> that could be used for something more productive.

Unfortunately yes it is, but to reuse that entry means a definite change in
the interpretation of disklabels, and that creates a format transition which
should not be taken lightly.

Perhaps we could do it as part of a transition to 22-partition disklabels
across the board, with both 'c' and 'd' reserved for driver internal purposes.
(I have my own agenda here; someday I want to read my i386 volumes and their
DOS data on my arm32, so I will keep stumping for an acceptable MI
implementation of the i386's 'd' partition concept.)

> Aside from compatability with existing /dev/ entries, and labels, which is
> no small issue, it seems to be that having the kernel do
> 
> 	part = DISKPART(dev);
> 	if (part == 0) {
> 		/* set up to access the entire drive, ignore label */
> 	} else {
> 		/* access via disklabel[part - 1] */
> 	}
> 
> would be much cleaner than the current magic with the 'c' paritition.

I think cjs was trying to say that it already does:

 	part = DISKPART(dev);
 	if (part == ('c' - 'a')) {
 		/* set up to access the entire drive, ignore label */
 	} else {
 		/* access via disklabel[part] */
 	}

I personally would not mind something like:

 	part = DISKPART(dev);
	switch (part) {
		case 'a' - 'a':
			/* access via disklabel[0] */
			break;
		case 'b' - 'a':
			/* access via disklabel[1] */
			break;
		case 'c' - 'a':
			/* set up to access netbsd area, whatever that means */
			break;
		case 'd' - 'a':
			/* set up to access whole disk, no matter what */
			break;
		default:
			/* access via disklabel[part-2] */
			break;
	}

One could easily argue that this is pretty inelegant, but it's worth it to me
because it buys me a lot!!

All 8 partitions on every disk, safe device nodes for dealing with DOS/netbsd
hybrid disks no matter what architecture I'm using, and it isn't that hard to
document it.

Though it would definitely be incompatible with other BSD's that didn't use
the technique. I do not mind having signatures for "old" and "new" disklabel
formats if that is sufficient to address the problem.

Todd Whitesel
toddpw @ best.com