Guess host device type from guest device type for block devices
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | Add a BlockDriverState parameter to bdrv_probe_device()block.c block/ block/ +1 more | +9 | 0 replies | |
| 2/2 | Guess host device type from requested guest device typeblock/ | +25 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [Qemu-devel] [PATCH 0/2] Guess host device type from guest device type for block devices
This fixes the following issue:
https://bugzilla.redhat.com/show_bug.cgi?id=473154
Sometimes a CD-ROM drive path doesn't start with /dev/cdrom, causing problems if a disk isn't inserted on the drive. With this patch, the floppy and cdrom drivers are used if using a host block device as backend and the virtual device type is floppy or CD-ROM.
Example:
$ ls -l /dev/cdrom /dev/hda lrwxrwxrwx 1 root root 3 Jun 17 10:20 /dev/cdrom -> hda brw-rw---- 1 root disk 3, 0 Jun 17 10:20 /dev/hda
Before this series (CD-ROM drive with no disk):
$ sudo qemu-system-x86_64 -cdrom /dev/cdrom [works] $ sudo qemu-system-x86_64 -cdrom /dev/hda qemu: could not open disk image /dev/hda
After this series (with no disk on the CD-ROM drive, too):
$ sudo qemu-system-x86_64 -cdrom /dev/hda [works]
This is based on a fix from Cole Robinson, submitted here:
http://marc.info/?l=qemu-devel&m=124458617900905
There are other two points where I think the code could be improved:
- Redundant stat() calls: stat() is called at hdev_probe_device(), and called again on cdrom_probe_device() and floppy_probe_device()
- Duplicated cdrom driver code for Linux and FreeBSD: I don't like #ifdefs, but I don't like the amount of duplicated code, either.
Eduardo Habkost (2):
Add a BlockDriverState parameter to bdrv_probe_device() Guess host device type from requested guest device type
block.c | 6 +++--- block/raw-posix.c | 38 +++++++++++++++++++++++++++++--------- block/raw-win32.c | 2 +- block_int.h | 2 +- 4 files changed, 34 insertions(+), 14 deletions(-)
Signature · 1 line
Eduardo