tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: (Semi-random) thoughts on device tree structure and devfs

It would help if you started by showing where your disk would be in the device tree. Then I can tell you what (more or less) you need in your config file.

USB, or whatever else, is no magic. You can specify explicitly where your disk is, and have it show up with a specific device number even with other devices attached anywhere.

I seem to remember that way back there was even a tool (in pkgsrc?) which extracted your current device setup, and created a config file from that, so that you would always get the same enumeration, no matter what else showed up on the machine.

The point is, the config file totally, and exactly describes your hardware setup. Your suggestion would simply mean that this information would be duplicated in the file system. The config file have the additional "feature" of actually making the device appear with the same name, even if you move it around, by just changing the config file. Everything else in the system will not have to be told after that. And the names exposed, and referred to, are simple and short, even though you do have the full tree described in the config file.

Someone else mentioned that the problem have grown for the simple reason that hardware configurations change much more often now than in the past. I would agree with that. However, for vital pieces of the hardware, the setup normally don't change that much (such as the disks normally used by the system).

So, the device configuration and enumeration is only random so far as that if you tell the system that it is okay to give a device a random number, it will actually possibly do that.
Otherwise it is totally predictable.

If you, on the other hand, do move your disk around (be that by using USB and different ports and hubs, or different controllers), neither the old config, nor your new solution will help. The disk will change identity (or path) (well, with the old config, it might actually keep it's identity, but that's a chancy proposition at best). This is why a way to refer to disks by some other property would be nice (such as disk labels).

(DEC actually solved this a long time ago, by letting disks have identities, which were not in any way related to anything else than the disk, and that was the unit numbers on MSCP disks, which you preferrably kept unique for the whole system, but as with many other nice things, it fell out of fashion with revolution of PC commodity hardware, which have a foresight shorter than my nose.)


Masao Uebayashi wrote:
Have everyone forgotten how to set up their own kernel? Is everyone now booting GENERIC? (Or just making a copy of GENERIC, with a few patches without understanding what they are editing?)

The whole point being that if you boot a kernel, in which you have configured the whole system to connect anything anywhere, you should not be surprised if the device enumeration might seem random. If you want predictable device enumetaion, you can have that, and have been able to have that for over twenty years...

The line
wd*     at atabus? drive ? flags 0x0000

(to use one example) says that match any wd type disk to any unit number on any atabus, without doing any closer matching. Ie. kindof unpredictable.

The asterisks and question marks means exactly that. If you want predictable matching that stays the same at every boot, no matter what hardware you put on the system, you write explicit lines in the config instead.

Imagine if I want to use a USB disk as / on my DELL OptiPlex 745.  The device
tree of that machine looks like:


How do you write a kernel config which can always identify my USB disk as
sd0a, even if I plug random devices?


Home | Main Index | Thread Index | Old Index