scsi_request.h 667 B

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