Subject: Partitioning idea
To: None <>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 10/13/1998 16:38:49
An idea to reduce duplication of driver code, and incidentally clean up
the partitioning concepts somewhat.  I don't wish to claim that I
actually want to see NetBSD cut over to this; it's just an idea.  I'd
love to see a sample implementation, and quite possibly would play with
it a bit to see what I think of it.

The idea corresponds to the following autoconfig output sketch:

mainbus0 (root)
obio0 at mainbus0
si0 at obio0 ....
scsibus0 at si0
sd0 at scsibus0 targ 0 lun 0: ....
disk0 at sd0
disk0: 163MB, 1923 cyl, 4 head, 43 sec, 512 bytes/sec x 334601 sectors
pci0 at mainbus0
wdc0 at pci0 ....
wd0 at wdc0 slave 0
disk1 at wd0
disk1: 2004MB, ....

Then the sd and wd drivers just do disk access.  The "disk" driver is
responsible for everything else, including disklabel processing, and
could even, in principle, be MI (which would give some degree of
"reading other ports' disklabels" functionality for free).

This offers the opportunity to "fix" the RAW_PART "problem", too: the
sd driver could not only support attachment by the disk driver, but
could also be a driver in its own right: /dev/sd0 would then be raw
access to sd0, with /dev/{r,}disk0[abcde...] being its partitions.  But
that's not necessary; even if /dev/diskNc (diskNd on i386) is still
RAW_PART, this might be good.

In some ways I prefer the labelfs approach to partitioning, because it
allows recursively nested labels:

mount -t label /dev/sd0 /dev/disk0
mount -t label /dev/disk0/g /dev/disk1

This too is largely orthogonal to whether there's a diskN layer in the
autoconfig tree under the sd, wd, xd, rd, etc drivers.  The diskN
abstraction seems to me like a logical analog of the scsibusN
abstraction; the major downside I see to it is its violation of the
Principle of Least Surprise for sysadmins experienced in other BSD

Of course, this is also orthogonal to the "nailing down" discussion;
you may well want to "nail down" /usr to not disk1g but "the partition
at mainbus0/:pci0/dev=10,function=1:wdc0/slave=0:wd0/:disk0/g" (or
moral equivalent thereof).  Doing that is orthogonal to having that
extra "disk" layer there.

					der Mouse

		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B