^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) #ifndef _SCSI_SCSI_REQUEST_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #define _SCSI_SCSI_REQUEST_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) #include <linux/blk-mq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #define BLK_MAX_CDB 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) struct scsi_request {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) unsigned char __cmd[BLK_MAX_CDB];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) unsigned char *cmd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) unsigned short cmd_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) int result;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) unsigned int sense_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) unsigned int resid_len; /* residual count */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) int retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) void *sense;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static inline struct scsi_request *scsi_req(struct request *rq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) return blk_mq_rq_to_pdu(rq);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) static inline void scsi_req_free_cmd(struct scsi_request *req)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) if (req->cmd != req->__cmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) kfree(req->cmd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) void scsi_req_init(struct scsi_request *req);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #endif /* _SCSI_SCSI_REQUEST_H */