*/
static int match_dev_by_uuid(struct device *dev, const void *data)
{
+ struct block_device *bdev = dev_to_bdev(dev);
const struct uuidcmp *cmp = data;
- struct hd_struct *part = dev_to_part(dev);
- if (!part->info ||
- strncasecmp(cmp->uuid, part->info->uuid, cmp->len))
+ if (!bdev->bd_meta_info ||
+ strncasecmp(cmp->uuid, bdev->bd_meta_info->uuid, cmp->len))
return 0;
return 1;
}
* Attempt to find the requested partition by adding an offset
* to the partition number found by UUID.
*/
- struct hd_struct *part;
+ struct block_device *part;
- part = disk_get_part(dev_to_disk(dev),
- dev_to_part(dev)->partno + offset);
+ part = bdget_disk(dev_to_disk(dev),
+ dev_to_bdev(dev)->bd_partno + offset);
if (part) {
- devt = part_devt(part);
- put_device(part_to_dev(part));
+ devt = part->bd_dev;
+ bdput(part);
}
} else {
devt = dev->devt;
*/
static int match_dev_by_label(struct device *dev, const void *data)
{
+ struct block_device *bdev = dev_to_bdev(dev);
const char *label = data;
- struct hd_struct *part = dev_to_part(dev);
- if (!part->info || strcmp(label, part->info->volname))
+ if (!bdev->bd_meta_info || strcmp(label, bdev->bd_meta_info->volname))
return 0;
return 1;
}