Major and Minor Numbers - What, Representation, Allocation, Freeing, Sample, Queries
They are two types of files in Linux: 1. Normal or regular files : hello.txt, test.txt 2. Device or Special Files : /dev/zero, /dev/null Special or Device files are located in /dev directory. These are of two types: 1. char device files: Identified by a "c" in the first column of the output of ls -l command 2. Block device files: Identified by a "b" in the first column of the output of ls -l command Character and block devices are represented in Linux Kernel as pair of <major number>:<minor number>. Major and Minor Number: With "ls -l /dev" command, you can find the major and minor number of the particular device. Major Number: Each character and block driver registered with the kernel has a major number. It's used to identify the driver. Kernel uses major number at open call to forward execution to the appropriate driver Minor Number: A single driver can control various hardware, or support multiple instances of the s...