Re: An idea on devfs vs. udev

From: Neil Brown
Date: Sun Oct 30 2005 - 16:18:39 EST


On Sunday October 30, daniele@xxxxxxxxxxx wrote:
>
> So, why cannot we substitute the "dev" file within /sys with the actual device
> file?

I'd just like to say that I am 100% in favour of this idea.

The argument against it seems to be something that I have never
managed to understand about "policy not belonging in the kernel".
Now I agree that the kernel should avoid implementing policy, but I
fail to see how that relates to the current issue.

In fact, the way I see it, the current practice clearly violates the
"avoid policy" policy.

The kernel needs to export major/minor information through the
file system. The "obvious" mechanism for doing this is through a
device special file.
But instead, a text file with %d:%d is used. Why? I presume to stop
people from just opening /sys/.../dev. Stopping people from doing
such a thing is clearly implementing a "Thou shall not" policy.

But then to make matters worse, there is this "sample.sh" file. UGH!
It's a bit of shell code exported by the kernel.
#!/bin/sh
mknod /dev/hda b 3 0

This contortion would be totally unnecessary if 'dev' were an honest
device special file. Then instead of
sh $sysfspath/sample.sh
you could
cp -R $sysfspath/dev /dev/`basename $sysfspath`

Notes:
- obviously a different name would have to be chosen for back
compatibility (rdev?).
- I would *not* be in favour of then allowing chown/chmod. These
special files should stay root/root/0600.

NeilBrown



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