From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37247 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q7kmd-0008Ih-HS for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:41:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q7kmb-0001A6-Nd for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:41:42 -0400 Received: from mail-wy0-f173.google.com ([74.125.82.173]:59162) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q7kmb-00019g-GJ for qemu-devel@nongnu.org; Thu, 07 Apr 2011 04:41:41 -0400 Received: by wyb42 with SMTP id 42so2230823wyb.4 for ; Thu, 07 Apr 2011 01:41:40 -0700 (PDT) Date: Thu, 7 Apr 2011 09:41:09 +0100 From: Stefan Hajnoczi Message-ID: <20110407084109.GA21709@stefanha-thinkpad.localdomain> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: [Qemu-devel] Re: [PATCH v2 2/2] cdrom: Make disc change event visible to guests List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: Kevin Wolf , Gleb Natapov , Juan Quintela , Markus Armbruster , qemu list On Thu, Apr 07, 2011 at 10:35:19AM +0530, Amit Shah wrote: > + /* > + * First, check if there's any pending media change > + * notification to be given. > + * > + * We want the guest to notice an empty tray between a cd > + * change, so send one MEDIUM_NOT_PRESENT message after a > + * cd change. > + * > + * After we've sent that message, the guest will poke at > + * us again and send the UNIT_ATTENTION message then. > + * Once this is done, reset the UNIT_ATTENTION message to > + * ensure we don't keep repeating it. > + */ Indentation is off here. > + if (!s->media_change_notified) { > + ide_atapi_cmd_error(s, SENSE_NOT_READY, > + ASC_MEDIUM_NOT_PRESENT); > + s->media_change_notified = 1; > + } else if (s->cdrom_changed) { > + s->sense_key = SENSE_UNIT_ATTENTION; > + s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED; > + ide_atapi_cmd_ok(s); > + > + s->cdrom_changed = 0; > + sense = SENSE_NONE; Indentation is off here. Otherwise looks good. I will test a Windows 2003 Server guest. Stefan