struct list_head *p; loff_t l = *pos; ... list_for_each(p, &block_subsys.kset.list) if (!l--) return list_entry(p, struct gendisk, kobj.entry); ...