From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:57264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFSIy-00036P-HS for qemu-devel@nongnu.org; Thu, 28 Apr 2011 10:34:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFSIx-0008Bs-OE for qemu-devel@nongnu.org; Thu, 28 Apr 2011 10:34:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32233) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFSIx-0008Bn-Aj for qemu-devel@nongnu.org; Thu, 28 Apr 2011 10:34:55 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p3SEYsCr003308 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Apr 2011 10:34:54 -0400 From: Amit Shah Date: Thu, 28 Apr 2011 20:04:41 +0530 Message-Id: <0f91665d933ee4d104035b56d7de5034d5e150fc.1304001278.git.amit.shah@redhat.com> In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 2/2] atapi: Explain why we need a 'media not present' state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: Amit Shah , qemu list 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 --- 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.4.4