From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54442) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHDQS-0001ER-Hn for qemu-devel@nongnu.org; Tue, 03 May 2011 07:05:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHDQR-0005PN-OX for qemu-devel@nongnu.org; Tue, 03 May 2011 07:05:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHDQR-0005P6-E2 for qemu-devel@nongnu.org; Tue, 03 May 2011 07:05:55 -0400 From: Kevin Wolf Date: Tue, 3 May 2011 13:08:23 +0200 Message-Id: <1304420906-5776-4-git-send-email-kwolf@redhat.com> In-Reply-To: <1304420906-5776-1-git-send-email-kwolf@redhat.com> References: <1304420906-5776-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PATCH 3/6] atapi: Explain why we need a 'media not present' state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: anthony@codemonkey.ws Cc: kwolf@redhat.com, qemu-devel@nongnu.org From: Amit Shah After the re-org of the atapi code, it might not be intuitive for a reader of the code to understand why we're inserting a 'media not present' state between cd changes. Signed-off-by: Amit Shah Signed-off-by: Kevin Wolf --- hw/ide/atapi.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/ide/atapi.c b/hw/ide/atapi.c index 86b18d8..58febc0 100644 --- a/hw/ide/atapi.c +++ b/hw/ide/atapi.c @@ -1106,7 +1106,13 @@ void ide_atapi_cmd(IDEState *s) ide_atapi_cmd_check_status(s); return; } - + /* + * When a CD gets changed, we have to report an ejected state and + * then a loaded state to guests so that they detect tray + * open/close and media change events. Guests that do not use + * GET_EVENT_STATUS_NOTIFICATION to detect such tray open/close + * states rely on this behavior. + */ if (bdrv_is_inserted(s->bs) && s->cdrom_changed) { ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); -- 1.7.2.3