Hannes Reinecke <h...@suse.de> writes: > On 08/03/2011 03:08 PM, Markus Armbruster wrote: >> Don't fail when tray is already open. >> >> Signed-off-by: Markus Armbruster<arm...@redhat.com> >> --- >> 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); [...]