From: Markus Armbruster <armbru@redhat.com>
To: Programmingkid <programmingkidx@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
John Snow <jsnow@redhat.com>,
qemu-devel qemu-devel <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] block.c: fix real cdrom detection
Date: Thu, 25 Jun 2015 08:53:00 +0200 [thread overview]
Message-ID: <87pp4kxos3.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <455CF92B-58FA-446D-9EB0-42661C23B739@gmail.com> (Programmingkid's message of "Tue, 23 Jun 2015 14:26:51 -0400")
Programmingkid <programmingkidx@gmail.com> writes:
> On Jun 23, 2015, at 2:06 PM, John Snow wrote:
>
>>
>>
>> On 06/23/2015 01:56 PM, Programmingkid wrote:
>>> Fix real cdrom detection so that a real cdrom can actually be used.
>>>
>>> signed-off-by: John Arbuckle <programmingkidx@gmail.com
>>> <mailto:programmingkidx@gmail.com>>
>>>
>>> This patch has been tested on Mac OS X host and guest.
>>> Command used: qemu-system-ppc -cdrom /dev/cdrom
>>>
>>> Note: I was able to view the files using OpenBIOS, but not on
>>> Mac OS X. The size of the disc is reported correctly but some
>>> error happens that prevents it from mounting in Mac OS X. This
>>> is probably another bug with QEMU.
>>>
>>> ---
>>> block.c | 3 ++-
>>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/block.c b/block.c
>>> index dd4f58d..75ccfad 100644
>>> --- a/block.c
>>> +++ b/block.c
>>> @@ -583,7 +583,8 @@ static int find_image_format(BlockDriverState *bs,
>>> const char *filename,
>>> int ret = 0;
>>>
>>>
>>>
>>> /* Return the raw BlockDriver * to scsi-generic devices or empty
>>> drives */
>>> - if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) {
>>> + if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0
>>> + || strcmp("/dev/cdrom", filename) == 0) {
>>> *pdrv = &bdrv_raw;
>>> return ret;
>>> }
>>> --
>>> 1.7.5.4
>>>
>>
>> So what's the issue that this patch attempts to fix and how did you
>> determine that the fix was needed here? It doesn't look like it respects
>> proper abstraction at a glance.
>
> Without the patch, QEMU would just quit when the "-cdrom /dev/cdrom"
> option is given.
>
> Before the patch, the bdrv_open_inherit() function would be
> incorrectly called. Its documentation says "Opens a disk image (raw,
> qcow2, vmdk, ...)" meaning only for disk image files (not for real
> media). This patch prevents the bdrv_open_inherit() function from ever
> being called. It sets the pdrv variable to the raw format. This made
> sense to me since a real cdrom is read in the raw format.
>
> A quick test does show the patch works. A real cdrom is successfully
> opened on qemu-system-i386 using a Windows XP guest.
What about /dev/sr0, /dev/sr1, and whatever other names could refer to a
block device without a medium?
Comparing filenames isn't a good way to test "is a block device without
a medium".
next prev parent reply other threads:[~2015-06-25 6:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 17:56 [Qemu-devel] [PATCH] block.c: fix real cdrom detection Programmingkid
2015-06-23 18:06 ` John Snow
2015-06-23 18:26 ` Programmingkid
2015-06-25 6:53 ` Markus Armbruster [this message]
2015-06-25 15:14 ` Programmingkid
2015-06-25 15:32 ` Programmingkid
2015-06-25 15:47 ` Programmingkid
2015-06-25 15:48 ` Paolo Bonzini
2015-06-25 16:12 ` Laurent Vivier
2015-06-25 16:16 ` Paolo Bonzini
2015-06-25 17:19 ` Laurent Vivier
2015-06-26 9:14 ` Laurent Vivier
2015-06-26 9:20 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-06-25 18:07 ` [Qemu-devel] " Programmingkid
2015-06-25 20:51 ` Paolo Bonzini
2015-06-25 17:56 ` Programmingkid
2015-06-25 18:01 ` Paolo Bonzini
2015-06-25 18:01 ` Peter Maydell
2015-06-28 23:43 ` Programmingkid
2015-06-29 0:29 ` Laurent Vivier
2015-06-29 0:56 ` Programmingkid
2015-06-29 3:01 ` Programmingkid
2015-06-29 10:36 ` Laurent Vivier
2015-06-25 17:57 ` Programmingkid
2015-06-25 13:31 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2015-06-25 15:11 ` Programmingkid
2015-06-26 9:34 ` Stefan Hajnoczi
2015-06-26 15:50 ` Programmingkid
2015-06-26 20:01 ` Stefan Hajnoczi
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=87pp4kxos3.fsf@blackfin.pond.sub.org \
--to=armbru@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=programmingkidx@gmail.com \
--cc=qemu-block@nongnu.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.