Re: [PATCH 000/117] Make better use of static type checking

Hannes Reinecke
2021-04-20T06:04:57Z

On 4/20/21 2:06 AM, Bart Van Assche wrote:
>
> Hi Martin,
>
> This patch series improves static checking inside the SCSI subsystem as
> follows:
> - Introduce enumeration types for the SCSI status, message, host and driver
> bytes.
> - Change 'int' into 'union scsi_status' in case of SCSI results. This helps
> the compiler and humans to tell the difference between a scalar and a SCSI
> result.
>
> This patch series is long because it touches all SCSI drivers and because it
> has been split into one patch per SCSI driver.
>
> This patch series introduces a backwards-incompatible change in the API
> between SCSI core and drivers. A possible strategy is to postpone the patch
> that removes backwards compatibility to a later kernel version.
>
> Please consider this patch series for kernel version v5.14.
>
I'd rather not go this way.
We should not try to preserve the split SCSI result value with its four
distinct fields.

I'd rather have the message byte handling moved into the SCSI parallel
drivers (where really it should've been in the first place).
The driver byte can go entirely as the DRIVER_SENSE flag can be replaced
with a check for valid sense code, DRIVER_TIMEOUT is pretty much
identical to DID_TIMEOUT (with the semantic difference _who_ set the
timeout), and DRIVER_ERROR can be folded back into the caller.
All other values are unused, allowing us to drop driver error completely.

With that we're only having two fields (host byte and status byte) left,
which should be treated as two distinct values.

As it so happens I do have a patchset for this; guess I'll be posting it
to demonstrate the idea.

Bart, I would very much prefer if we could work on this together so as
to avoid duplicate work.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer