summaryrefslogtreecommitdiffstats
path: root/hw/ide/qdev.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-10-07 13:59:18 +0200
committerKevin Wolf <kwolf@redhat.com>2014-10-20 14:02:25 +0200
commit4be746345f13e99e468c60acbd3a355e8183e3ce (patch)
tree16509218f940129beb113cf3b1be158c3501ec1d /hw/ide/qdev.c
parent2a30307f709e6a395d23cf94837e9aae15f8e8fa (diff)
downloadhqemu-4be746345f13e99e468c60acbd3a355e8183e3ce.zip
hqemu-4be746345f13e99e468c60acbd3a355e8183e3ce.tar.gz
hw: Convert from BlockDriverState to BlockBackend, mostly
Device models should access their block backends only through the block-backend.h API. Convert them, and drop direct includes of inappropriate headers. Just four uses of BlockDriverState are left: * The Xen paravirtual block device backend (xen_disk.c) opens images itself when set up via xenbus, bypassing blockdev.c. I figure it should go through qmp_blockdev_add() instead. * Device model "usb-storage" prompts for keys. No other device model does, and this one probably shouldn't do it, either. * ide_issue_trim_cb() uses bdrv_aio_discard() instead of blk_aio_discard() because it fishes its backend out of a BlockAIOCB, which has only the BlockDriverState. * PC87312State has an unused BlockDriverState[] member. The next two commits take care of the latter two. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide/qdev.c')
-rw-r--r--hw/ide/qdev.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 816167b..600e67c 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -73,7 +73,7 @@ static int ide_qdev_init(DeviceState *qdev)
IDEDeviceClass *dc = IDE_DEVICE_GET_CLASS(dev);
IDEBus *bus = DO_UPCAST(IDEBus, qbus, qdev->parent_bus);
- if (!dev->conf.bs) {
+ if (!dev->conf.blk) {
error_report("No drive specified");
goto err;
}
@@ -118,8 +118,7 @@ IDEDevice *ide_create_drive(IDEBus *bus, int unit, DriveInfo *drive)
dev = qdev_create(&bus->qbus, drive->media_cd ? "ide-cd" : "ide-hd");
qdev_prop_set_uint32(dev, "unit", unit);
- qdev_prop_set_drive_nofail(dev, "drive",
- blk_bs(blk_by_legacy_dinfo(drive)));
+ qdev_prop_set_drive_nofail(dev, "drive", blk_by_legacy_dinfo(drive));
qdev_init_nofail(dev);
return DO_UPCAST(IDEDevice, qdev, dev);
}
@@ -129,7 +128,7 @@ int ide_get_geometry(BusState *bus, int unit,
{
IDEState *s = &DO_UPCAST(IDEBus, qbus, bus)->ifs[unit];
- if (s->drive_kind != IDE_HD || !s->bs) {
+ if (s->drive_kind != IDE_HD || !s->blk) {
return -1;
}
@@ -174,7 +173,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
}
}
- if (ide_init_drive(s, dev->conf.bs, kind,
+ if (ide_init_drive(s, dev->conf.blk, kind,
dev->version, dev->serial, dev->model, dev->wwn,
dev->conf.cyls, dev->conf.heads, dev->conf.secs,
dev->chs_trans) < 0) {
@@ -251,7 +250,7 @@ static int ide_cd_initfn(IDEDevice *dev)
static int ide_drive_initfn(IDEDevice *dev)
{
- DriveInfo *dinfo = drive_get_by_blockdev(dev->conf.bs);
+ DriveInfo *dinfo = blk_legacy_dinfo(dev->conf.blk);
return ide_dev_initfn(dev, dinfo->media_cd ? IDE_CD : IDE_HD);
}
OpenPOWER on IntegriCloud