Linux 内核 3.13:如何列出 gendisk 的?

Linux Kernel 3.13: How to list gendisk's?

我正在阅读 online book about Linux Kernel drivers, which looks very obsolete to me. For example, the Linux Cross Reference 找不到变量 gendisk_head(在内核 3.13 中),它应该指向 gendisk 结构列表,可用 内核中。

如何从内核 3.13 中列出所有当前分配的 gendisk 结构?

看看下面的代码:

void __init printk_all_partitions(void)
{
        struct class_dev_iter iter;
        struct device *dev; 

        class_dev_iter_init(&iter, &block_class, NULL, &disk_type);
        while ((dev = class_dev_iter_next(&iter))) {
                struct gendisk *disk = dev_to_disk(dev);