Subject: Re: devfs, was single user mode file comparisons
To: Greywolf <greywolf@starwolf.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: current-users
Date: 06/09/2003 16:13:40
On Mon, 9 Jun 2003, Greywolf wrote:

> Thus spake Bill Studenmund ("BS> ") sometime Today...
>
> BS> > I'd have to see some more examples of this...
> BS>
> BS> That comes across as a bit imperious. :-) How about asking concrete
> BS> questions?
>
> Sorry about that, I've other things on the brain at the moment (such
> as continued employment).

That can certainly take brain-power.

> to put it more succinctly, I think that's best read as "I'd have to
> see some more examples of this before I can understand it fully."

Ahhh.... Sorry then for my grumble.

> In short, I don't quite follow it all just yet, but I'm sure it will
> make itself more obvious...
>
> Are you talking about being able to name a device, say, "rootdisk", and
> it won't matter what you put in where because any references to "rootdisk"
> will somehow manage to locate the disk you've designated as the root disk
> by, e.g., geometry, label, checksum or some other magic?

Not quite that immediately. But that would be doable.

For now, locators are whatever you'd use to wire down the disk in a config
file. "sd1	at scsibus2 target 4 lun0" ties "sd1" to the locator
"scsibus2 target 4 lun0".

The idea is that when devices show up in the system, they show up in the
devfs with a default name, and implicit locator. So the first time you
boot with devfs, or when you add new hardware, it's just there. Let's
ignore partitions for a moment. Say you boot a disk with an sd0.
/dev/sd0[cd] would show up with a locator of where ever that scsi disk
showed up. i.e. "scsibusX target Y lun Z". I have in mind that you could
rename /dev/sd0[cd] to something else, and the name would stay the same
yet the locator would be unchanged. So next time you boot, a node shows up
in devfs that accesses "scsibusX target Y lun Z".

As for partitions, if we haven't done wedges, sd0a, sd0b, and so on would
(I expect) show up as "scsibusX target Y lun Z partitionP" where P is the
partition number in whatever the kernel reads as a disklabel. If we have
wedges, only the raw disk would show up (sd0, sd1, etc.) and all the other
partitions would be done by the wedge meister (whatever is doing wedges).
The wedge meister would be doing the same thing, except it would be fining
partitions with more descriptive locators, like "mbr1" for partition 1 in
the main mbr, or "nbsd4" for partition 'e' in a NetBSD disklabel, or maybe
"mbr2 nbsd4" for partition 'e' in a NetBSD partition in mbr slot 2.

You asked about finding disks based on label, geometry, checksum or other
magic. That opens up a can of worms, that we will probably need to look at
anyway. Mainly, how do we extend kernel locators to be more than just
scsibus/target/lun (or pciide/channel/drive or wdc/channel/drive)? If we
figured out how to do that, then all devfs would need is a way to re-map
the locator for a device. For things like FC or iSCSI disks, it'd be a
good and simple thing. For other disks, we could use some sort of name in
disklabel technique.

Take care,

Bill