Figure 65 Device database to keep track of all block and character devices

A global array — bdev_map for block and cdev_map for character devices — is used to implement a hash table, which employs the device major number as hash key. Both cdev_map and bdev_map are instances of the same data structure, struct kobj_map. The hashing method is quite simple: major % 255. This works well since currently only a very limited number of devices has major numbers larger than 255, so hash collisions are rare. The definition of struct kobj_map also includes the definition of the hash list elements struct probe.

Continue reading here: Driversbasemapc

Was this article helpful?

0 0