Re: udev and devfs - The final word

Kai Henningsen
2004-01-01T21:02:27Z

rob@landley.net (Rob Landley) wrote on 01.01.04 in <200401010634.28559.rob@landley.net>:

> On Wednesday 31 December 2003 18:31, Rob Love wrote:
> > On Wed, 2003-12-31 at 19:15, Andries Brouwer wrote:
> > > My plan has been to essentially use a hashed disk serial number
> > > for this "any old unique value". The problem is that "any old"
> > > is easy enough, but "unique" is more difficult.
> > > Naming devices is very difficult, but in some important cases,
> > > like SCSI or IDE disks, that would work and give a stable name.
> >
> > Yup.
> >
> > > The kernel must not invent consecutive numbers - that does not
> > > lead to stable names. Setting this up correctly is nontrivial.
> >
> > This is definitely an interesting problem space.
> >
> > I agree wrt just inventing consecutive numbers. If there was a nice way
> > to trivially generate a random and unique number from some
> > device-inherent information, that would be nice.
> >
> > Rob Love
>
> Fundamental problem: "Unique" depends on the other devices in the system.
> You can't guarantee unique by looking at one device, more or less by
> definition.

This is actually not fundamental at all.

The best-known exception is probably the MAC address. But it is not the
only example of devices having true unique information.

It is certainly true, though, that there are devices without this kind of
info.

And remember that you can sometimes use secondary information. With any
kind of read-write storage device, it might be possible to create such a
piece of information and store it onto that device.

Moral: keep the identifier creation framework flexible enough so that you
can chose device-specific means to produce useful identifiers. (And, use
long identifiers, as they're less likely to be duplicated in general.)

MfG Kai