diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/scsi/scsi_cmnd.h | 20 | ||||
-rw-r--r-- | include/scsi/scsi_device.h | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 402c1078d01c..f9f6e793575c 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h | |||
@@ -90,6 +90,8 @@ struct scsi_cmnd { | |||
90 | 90 | ||
91 | /* These elements define the operation we ultimately want to perform */ | 91 | /* These elements define the operation we ultimately want to perform */ |
92 | struct scsi_data_buffer sdb; | 92 | struct scsi_data_buffer sdb; |
93 | struct scsi_data_buffer *prot_sdb; | ||
94 | |||
93 | unsigned underflow; /* Return error if less than | 95 | unsigned underflow; /* Return error if less than |
94 | this amount is transferred */ | 96 | this amount is transferred */ |
95 | 97 | ||
@@ -274,4 +276,22 @@ static inline sector_t scsi_get_lba(struct scsi_cmnd *scmd) | |||
274 | return scmd->request->sector; | 276 | return scmd->request->sector; |
275 | } | 277 | } |
276 | 278 | ||
279 | static inline unsigned scsi_prot_sg_count(struct scsi_cmnd *cmd) | ||
280 | { | ||
281 | return cmd->prot_sdb ? cmd->prot_sdb->table.nents : 0; | ||
282 | } | ||
283 | |||
284 | static inline struct scatterlist *scsi_prot_sglist(struct scsi_cmnd *cmd) | ||
285 | { | ||
286 | return cmd->prot_sdb ? cmd->prot_sdb->table.sgl : NULL; | ||
287 | } | ||
288 | |||
289 | static inline struct scsi_data_buffer *scsi_prot(struct scsi_cmnd *cmd) | ||
290 | { | ||
291 | return cmd->prot_sdb; | ||
292 | } | ||
293 | |||
294 | #define scsi_for_each_prot_sg(cmd, sg, nseg, __i) \ | ||
295 | for_each_sg(scsi_prot_sglist(cmd), sg, nseg, __i) | ||
296 | |||
277 | #endif /* _SCSI_SCSI_CMND_H */ | 297 | #endif /* _SCSI_SCSI_CMND_H */ |
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 4deb9349eebf..9cecc409f0f8 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h | |||
@@ -423,6 +423,11 @@ static inline int scsi_device_enclosure(struct scsi_device *sdev) | |||
423 | return sdev->inquiry[6] & (1<<6); | 423 | return sdev->inquiry[6] & (1<<6); |
424 | } | 424 | } |
425 | 425 | ||
426 | static inline int scsi_device_protection(struct scsi_device *sdev) | ||
427 | { | ||
428 | return sdev->inquiry[5] & (1<<0); | ||
429 | } | ||
430 | |||
426 | #define MODULE_ALIAS_SCSI_DEVICE(type) \ | 431 | #define MODULE_ALIAS_SCSI_DEVICE(type) \ |
427 | MODULE_ALIAS("scsi:t-" __stringify(type) "*") | 432 | MODULE_ALIAS("scsi:t-" __stringify(type) "*") |
428 | #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x" | 433 | #define SCSI_DEVICE_MODALIAS_FMT "scsi:t-0x%02x" |