On 16/11/20 20:03, Hannes Reinecke wrote:

+        case SCSI_HOST_TARGET_FAILURE:
+            *sense = SENSE_CODE(TARGET_FAILURE);
+            return CHECK_CONDITION;
+        case SCSI_HOST_RESERVATION_ERROR:
+            return RESERVATION_CONFLICT;
+        case SCSI_HOST_ALLOCATION_FAILURE:
+            *sense = SENSE_CODE(SPACE_ALLOC_FAILED);
+            return CHECK_CONDITION;
+        case SCSI_HOST_MEDIUM_ERROR:
+            *sense = SENSE_CODE(READ_ERROR);
+            return CHECK_CONDITION;

Can these actually be visible to userspace?  I'd rather avoid having them in QEMU if possible.

Otherwise, the patches are completely sensible.

And I did it exactly for the opposite purpose: rather than painstakingly figuring out which codes _might_ be returned (and be utterly surprised if we missed some) add an interpretation for every _possible_ code, avoiding nasty surprises.

And that certainly makes sense too.

On the other hand it'd be nice if Linux was clearer about which the SCSI_HOST values are part of the userspace API and which are just an (ugly) implementation detail.

Paolo


Reply via email to