scsi.h: add macro for enclosure bit of inquiry data
James Bottomley
maintainerThe macro tells us whether the device is (or contains) an enclosure device.
--- include/scsi/scsi_device.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
include/scsi/scsi_device.h +4 -0
@@ -386,6 +386,10 @@ static inline int scsi_device_qas(struct scsi_device *sdev)return 0 ;return sdev->inquiry[56 ] &0x02 ; } +static inline int scsi_device_enclosure (struct scsi_device *sdev) +{ +return sdev->inquiry[6 ] & (1 <<6 ); +}#define MODULE_ALIAS_SCSI_DEVICE (type) \ MODULE_ALIAS("scsi:t-" __stringify(type) "*")
Signature · 1 line
1.5.3.8
Quoted 1 line · James Bottomley
The macro tells us whether the device is (or contains) an enclosure device.
...
include/scsi/scsi_device.h static inline int scsi_device_qas(struct scsi_device *sdev) · line 392
Quoted 4 lines
include/scsi/scsi_device.h +4
-0+static inline int scsi_device_enclosure (struct scsi_device *sdev) +{ +return sdev->inquiry[6 ] & (1 <<6 ); +}
Perhaps call it scsi_device_is_enclosure() to better reflect the nature of this function.
Or if it is an accessor to inquiry data to you, maybe call it scsi_device_inquiry_encserv() or scsi_device_inquiry_enclosure_services() or sdev_to_inquiry_encserv() or sdev_to_inquiry_enclosure_services().
Alas neither of this fits with the existing similar functions in scsi_device.h which don't have expressive names.
Signature · 3 lines
Stefan Richter -=====-==--- ---= =-=-- http://arcgraph.de/sr/
James Bottomley
maintainerQuoted 11 lines · Stefan Richter
Quoted 1 line · James Bottomley
The macro tells us whether the device is (or contains) an enclosure device.
...
include/scsi/scsi_device.h static inline int scsi_device_qas(struct scsi_device *sdev) · line 392
Quoted 4 lines
include/scsi/scsi_device.h +4
-0+static inline int scsi_device_enclosure (struct scsi_device *sdev) +{ +return sdev->inquiry[6 ] & (1 <<6 ); +}Perhaps call it
scsi_device_is_enclosure()to better reflect the nature of this function.
Quoted 8 lines
Or if it is an accessor to inquiry data to you, maybe call it
scsi_device_inquiry_encserv()orscsi_device_inquiry_enclosure_services()orsdev_to_inquiry_encserv()orsdev_to_inquiry_enclosure_services().Alas neither of this fits with the existing similar functions in
scsi_device.hwhich don't have expressive names.
Right .. that's the problem. Being potentially clearer in naming but at odds with what's currently in the file starts to add to the confusion about the other names in there. I chose the name primarily because it's the same form as all the others.
James