Device naming... was Re: [PATCH] 2.5.14 IDE 56

Neil Brown (neilb@cse.unsw.edu.au)
Fri, 10 May 2002 16:31:59 +1000 (EST)


On Tuesday May 7, torvalds@transmeta.com wrote:
>
> If you have /dev/hda1, that _cannot_ be a symlink to the physical tree,
> because on a physical level that partition DOES NOT EXIST. It's purely a
> virtual mapping.
>
> Yet clearly there _is_ a mapping from /dev/hda1 onto the physical device
> in question, and clearly it _is_ a meaninful operation to operate on the
> physical device underlying /dev/hda1.
>
> So if you want to have a sane interface, you need to have a way to look up
> the physical device that underlies /dev/hda1.
>
> Yet it clearly cannot be a symlink.

I have this dream about how we *should* name things in the
kernel..... but I won't bore you with that just now.

The relevant bit relates to how to map from an open-file-descriptor on
a device (or on a file on a filesystem on a device) to information
about that device.
The only piece of information we can currently get is the device
number (either st_rdev or st_dev).

Using the principle that
"All API extenstions should be done via special filesystems"
the answer has to be that there is filesystem-like-thing that maps
device numbers to their "True Identity".
e.g.

/kernel/devno/3/1 -> /kernel/device/pci/0/00:1f.4/ide/0/0/pc_partition/1

Actually, I would prefer something like:

/kernel/devno/3/1 -> /kernel/disk/3/part/1
together with
/kernel/disk/3/bus -> /kernel/ide/0
/kernel/disk/3/disk BLOCK:3:0
/kernel/disk/3/part/1 BLOCK:3:1
/kernel/disk/3/part/2 BLOCK:3:2

/kernel/ide/0/disk -> /kernel/disk/3
/kernel/ide/0/bus -> /kernel/pci/0/00:1f.4

/kernel/pci/0/00:1f.4/ide -> /kernel/ide/0

and they would be "devlinks", not "symlinks"... but I think I might be
beginning to bore you.

NeilBrown

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/