Registering block devices requires only a single call to add_disk. To describe the device properties, an instance of struct genhd is required as a parameter; this structure is discussed in Section 6.5.1.
Earlier kernel versions required block devices to be registered using register_blkdev, which has the following prototype:
int register_blkdev(unsigned int major, const char *name);
name is usually identical to the device filename, but can be any arbitrary valid string. Although it is not necessary to call the function anymore today, it is still possible. The benefit is that the block device will show up in /proc/devices.
Continue reading here: Device File Elements in I nodes
Was this article helpful?