summaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_request.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-01-27 09:46:29 +0100
committerJens Axboe <axboe@fb.com>2017-01-27 15:08:35 -0700
commit82ed4db499b8598f16f8871261bff088d6b0597f (patch)
treee1cc0a433bf5ae2b9723837291617bdfeeb61816 /include/scsi/scsi_request.h
parent8ae94eb65be9425af4d57a4f4cfebfdf03081e93 (diff)
downloadop-kernel-dev-82ed4db499b8598f16f8871261bff088d6b0597f.zip
op-kernel-dev-82ed4db499b8598f16f8871261bff088d6b0597f.tar.gz
block: split scsi_request out of struct request
And require all drivers that want to support BLOCK_PC to allocate it as the first thing of their private data. To support this the legacy IDE and BSG code is switched to set cmd_size on their queues to let the block layer allocate the additional space. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'include/scsi/scsi_request.h')
-rw-r--r--include/scsi/scsi_request.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/scsi/scsi_request.h b/include/scsi/scsi_request.h
new file mode 100644
index 0000000..ba0aeb9
--- /dev/null
+++ b/include/scsi/scsi_request.h
@@ -0,0 +1,30 @@
+#ifndef _SCSI_SCSI_REQUEST_H
+#define _SCSI_SCSI_REQUEST_H
+
+#include <linux/blk-mq.h>
+
+#define BLK_MAX_CDB 16
+
+struct scsi_request {
+ unsigned char __cmd[BLK_MAX_CDB];
+ unsigned char *cmd;
+ unsigned short cmd_len;
+ unsigned int sense_len;
+ unsigned int resid_len; /* residual count */
+ void *sense;
+};
+
+static inline struct scsi_request *scsi_req(struct request *rq)
+{
+ return blk_mq_rq_to_pdu(rq);
+}
+
+static inline void scsi_req_free_cmd(struct scsi_request *req)
+{
+ if (req->cmd != req->__cmd)
+ kfree(req->cmd);
+}
+
+void scsi_req_init(struct request *);
+
+#endif /* _SCSI_SCSI_REQUEST_H */
OpenPOWER on IntegriCloud