qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org, Cole Robinson <crobinso@redhat.com>
Subject: [Qemu-devel] [PATCH 0/2] Guess host device type from guest device type for block devices
Date: Wed, 17 Jun 2009 17:28:26 -0300	[thread overview]
Message-ID: <1245270508-23315-1-git-send-email-ehabkost@redhat.com> (raw)

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(-)

-- 
Eduardo

             reply	other threads:[~2009-06-17 20:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 20:28 Eduardo Habkost [this message]
2009-06-17 20:28 ` [Qemu-devel] [PATCH 1/2] Add a BlockDriverState parameter to bdrv_probe_device() Eduardo Habkost
2009-06-17 20:28 ` [Qemu-devel] [PATCH 2/2] Guess host device type from requested guest device type Eduardo Habkost
2009-06-17 22:17 ` [Qemu-devel] Re: [PATCH 0/2] Guess host device type from guest device type for block devices Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245270508-23315-1-git-send-email-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=crobinso@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).