This extra level of indirection is needed for character devices, but not for block devices, because of the large variety of character devices and the operations they support. The following diagram illustrates how the kernel maps the file operations vector of the device file object to the correct set of operations routines for that device.
Figure 5-77: Setup of f_op for character device specific file operations
5.9.3Block device driver
Block drivers provide access to the
Programs operate on block devices by opening their file system entries. The file system entry contains a major and a minor number by which the kernel identifies the device. The kernel maintains a hash table, indexed by major and minor number, of
The Virtual File System sets up the file object for the device and points the file operations vector to the appropriate block device operations as follows.
155