From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
Juan Quintela <quintela@redhat.com>,
Stefan Hajnoczi <stefanha@gmail.com>,
Markus Armbruster <armbru@redhat.com>,
Amit Shah <amit.shah@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PATCH 2/2] atapi: Report correct errors on guest eject request
Date: Sat, 9 Apr 2011 15:54:39 +0530 [thread overview]
Message-ID: <a24cef163b4cb988a47e6596e062ab993606cadd.1302344671.git.amit.shah@redhat.com> (raw)
In-Reply-To: <2db4951250c8473b5d0b78d24353c45c32b5aa8a.1302344671.git.amit.shah@redhat.com>
In-Reply-To: <2db4951250c8473b5d0b78d24353c45c32b5aa8a.1302344671.git.amit.shah@redhat.com>
Table 629 of the MMC-5 spec mentions two different error conditions when
a CDROM eject is requested: a) while a disc is inserted and b) while a
disc is not inserted.
Ensure we return the appropriate error for the present condition of the
drive and disc status.
Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
hw/ide/core.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 8958ff2..b8b78bb 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -1464,7 +1464,7 @@ static void ide_atapi_cmd(IDEState *s)
break;
case GPCMD_START_STOP_UNIT:
{
- int start, eject, err = 0;
+ int start, eject, sense, err = 0;
start = packet[4] & 1;
eject = (packet[4] >> 1) & 1;
@@ -1477,7 +1477,11 @@ static void ide_atapi_cmd(IDEState *s)
ide_atapi_cmd_ok(s);
break;
case -EBUSY:
- ide_atapi_cmd_error(s, SENSE_NOT_READY,
+ sense = SENSE_NOT_READY;
+ if (bdrv_is_inserted(s->bs)) {
+ sense = SENSE_ILLEGAL_REQUEST;
+ }
+ ide_atapi_cmd_error(s, sense,
ASC_MEDIA_REMOVAL_PREVENTED);
break;
default:
--
1.7.4.2
next prev parent reply other threads:[~2011-04-09 10:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-09 10:24 [Qemu-devel] [PATCH 1/2] atapi: Drives can be locked without media present Amit Shah
2011-04-09 10:24 ` Amit Shah [this message]
2011-04-11 14:54 ` [Qemu-devel] " Kevin Wolf
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=a24cef163b4cb988a47e6596e062ab993606cadd.1302344671.git.amit.shah@redhat.com \
--to=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
--cc=stefanha@gmail.com \
/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).