1

ブロックデバイスと、トレースに使用する対応する dev_t をリストするカーネルモジュールを作成しています。

以下は構造block_deviceです

    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_list は、システム内のすべてのブロック デバイスを含むリンク リストです。all_bdevs ( fs/block_dev.c ) はリストの先頭ですが、エクスポートされていないことが問題です。カーネルモジュール内でブロックデバイスを反復する方法はありますか?

4

0 に答える 0