Unix-like systems are famous for their feature that maps I/O devices to the filesystem. In addition to the predefined I/O devices, it is possible to define your own devices as kernel modules. A kernel device can be attached to real hardware or it can be virtual. In this project, we will build a virtual device.
In Unix-like systems, there are two kinds of I/O devices: block devices and character devices. The former handle packets of bytes in a single operation (that is, they are buffered), while the latter can handle only one byte at a time, with no buffering.
In general, a device can be read, written, or both. Our device will be a read-only device. So, we are going to build a filesystem-mapped, virtual, read-only character device.
Building the character device
Here, we are going to build a character device driver (or character device for short). A character device is a device driver that can handle only one byte at a time with no buffering. The behavior of our device...