1. Manuals
  2. Brands
  3. Computer Equipment
  4. Server
  5. IBM
  6. Computer Equipment
  7. Server

IBM 10 SP1 EAL4 5.9.3 Block device driver

1 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 246
Download on canonical page 246 pages, 2.94 Mb
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.
5.9.3 Block device driver
Block drivers provide access to the block-oriented devices that transfer data in randomly accessible, fixed-size
blocks, such as a disk drive. All I/O-to-block devices are normally buffered by the system (the only exception
is with raw devices); user processes do not perform direct I/O to these devices.
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 block-device descriptors. One of the fields of the block device
descriptor is bd_op, which is pointer to the block_device_operations structure. The
block_device_operations structure contains methods to open, release, llseek, read, write,
mmap, fsync, and ioctl that control the block device. Each block device driver needs to implement these
block device operations for the device being driven.
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

Figure 5-77: Setup of f_op for character device specific file operations

MENU

Models

Contents