summaryrefslogtreecommitdiffstats
path: root/hw/i386/pc_sysfw.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/i386/pc_sysfw.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/i386/pc_sysfw.c')
-rw-r--r--hw/i386/pc_sysfw.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 9bf22b6..75913c5 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -24,7 +24,6 @@
*/
#include "sysemu/block-backend.h"
-#include "sysemu/blockdev.h"
#include "qemu/error-report.h"
#include "hw/sysbus.h"
#include "hw/hw.h"
@@ -104,7 +103,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
{
int unit;
DriveInfo *pflash_drv;
- BlockDriverState *bdrv;
+ BlockBackend *blk;
int64_t size;
char *fatal_errmsg = NULL;
hwaddr phys_addr = 0x100000000ULL;
@@ -120,8 +119,8 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
(unit < FLASH_MAP_UNIT_MAX &&
(pflash_drv = drive_get(IF_PFLASH, 0, unit)) != NULL);
++unit) {
- bdrv = blk_bs(blk_by_legacy_dinfo(pflash_drv));
- size = bdrv_getlength(bdrv);
+ blk = blk_by_legacy_dinfo(pflash_drv);
+ size = blk_getlength(blk);
if (size < 0) {
fatal_errmsg = g_strdup_printf("failed to get backing file size");
} else if (size == 0) {
@@ -157,7 +156,7 @@ static void pc_system_flash_init(MemoryRegion *rom_memory)
/* pflash_cfi01_register() creates a deep copy of the name */
snprintf(name, sizeof name, "system.flash%d", unit);
system_flash = pflash_cfi01_register(phys_addr, NULL /* qdev */, name,
- size, bdrv, sector_size,
+ size, blk, sector_size,
size >> sector_bits,
1 /* width */,
0x0000 /* id0 */,
OpenPOWER on IntegriCloud