Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 1 | #ifndef _SCSI_SCSI_REQUEST_H |
| 2 | #define _SCSI_SCSI_REQUEST_H |
| 3 | |
| 4 | #include <linux/blk-mq.h> |
| 5 | |
| 6 | #define BLK_MAX_CDB 16 |
| 7 | |
| 8 | struct scsi_request { |
| 9 | unsigned char __cmd[BLK_MAX_CDB]; |
| 10 | unsigned char *cmd; |
| 11 | unsigned short cmd_len; |
| 12 | unsigned int sense_len; |
| 13 | unsigned int resid_len; /* residual count */ |
| 14 | void *sense; |
| 15 | }; |
| 16 | |
| 17 | static inline struct scsi_request *scsi_req(struct request *rq) |
| 18 | { |
| 19 | return blk_mq_rq_to_pdu(rq); |
| 20 | } |
| 21 | |
| 22 | static inline void scsi_req_free_cmd(struct scsi_request *req) |
| 23 | { |
| 24 | if (req->cmd != req->__cmd) |
| 25 | kfree(req->cmd); |
| 26 | } |
| 27 | |
| 28 | void scsi_req_init(struct request *); |
| 29 | |
| 30 | #endif /* _SCSI_SCSI_REQUEST_H */ |