scsi_request.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #ifndef _SCSI_SCSI_REQUEST_H
  2. #define _SCSI_SCSI_REQUEST_H
  3. #include <scsi/scsi_cmnd.h>
  4. struct request;
  5. struct scsi_cmnd;
  6. struct scsi_device;
  7. struct Scsi_Host;
  8. /*
  9. * This is essentially a slimmed down version of Scsi_Cmnd. The point of
  10. * having this is that requests that are injected into the queue as result
  11. * of things like ioctls and character devices shouldn't be using a
  12. * Scsi_Cmnd until such a time that the command is actually at the head
  13. * of the queue and being sent to the driver.
  14. */
  15. struct scsi_request {
  16. int sr_magic;
  17. int sr_result; /* Status code from lower level driver */
  18. unsigned char sr_sense_buffer[SCSI_SENSE_BUFFERSIZE]; /* obtained by REQUEST SENSE
  19. * when CHECK CONDITION is
  20. * received on original command
  21. * (auto-sense) */
  22. struct Scsi_Host *sr_host;
  23. struct scsi_device *sr_device;
  24. struct scsi_cmnd *sr_command;
  25. struct request *sr_request; /* A copy of the command we are
  26. working on */
  27. unsigned sr_bufflen; /* Size of data buffer */
  28. void *sr_buffer; /* Data buffer */
  29. int sr_allowed;
  30. enum dma_data_direction sr_data_direction;
  31. unsigned char sr_cmd_len;
  32. unsigned char sr_cmnd[MAX_COMMAND_SIZE];
  33. void (*sr_done) (struct scsi_cmnd *); /* Mid-level done function */
  34. int sr_timeout_per_command;
  35. unsigned short sr_use_sg; /* Number of pieces of scatter-gather */
  36. unsigned short sr_sglist_len; /* size of malloc'd scatter-gather list */
  37. unsigned sr_underflow; /* Return error if less than
  38. this amount is transferred */
  39. void *upper_private_data; /* reserved for owner (usually upper
  40. level driver) of this request */
  41. };
  42. extern struct scsi_request *scsi_allocate_request(struct scsi_device *, int);
  43. extern void scsi_release_request(struct scsi_request *);
  44. extern void scsi_wait_req(struct scsi_request *, const void *cmnd,
  45. void *buffer, unsigned bufflen,
  46. int timeout, int retries);
  47. extern void scsi_do_req(struct scsi_request *, const void *cmnd,
  48. void *buffer, unsigned bufflen,
  49. void (*done) (struct scsi_cmnd *),
  50. int timeout, int retries);
  51. extern int scsi_execute_req(struct scsi_device *sdev, unsigned char *cmd,
  52. int data_direction, void *buffer, unsigned bufflen,
  53. unsigned char *sense, int timeout, int retries);
  54. #endif /* _SCSI_SCSI_REQUEST_H */