block: implement and use {disk|part}_to_dev()

Implement {disk|part}_to_dev() and use them to access generic device
instead of directly dereferencing {disk|part}->dev.  To make sure no
user is left behind, rename generic devices fields to __dev.

This is in preparation of unifying partition 0 handling with other
partitions.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
This commit is contained in:
Tejun Heo 2008-08-25 19:56:05 +09:00 committed by Jens Axboe
parent 870d665612
commit ed9e198234
11 changed files with 86 additions and 77 deletions

View file

@ -543,9 +543,9 @@ EXPORT_SYMBOL(bd_release);
static struct kobject *bdev_get_kobj(struct block_device *bdev)
{
if (bdev->bd_contains != bdev)
return kobject_get(&bdev->bd_part->dev.kobj);
return kobject_get(&part_to_dev(bdev->bd_part)->kobj);
else
return kobject_get(&bdev->bd_disk->dev.kobj);
return kobject_get(&disk_to_dev(bdev->bd_disk)->kobj);
}
static struct kobject *bdev_get_holder(struct block_device *bdev)