[PATCH 12 of 16] SCSI host driver DIF helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



1 file changed, 23 insertions(+)
include/scsi/sd.h |   23 +++++++++++++++++++++++


HBA drivers need to poke in the CDB to prepare DIF commands.  Provide
helpers for extracting {RD,WR}PROTECT and start LBA.

Signed-off-by: Martin K. Petersen <martin.petersen@xxxxxxxxxx>

---

diff -r b512cd02f8b0 -r 5262eba570f4 include/scsi/sd.h
--- a/include/scsi/sd.h	Fri Apr 25 17:39:29 2008 -0400
+++ b/include/scsi/sd.h	Fri Apr 25 17:39:29 2008 -0400
@@ -1,5 +1,7 @@
 #ifndef _SCSI_DISK_H
 #define _SCSI_DISK_H
+
+#include <scsi/scsi_cmnd.h>
 
 /*
  * More than enough for everybody ;)  The huge number of majors
@@ -61,4 +63,25 @@
 		    (sdsk)->disk->disk_name, ##a) :			\
 	sdev_printk(prefix, (sdsk)->device, fmt, ##a)
 
+static inline unsigned int sd_protect_field(struct scsi_cmnd *scmd)
+{
+	switch(scmd->cmnd[0]) {
+	case READ_10:
+	case READ_12:
+	case READ_16:
+	case WRITE_10:
+	case WRITE_12:
+	case WRITE_16:
+		return (scmd->cmnd[1] & 0xe0) >> 5;
+
+	default:
+		return -1;
+	}
+}
+
+static inline sector_t sd_start_lba(struct scsi_cmnd *scmd)
+{
+	return scmd->request->sector;
+}
+
 #endif /* _SCSI_DISK_H */


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux