Skip to content

Commit 9ca7790

Browse files
authored
Merge pull request #297 from EricccTaiwan/sda
Update device file example from hda to sda
2 parents 5f6e83b + b1a4448 commit 9ca7790

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

Diff for: lkmpg.tex

+6-7
Original file line numberDiff line numberDiff line change
@@ -836,22 +836,21 @@ \subsection{Device Drivers}
836836
A userspace program like mp3blaster can use \verb|/dev/sound| without ever knowing what kind of sound card is installed.
837837

838838
Let's look at some device files.
839-
% FIXME: use popular devices
840-
Here are device files which represent the first three partitions on the primary master IDE hard drive:
839+
Here are device files which represent the first three partitions on the primary SCSI storage devices:
841840

842841
\begin{verbatim}
843-
$ ls -l /dev/hda[1-3]
844-
brw-rw---- 1 root disk 3, 1 Jul 5 2000 /dev/hda1
845-
brw-rw---- 1 root disk 3, 2 Jul 5 2000 /dev/hda2
846-
brw-rw---- 1 root disk 3, 3 Jul 5 2000 /dev/hda3
842+
$ ls -l /dev/sda[1-3]
843+
brw-rw---- 1 root disk 8, 1 Apr 9 2025 /dev/sda1
844+
brw-rw---- 1 root disk 8, 2 Apr 9 2025 /dev/sda2
845+
brw-rw---- 1 root disk 8, 3 Apr 9 2025 /dev/sda3
847846
\end{verbatim}
848847

849848
Notice the column of numbers separated by a comma.
850849
The first number is called the device's major number.
851850
The second number is the minor number.
852851
The major number tells you which driver is used to access the hardware.
853852
Each driver is assigned a unique major number; all device files with the same major number are controlled by the same driver.
854-
All the above major numbers are 3, because they're all controlled by the same driver.
853+
All the above major numbers are 8, because they're all controlled by the same driver.
855854

856855
The minor number is used by the driver to distinguish between the various hardware it controls.
857856
Returning to the example above, although all three devices are handled by the same driver they have unique minor numbers because the driver sees them as being different pieces of hardware.

0 commit comments

Comments
 (0)