scsi: Use 'blist_flags_t' for scsi_devinfo flags
PATCH 1/1 scsi: Use 'blist_flags_t' for scsi_devinfo flags
As per recommendation from Linus we should be using a distinct type for blacklist flags.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/scsi/scsi_devinfo.c | 18 ++++++++--------- drivers/scsi/scsi_priv.h | 15 +++++++------- drivers/scsi/scsi_scan.c | 2 +- include/scsi/scsi_device.h | 4 +++- include/scsi/scsi_devinfo.h | 48 ++++++++++++++++++++++----------------------- 5 files changed, 45 insertions(+), 42 deletions(-)
drivers/scsi/scsi_devinfo.c +9 -9
@@ -21,7 +21,7 @@ struct scsi_dev_info_list {struct list_head dev_info_list;char vendor[8 ];char model[16 ]; -unsigned flags; +blist_flags_t flags;unsigned compatible;/* for use with scsi_static_device_list entries */ };
@@ -34,7 +34,7 @@ struct scsi_dev_info_list_table {static const char spaces[] =" " ;/* 16 of them */ -static unsigned scsi_default_dev_flags; +static blist_flags_t scsi_default_dev_flags;static LIST_HEAD (scsi_dev_info_list);static char scsi_dev_flags[256 ];
@@ -51,7 +51,7 @@ struct scsi_dev_info_list_table {char *vendor;char *model;char *revision;/* revision known to be bad, unused */ -unsigned flags; +blist_flags_t flags; } scsi_static_device_list[] __initdata = {/* * The following devices are known not to tolerate a lun != 0 scan
@@ -334,7 +334,7 @@ static void scsi_strcpy_devinfo(char *name, char *to, size_t to_length,* Returns: 0 OK, -error on failure. **/ static int scsi_dev_info_list_add (int compatible,char *vendor,char *model, -char *strflags,int flags) +char *strflags,blist_flags_t flags) { return scsi_dev_info_list_add_keyed(compatible, vendor, model, strflags, flags,
@@ -360,7 +360,7 @@ static int scsi_dev_info_list_add(int compatible, char *vendor, char *model,* Returns: 0 OK, -error on failure. **/ int scsi_dev_info_list_add_keyed (int compatible,char *vendor,char *model, -char *strflags,int flags,int key) +char *strflags,blist_flags_t flags,int key) {struct scsi_dev_info_list *devinfo; struct scsi_dev_info_list_table *devinfo_table =
@@ -570,9 +570,9 @@ static int scsi_dev_info_list_add_str(char *dev_list)* matching flags value, else return the host or global default * settings. Called during scan time. **/ -int scsi_get_device_flags (struct scsi_device *sdev, -const unsigned char *vendor, -const unsigned char *model) +blist_flags_t scsi_get_device_flags (struct scsi_device *sdev, +const unsigned char *vendor, +const unsigned char *model) {return scsi_get_device_flags_keyed (sdev, vendor, model,SCSI_DEVINFO_GLOBAL );
@@ -592,7 +592,7 @@ int scsi_get_device_flags(struct scsi_device *sdev,* flags value, else return the host or global default settings. * Called during scan time. **/ -int scsi_get_device_flags_keyed (struct scsi_device *sdev, +blist_flags_t scsi_get_device_flags_keyed (struct scsi_device *sdev,const unsigned char *vendor,const unsigned char *model,int key)
drivers/scsi/scsi_priv.h +8 -7
@@ -49,15 +49,16 @@ enum { SCSI_DEVINFO_SPI, }; -extern int scsi_get_device_flags (struct scsi_device *sdev, -const unsigned char *vendor, -const unsigned char *model); -extern int scsi_get_device_flags_keyed (struct scsi_device *sdev, -const unsigned char *vendor, -const unsigned char *model,int key); +extern blist_flags_t scsi_get_device_flags (struct scsi_device *sdev, +const unsigned char *vendor, +const unsigned char *model); +extern blist_flags_t scsi_get_device_flags_keyed (struct scsi_device *sdev, +const unsigned char *vendor, +const unsigned char *model, +int key);extern int scsi_dev_info_list_add_keyed (int compatible,char *vendor,char *model,char *strflags, -int flags,int key); +blist_flags_t flags,int key);extern int scsi_dev_info_list_del_keyed (char *vendor,char *model,int key);extern int scsi_dev_info_add_list (int key,const char *name);extern int scsi_dev_info_remove_list (int key);
drivers/scsi/scsi_scan.c +1 -1
@@ -565,7 +565,7 @@ void scsi_sanitize_inquiry_string(unsigned char *s, int len)* are copied to the scsi_device any flags value is stored in *@bflags. **/ static int scsi_probe_lun (struct scsi_device *sdev,unsigned char *inq_result, -int result_len,int *bflags) +int result_len,blist_flags_t *bflags) {unsigned char scsi_cmd[MAX_COMMAND_SIZE ];int first_inquiry_len, try_inquiry_len, next_inquiry_len;
include/scsi/scsi_device.h +3 -1
@@ -14,6 +14,8 @@struct scsi_lun ;struct scsi_sense_hdr ; +typedef unsigned int __bitwise blist_flags_t ; +struct scsi_mode_data {__u32 length;__u16 block_descriptor_length;
@@ -140,7 +142,7 @@ struct scsi_device {unsigned char current_tag;/* current tag */ struct scsi_target *sdev_target;/* used only for single_lun */ -unsigned int sdev_bflags;/* black/white flags as also found in +blist_flags_t sdev_bflags;/* black/white flags as also found in * scsi_devinfo.[hc]. For now used only to * pass settings from slave_alloc to scsi * core. */
include/scsi/scsi_devinfo.h +24 -24
77 lines not on this page · raw message
Signature · 1 line
1.8.5.6
Quoted 2 lines · Hannes Reinecke
As per recommendation from Linus we should be using a distinct type for blacklist flags.
Hello Hannes,
Have you noticed that this patch is a subset of the patch series I posted yesterday (https://marc.info/?l=linux-scsi&m=151071333113241&w=2)?
Bart.
Hi Hannes,
include/scsi/scsi_devinfo.h line 55
Quoted 4 lines
As per recommendation from Linus we should be using a distinct type for blacklist flags.
include/scsi/scsi_devinfo.h +1
-1-#define BLIST_MAX_1024 ((__force __u32 __bitwise)(1 << 30)) +#define BLIST_MAX_1024 ((__force blist_flags_t)(1 << 30))
You are missing:
/* Use UNMAP limit for WRITE SAME */
#define BLIST_UNMAP_LIMIT_WS ((__force blist_flags_t)(1 << 31))
I'll fix it up...
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering