A device node is a special file system object through which a program accesses a device interface. In the Linux model, its inode records a device-special file type and a device number; the path supplies a name in the file-system namespace. Opening it supplies a file descriptor through which the applicable device driver handles operations. Device-special objects differ from ordinary files containing a stored byte sequence.[ref]
Device file metadata in the Linux man-pages project. inode(7), device ID and file types; mknod(2), DESCRIPTION
Two device identifiers must be distinguished. The metadata field
st_dev identifies the device containing the file system that holds the inode. For a character device or block device, st_rdev instead identifies the represented device. Its major and minor numbers belong to that represented-device identification. The inode's own number is a third identifier.[ref]Device file metadata in the Linux man-pages project. inode(7), Device where inode resides and Device ID; mknod(2), dev argument
For an original metadata example, stipulate that names
/dev/example-a and /dev/example-b reach different inodes numbered 42 and 43 in one file system. Both inodes have character-device type and represented-device numbers (240,7). They name the same device interface in this example despite being different named file-system objects. Different permissions on the nodes can still affect access. Their inode numbers alone do not identify two physical devices.A character device presents a driver-defined stream or control interface; it need not contain human-readable characters. A block device presents block-oriented storage access. The special-file type is part of the identification, so equal numerical major/minor pairs do not alone equate character and block interfaces. A video device node is a concrete Video4Linux example, whose supported functions must still be queried.
Creating a device-special file supplies a namespace entry and device identification; it does not manufacture hardware, load a guaranteed working driver or establish a supported data format. Conversely, a symbolic link pointing to a device node is an ordinary naming indirection: its target's special-file metadata determines the accessed interface.
Articles by others on the same topic
There are currently no matching articles.