scsi_dbg.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef _SCSI_SCSI_DBG_H
  2. #define _SCSI_SCSI_DBG_H
  3. struct scsi_cmnd;
  4. struct scsi_device;
  5. struct scsi_sense_hdr;
  6. #define SCSI_LOG_BUFSIZE 128
  7. extern void scsi_print_command(struct scsi_cmnd *);
  8. extern size_t __scsi_format_command(char *, size_t,
  9. const unsigned char *, size_t);
  10. extern void scsi_show_extd_sense(const struct scsi_device *, const char *,
  11. unsigned char, unsigned char);
  12. extern void scsi_show_sense_hdr(const struct scsi_device *, const char *,
  13. const struct scsi_sense_hdr *);
  14. extern void scsi_print_sense_hdr(const struct scsi_device *, const char *,
  15. const struct scsi_sense_hdr *);
  16. extern void scsi_print_sense(const struct scsi_cmnd *);
  17. extern void __scsi_print_sense(const struct scsi_device *, const char *name,
  18. const unsigned char *sense_buffer,
  19. int sense_len);
  20. extern void scsi_print_result(const struct scsi_cmnd *, const char *, int);
  21. #ifdef CONFIG_SCSI_CONSTANTS
  22. extern bool scsi_opcode_sa_name(int, int, const char **, const char **);
  23. extern const char *scsi_sense_key_string(unsigned char);
  24. extern const char *scsi_extd_sense_format(unsigned char, unsigned char,
  25. const char **);
  26. extern const char *scsi_mlreturn_string(int);
  27. extern const char *scsi_hostbyte_string(int);
  28. extern const char *scsi_driverbyte_string(int);
  29. #else
  30. static inline bool
  31. scsi_opcode_sa_name(int cmd, int sa,
  32. const char **cdb_name, const char **sa_name)
  33. {
  34. *cdb_name = NULL;
  35. switch (cmd) {
  36. case VARIABLE_LENGTH_CMD:
  37. case MAINTENANCE_IN:
  38. case MAINTENANCE_OUT:
  39. case PERSISTENT_RESERVE_IN:
  40. case PERSISTENT_RESERVE_OUT:
  41. case SERVICE_ACTION_IN_12:
  42. case SERVICE_ACTION_OUT_12:
  43. case SERVICE_ACTION_BIDIRECTIONAL:
  44. case SERVICE_ACTION_IN_16:
  45. case SERVICE_ACTION_OUT_16:
  46. case EXTENDED_COPY:
  47. case RECEIVE_COPY_RESULTS:
  48. *sa_name = NULL;
  49. return true;
  50. default:
  51. return false;
  52. }
  53. }
  54. static inline const char *
  55. scsi_sense_key_string(unsigned char key)
  56. {
  57. return NULL;
  58. }
  59. static inline const char *
  60. scsi_extd_sense_format(unsigned char asc, unsigned char ascq, const char **fmt)
  61. {
  62. *fmt = NULL;
  63. return NULL;
  64. }
  65. static inline const char *
  66. scsi_mlreturn_string(int result)
  67. {
  68. return NULL;
  69. }
  70. static inline const char *
  71. scsi_hostbyte_string(int result)
  72. {
  73. return NULL;
  74. }
  75. static inline const char *
  76. scsi_driverbyte_string(int result)
  77. {
  78. return NULL;
  79. }
  80. #endif
  81. #endif /* _SCSI_SCSI_DBG_H */