From: James Bottomley <James.Bottomley@SteelEye.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] add extra inquiry byte 56 data to struct scsi_device
Date: 21 Aug 2004 00:06:54 -0400 [thread overview]
Message-ID: <1093061216.2688.710.camel@mulgrave> (raw)
In-Reply-To: <4126BFCC.2000702@pobox.com>
On Fri, 2004-08-20 at 23:21, Jeff Garzik wrote:
> It seems to me that a more maintainable approach is to cache relevant
> INQUIRY data in a buffer, and then create accessor macros for
> programmers' use.
>
> That way you don't have to keep adding members (really, mnemonics) to a
> data structure, and associated initialization code, each time the
> mid-layer or some low-level drivers want to test a new feature bit.
> Initialization via memcpy is easy and automatic.
Actually, given the fact that we cache the inquiry data anyway, this
seems to be phenomenally easy to do.
James
===== include/scsi/scsi_device.h 1.19 vs edited =====
--- 1.19/include/scsi/scsi_device.h 2004-07-07 11:24:13 -05:00
+++ edited/include/scsi/scsi_device.h 2004-08-20 22:54:00 -05:00
@@ -191,5 +194,37 @@
static inline int scsi_device_online(struct scsi_device *sdev)
{
return sdev->sdev_state != SDEV_OFFLINE;
+}
+
+/* accessor functions for the SCSI parameters */
+static inline int scsi_device_sync(struct scsi_device *sdev)
+{
+ return sdev->sdtr;
+}
+static inline int scsi_device_wide(struct scsi_device *sdev)
+{
+ return sdev->wdtr;
+}
+static inline int scsi_device_dt(struct scsi_device *sdev)
+{
+ return sdev->ppr;
+}
+static inline int scsi_device_dt_only(struct scsi_device *sdev)
+{
+ if (sdev->inquiry_len < 57)
+ return 0;
+ return (sdev->inquiry[56] & 0x0c) == 0x04;
+}
+static inline int scsi_device_ius(struct scsi_device *sdev)
+{
+ if (sdev->inquiry_len < 57)
+ return 0;
+ return sdev->inquiry[56] & 0x01;
+}
+static inline int scsi_device_qas(struct scsi_device *sdev)
+{
+ if (sdev->inquiry_len < 57)
+ return 0;
+ return sdev->inquiry[56] & 0x02;
}
#endif /* _SCSI_SCSI_DEVICE_H */
next prev parent reply other threads:[~2004-08-21 4:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-21 1:56 [PATCH] add extra inquiry byte 56 data to struct scsi_device James Bottomley
2004-08-21 3:21 ` Jeff Garzik
2004-08-21 3:39 ` James Bottomley
2004-08-21 4:06 ` James Bottomley [this message]
2004-08-21 4:41 ` Jeff Garzik
2004-08-21 4:38 ` Randy.Dunlap
2004-08-21 4:57 ` Jeff Garzik
2004-08-21 13:03 ` Douglas Gilbert
2004-08-21 13:51 ` James Bottomley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1093061216.2688.710.camel@mulgrave \
--to=james.bottomley@steeleye.com \
--cc=jgarzik@pobox.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox