Linux kernel 列出内核模块内的块设备

Linux kernel 列出内核模块内的块设备,linux-kernel,linux-device-driver,block-device,Linux Kernel,Linux Device Driver,Block Device,我正在编写一个内核模块,其中列出了块设备及其相应的开发,我将使用它们进行跟踪 以下是block_设备的结构 struct block_device { dev_t bd_dev; /* not a kdev_t - it's a search key */ int bd_openers; struct inode * bd_inode; /* will die */ struct super_block

我正在编写一个内核模块,其中列出了块设备及其相应的开发,我将使用它们进行跟踪

以下是block_设备的结构

    struct block_device {
    dev_t           bd_dev;  /* not a kdev_t - it's a search key */
    int         bd_openers;
    struct inode *      bd_inode;   /* will die */
    struct super_block *    bd_super;
    struct mutex        bd_mutex;   /* open/close mutex */
    struct list_head    bd_inodes;
    void *          bd_claiming;
    void *          bd_holder;
    int         bd_holders;
    bool            bd_write_holder;
#ifdef CONFIG_SYSFS
    struct list_head    bd_holder_disks;
#endif
    struct block_device *   bd_contains;
    unsigned        bd_block_size;
    struct hd_struct *  bd_part;
    /* number of times partitions within this device have been opened. */
    unsigned        bd_part_count;
    int         bd_invalidated;
    struct gendisk *    bd_disk;
    struct request_queue *  bd_queue;
    struct list_head    bd_list;
............
};
bd_列表是包含系统中所有块设备的链接列表。all_bdev(fs/block_dev.c)是列表的开头,但问题是它没有导出。 有没有一种方法可以迭代内核模块内的块设备