udev in initrd

David Zeuthen david at fubar.dk
Wed Jul 7 00:13:33 UTC 2004


On Tue, 2004-07-06 at 18:38 -0400, Jeremy Katz wrote:
> On Tue, 2004-07-06 at 18:17 +0200, Owen Taylor wrote:
> > On Tue, 2004-07-06 at 22:28, Jeremy Katz wrote:
> > The value of it on the case of the writable root filesystem is that
> > you only have one path for how the system works, not two. Changes
> > to device naming only have to be put into one place. Eventually we
> > can simple drop the dev package and it's 18,000 files.
> 
> But exactly what does the 18k files cost it?  Similarly, we could drop
> ldconfig runs in %post and just have all of the symlinks created on each
> boot, but that doesn't strike me as a good idea either.  It's a useful
> optimization to have them laid down by the install because then you
> never have to create new device nodes.  Which can be a lot of device
> nodes per device.  Changes to device naming is simple -- just make what
> gets used for the creation the same as what gets used in the dev
> package's spec file.  Nice and simple to do with current infrastructure.
> 

One very useful feature that is not readily available in current
infrastructure is that udev maintains a database. This allows reverse
lookup into sysfs, e.g. given device node /dev/sda you can very easily
determine what physical device this device node corresponds to. And you
can also go the other way [1].

With the infrastructure available today (e.g. static dev), you'd have to
search either for the right major:minor in /dev or find the right 'dev'
file in sysfs which would be insanely expensive.

> > > My bigger concern is that udev has _zero_ policy.  It basically is a
> > > "well, we want to let people do what they want" system.  Which is no
> > > better than doing nothing at all.  

Which may actually be good in a way as it discourages developers to
assume that e.g. /dev/cdrom is the (default) optical drive, /dev/dsp is
the (default) audio device etc. Heh, so to fully test it we'd just
select a new naming scheme on every reboot :-)

But, yeah, you're right, there's so many legacy applications out there
that relies on device node naming policies, and I do understand that
this is not necessarily bad. Though it would be nice they did the right
thing, at least for desktop applications.

Cheers,
David

[1] :

[david at ixus david]$ udevinfo -q path -n /dev/sda
/block/sda
[david at ixus david]$ ls -l /sys/block/sda/device
lrwxrwxrwx  1 root root 0 Jul  6 19:17 /sys/block/sda/device -> ../../
devices/pci0000:00/0000:00:10.0/0000:02:07.2/usb1/1-1/1-1.2/1-1.2:1.0/
host9/9:0:0:0

[david at ixus david]$ udevinfo -r -q name -p /sys/block/sda
/dev/sda





More information about the devel mailing list