Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 2 | #ifndef _SCSI_SCSI_REQUEST_H |
| 3 | #define _SCSI_SCSI_REQUEST_H |
| 4 | |
| 5 | #include <linux/blk-mq.h> |
| 6 | |
| 7 | #define BLK_MAX_CDB 16 |
| 8 | |
| 9 | struct scsi_request { |
| 10 | unsigned char __cmd[BLK_MAX_CDB]; |
| 11 | unsigned char *cmd; |
| 12 | unsigned short cmd_len; |
Christoph Hellwig | 17d5363 | 2017-04-20 16:03:01 +0200 | [diff] [blame] | 13 | int result; |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 14 | unsigned int sense_len; |
| 15 | unsigned int resid_len; /* residual count */ |
Christoph Hellwig | 64c7f1d | 2017-04-05 19:18:12 +0200 | [diff] [blame] | 16 | int retries; |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 17 | void *sense; |
| 18 | }; |
| 19 | |
| 20 | static inline struct scsi_request *scsi_req(struct request *rq) |
| 21 | { |
| 22 | return blk_mq_rq_to_pdu(rq); |
| 23 | } |
| 24 | |
| 25 | static inline void scsi_req_free_cmd(struct scsi_request *req) |
| 26 | { |
| 27 | if (req->cmd != req->__cmd) |
| 28 | kfree(req->cmd); |
| 29 | } |
| 30 | |
Bart Van Assche | c8d9cf2 | 2017-06-20 11:15:42 -0700 | [diff] [blame] | 31 | void scsi_req_init(struct scsi_request *req); |
Christoph Hellwig | 82ed4db | 2017-01-27 09:46:29 +0100 | [diff] [blame] | 32 | |
| 33 | #endif /* _SCSI_SCSI_REQUEST_H */ |