[PATCH v5 04/18] scsi: Move sd_pr_type to header to share

michael.christie at oracle.com michael.christie at oracle.com
Fri Mar 24 11:41:49 PDT 2023


On 3/24/23 1:25 PM, Bart Van Assche wrote:
> On 3/24/23 11:17, Mike Christie wrote:
>> diff --git a/include/scsi/scsi_block_pr.h b/include/scsi/scsi_block_pr.h
>> new file mode 100644
>> index 000000000000..44766d7a81d8
>> --- /dev/null
>> +++ b/include/scsi/scsi_block_pr.h
>> @@ -0,0 +1,36 @@
>> +/* SPDX-License-Identifier: GPL-2.0 */
>> +#ifndef _SCSI_BLOCK_PR_H
>> +#define _SCSI_BLOCK_PR_H
>> +
>> +#include <uapi/linux/pr.h>
>> +
>> +enum scsi_pr_type {
>> +    SCSI_PR_WRITE_EXCLUSIVE            = 0x01,
>> +    SCSI_PR_EXCLUSIVE_ACCESS        = 0x03,
>> +    SCSI_PR_WRITE_EXCLUSIVE_REG_ONLY    = 0x05,
>> +    SCSI_PR_EXCLUSIVE_ACCESS_REG_ONLY    = 0x06,
>> +    SCSI_PR_WRITE_EXCLUSIVE_ALL_REGS    = 0x07,
>> +    SCSI_PR_EXCLUSIVE_ACCESS_ALL_REGS    = 0x08,
>> +};
>> +
>> +static inline enum scsi_pr_type block_pr_type_to_scsi(enum pr_type type)
>> +{
>> +    switch (type) {
>> +    case PR_WRITE_EXCLUSIVE:
>> +        return SCSI_PR_WRITE_EXCLUSIVE;
>> +    case PR_EXCLUSIVE_ACCESS:
>> +        return SCSI_PR_EXCLUSIVE_ACCESS;
>> +    case PR_WRITE_EXCLUSIVE_REG_ONLY:
>> +        return SCSI_PR_WRITE_EXCLUSIVE_REG_ONLY;
>> +    case PR_EXCLUSIVE_ACCESS_REG_ONLY:
>> +        return SCSI_PR_EXCLUSIVE_ACCESS_REG_ONLY;
>> +    case PR_WRITE_EXCLUSIVE_ALL_REGS:
>> +        return SCSI_PR_WRITE_EXCLUSIVE_ALL_REGS;
>> +    case PR_EXCLUSIVE_ACCESS_ALL_REGS:
>> +        return SCSI_PR_EXCLUSIVE_ACCESS_ALL_REGS;
>> +    }
>> +
>> +    return 0;
>> +}
>> +
>> +#endif
> 
> Hi Mike,
> 
> Has it been considered to move enum scsi_pr_type into include/scsi/scsi_common.h and block_pr_type_to_scsi() into drivers/scsi/scsi_common.c? Other definitions that are shared between SCSI initiator and SCSI target code exist in these files.

Nice. I didn't know that existed. Will move them.




More information about the Linux-nvme mailing list