blob: 7c583a0f363a8f5f2a6929d6407312ca67ef2fbc [file] [log] [blame]
Christoph Hellwig82ed4db2017-01-27 09:46:29 +01001#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
8struct 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 */
Christoph Hellwig64c7f1d2017-04-05 19:18:12 +020014 int retries;
Christoph Hellwig82ed4db2017-01-27 09:46:29 +010015 void *sense;
16};
17
18static inline struct scsi_request *scsi_req(struct request *rq)
19{
20 return blk_mq_rq_to_pdu(rq);
21}
22
23static inline void scsi_req_free_cmd(struct scsi_request *req)
24{
25 if (req->cmd != req->__cmd)
26 kfree(req->cmd);
27}
28
29void scsi_req_init(struct request *);
30
31#endif /* _SCSI_SCSI_REQUEST_H */