Received: from eggs.gnu.org ([140.186.70.92]:35167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QorjZ-0001Fa-3t for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:48:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QorjY-0004WK-3O for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:48:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:12044) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QorjX-0004WD-QO for qemu-devel@nongnu.org; Thu, 04 Aug 2011 02:48:44 -0400 From: Markus Armbruster References: <1312376904-16115-1-git-send-email-armbru@redhat.com> <1312376904-16115-24-git-send-email-armbru@redhat.com> <4E3A3A25.7040006@suse.de> Date: Thu, 04 Aug 2011 08:48:37 +0200 In-Reply-To: <4E3A3A25.7040006@suse.de> (Hannes Reinecke's message of "Thu, 04 Aug 2011 08:20:21 +0200") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: [Qemu-devel] [PATCH v2 23/45] scsi-disk: Fix START_STOP to fail when it can't eject List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Hannes Reinecke Cc: kwolf@redhat.com, quintela@redhat.com, stefano.stabellini@eu.citrix.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, amit.shah@redhat.com, hch@lst.de Hannes Reinecke writes: > On 08/03/2011 03:08 PM, Markus Armbruster wrote: >> Don't fail when tray is already open. >> >> Signed-off-by: Markus Armbruster >> --- >> hw/scsi-bus.c | 10 ++++++++++ >> hw/scsi-disk.c | 15 +++++++++++---- >> hw/scsi.h | 4 ++++ >> 3 files changed, 25 insertions(+), 4 deletions(-) >> >> diff --git a/hw/scsi-bus.c b/hw/scsi-bus.c >> index 0b0344c..1c5fe7f 100644 >> --- a/hw/scsi-bus.c >> +++ b/hw/scsi-bus.c >> @@ -441,6 +441,11 @@ const struct SCSISense sense_code_NO_MEDIUM = { >> .key = NOT_READY, .asc = 0x3a, .ascq = 0x00 >> }; >> >> +/* LUN not ready, medium removal prevented */ >> +const struct SCSISense sense_code_MEDIUM_REMOVAL_PREVENTED_NR = { >> + .key = NOT_READY, .asc = 0x53, .ascq = 0x00 >> +}; >> + > I would prefer to have the naming reversed, > eg NOT_READY_REMOVAL_PREVENTED I don't care, so I'll do it your way :) More of the same below, plus typos, all noted, thanks! By the way, I hate having to define a struct SCSISense in another file (and make up a name for it!) just to report sense. And I hate the silly macro trickery to mask the long names even more. To make sense of scsi_command_complete(r, CHECK_CONDITION, SENSE_CODE(NO_MEDIUM)); I have to look up SENSE_CODE() in scsi.h: #define SENSE_CODE(x) sense_code_ ## x which leads me to scsi-bus.c: /* LUN not ready, Medium not present */ const struct SCSISense sense_code_NO_MEDIUM = { .key = NOT_READY, .asc = 0x3a, .ascq = 0x00 }; Compare to IDE: ide_atapi_cmd_error(s, SENSE_NOT_READY, ASC_MEDIUM_NOT_PRESENT); [...]