* [SCSI] scsi.h: add macro for enclosure bit of inquiry data
@ 2008-01-20 15:09 James Bottomley
2008-01-20 17:44 ` Stefan Richter
0 siblings, 1 reply; 3+ messages in thread
From: James Bottomley @ 2008-01-20 15:09 UTC (permalink / raw)
To: linux-scsi
The macro tells us whether the device is (or contains) an enclosure device.
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
include/scsi/scsi_device.h | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index e0c645a..a262d11 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -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) "*")
--
1.5.3.8
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [SCSI] scsi.h: add macro for enclosure bit of inquiry data
2008-01-20 15:09 [SCSI] scsi.h: add macro for enclosure bit of inquiry data James Bottomley
@ 2008-01-20 17:44 ` Stefan Richter
2008-01-20 23:29 ` James Bottomley
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Richter @ 2008-01-20 17:44 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
James Bottomley wrote:
> The macro tells us whether the device is (or contains) an enclosure device.
...
> +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.
--
Stefan Richter
-=====-==--- ---= =-=--
http://arcgraph.de/sr/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [SCSI] scsi.h: add macro for enclosure bit of inquiry data
2008-01-20 17:44 ` Stefan Richter
@ 2008-01-20 23:29 ` James Bottomley
0 siblings, 0 replies; 3+ messages in thread
From: James Bottomley @ 2008-01-20 23:29 UTC (permalink / raw)
To: Stefan Richter; +Cc: linux-scsi
On Sun, 2008-01-20 at 18:44 +0100, Stefan Richter wrote:
> James Bottomley wrote:
> > The macro tells us whether the device is (or contains) an enclosure device.
> ...
> > +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.
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-01-20 23:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-20 15:09 [SCSI] scsi.h: add macro for enclosure bit of inquiry data James Bottomley
2008-01-20 17:44 ` Stefan Richter
2008-01-20 23:29 ` James Bottomley
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox