[TUHS] Device special files

Dan Cross crossd at gmail.com
Wed Feb 7 12:06:27 AEST 2018

On Tue, Feb 6, 2018 at 8:48 PM, Dave Horsfall <dave at horsfall.org> wrote:

> On Wed, 7 Feb 2018, Greg 'groggy' Lehey wrote:
>> V3 and earlier still *called* them special files, but it seems they were
>>> essentially just magic inode numbers (there was no physical file on disk,
>>> just any directory entry with the given inode would be the special file).
>> Isn't that still the case?
> Wasn't that "devfs" (which Penguin/OS calls "udev")?  I've never grokked
> that concept.

No. devfs was (is?) a pseudo-filesystem where only special files
corresponding to the devices enumerated by the kernel during
autoconfiguration are present. The contents are synthesized at boot time
and the filesystem is mounted at some canonical location (like /dev), but
is otherwise ephemeral. This is in contrast to the older /dev, which is
usually just a directory on the root filesystem, wherein one created a
number of device files that may (or may not) correspond to an actual
hardware device in the system (remember the old dance of, "cd /dev &&
./MAKEDEV foo" when you added a "foo" onto your system?). The inodes and
directory entries for those files actually exist in the disk-resident
filesystem structures (though of course data blocks aren't allocated to
those files and the inode doesn't refer to any data blocks).

My understanding is that udev is an elaboration on devfs on Linux that
includes a rules engine that supports things like assigning set names to
specific devices, setting permissions, group/user ownership and the like.
For example, one can configure a rule so that when USB UART device with
serial number 0xdeadbeef gets attached to the system, it appears as
/dev/console_for_foo, owned by group "fooadmin" and mod 660. Presumably
whoever configured that knows that that serial device is physically
connected to the serial console for "foo".

        - Dan C.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20180206/172e229a/attachment.html>

More information about the TUHS mailing list