[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 11/21] ide: bdrv_attach_dev() for empty CD-ROM
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 11/21] ide: bdrv_attach_dev() for empty CD-ROM |
Date: |
Tue, 18 Jul 2017 16:17:56 +0200 |
If no drive=... option is passed (for an empty drive), we don't only
lack the BlockBackend normally created by parse_drive(), but we also
need to manually call blk_attach_dev().
IDE does not support hot unplug, but if it did, qdev would take care to
call the matching blk_detach_dev() on unplug.
This fixes at least the bug that such devices didn't show up in
query-block, and probably some more problems.
Signed-off-by: Kevin Wolf <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Reviewed-by: John Snow <address@hidden>
---
hw/ide/qdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c
index 299e592..cc2f5bd 100644
--- a/hw/ide/qdev.c
+++ b/hw/ide/qdev.c
@@ -164,6 +164,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus);
IDEState *s = bus->ifs + dev->unit;
Error *err = NULL;
+ int ret;
if (!dev->conf.blk) {
if (kind != IDE_CD) {
@@ -172,6 +173,8 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind)
} else {
/* Anonymous BlockBackend for an empty drive */
dev->conf.blk = blk_new(0, BLK_PERM_ALL);
+ ret = blk_attach_dev(dev->conf.blk, &dev->qdev);
+ assert(ret == 0);
}
}
--
1.8.3.1
- [Qemu-block] [PULL 01/21] commit: Add NULL check for overlay_bs, (continued)
- [Qemu-block] [PULL 01/21] commit: Add NULL check for overlay_bs, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 02/21] block: add clock_type field to ThrottleGroup, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 04/21] block/vmdk: Report failures in vmdk_read_cid(), Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 03/21] block: remove timer canceling in throttle_config(), Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 05/21] block/vpc.c: Handle write failures in get_image_offset(), Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 06/21] block: Make blk_get_attached_dev_id() public, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 08/21] block: Make blk_all_next() public, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 09/21] block/qapi: Use blk_all_next() for query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 07/21] block/qapi: Add qdev device name to query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 10/21] block: List anonymous device BBs in query-block, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 11/21] ide: bdrv_attach_dev() for empty CD-ROM,
Kevin Wolf <=
- [Qemu-block] [PULL 12/21] scsi-disk: bdrv_attach_dev() for empty CD-ROM, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 14/21] qemu-iotests: Test unplug of -device without drive, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 16/21] vvfat: add a constant for bootsector name, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 13/21] qemu-iotests: Test 'info block', Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 17/21] vvfat: correctly parse non-ASCII short and long file names, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 15/21] vvfat: add constants for special values of name[0], Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 19/21] block/vvfat: Fix compiler warning with gcc 7, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 20/21] blockdev: move BDRV_O_NO_BACKING option forward, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 18/21] vvfat: initialize memory after allocating it, Kevin Wolf, 2017/07/18
- [Qemu-block] [PULL 21/21] qemu-img: Check for backing image if specified during create, Kevin Wolf, 2017/07/18