scsi_priv.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #ifndef _SCSI_PRIV_H
  2. #define _SCSI_PRIV_H
  3. #include <linux/device.h>
  4. struct request_queue;
  5. struct scsi_cmnd;
  6. struct scsi_device;
  7. struct scsi_host_template;
  8. struct Scsi_Host;
  9. struct scsi_nl_hdr;
  10. /*
  11. * Scsi Error Handler Flags
  12. */
  13. #define SCSI_EH_CANCEL_CMD 0x0001 /* Cancel this cmd */
  14. #define SCSI_SENSE_VALID(scmd) \
  15. (((scmd)->sense_buffer[0] & 0x70) == 0x70)
  16. /* hosts.c */
  17. extern int scsi_init_hosts(void);
  18. extern void scsi_exit_hosts(void);
  19. /* scsi.c */
  20. extern int scsi_dispatch_cmd(struct scsi_cmnd *cmd);
  21. extern int scsi_setup_command_freelist(struct Scsi_Host *shost);
  22. extern void scsi_destroy_command_freelist(struct Scsi_Host *shost);
  23. extern void __scsi_done(struct scsi_cmnd *cmd);
  24. #ifdef CONFIG_SCSI_LOGGING
  25. void scsi_log_send(struct scsi_cmnd *cmd);
  26. void scsi_log_completion(struct scsi_cmnd *cmd, int disposition);
  27. #else
  28. static inline void scsi_log_send(struct scsi_cmnd *cmd)
  29. { };
  30. static inline void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
  31. { };
  32. #endif
  33. /* scsi_scan.c */
  34. int scsi_complete_async_scans(void);
  35. /* scsi_devinfo.c */
  36. extern int scsi_get_device_flags(struct scsi_device *sdev,
  37. const unsigned char *vendor,
  38. const unsigned char *model);
  39. extern int __init scsi_init_devinfo(void);
  40. extern void scsi_exit_devinfo(void);
  41. /* scsi_error.c */
  42. extern void scsi_add_timer(struct scsi_cmnd *, int,
  43. void (*)(struct scsi_cmnd *));
  44. extern int scsi_delete_timer(struct scsi_cmnd *);
  45. extern void scsi_times_out(struct scsi_cmnd *cmd);
  46. extern int scsi_error_handler(void *host);
  47. extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
  48. extern void scsi_eh_wakeup(struct Scsi_Host *shost);
  49. extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
  50. void scsi_eh_ready_devs(struct Scsi_Host *shost,
  51. struct list_head *work_q,
  52. struct list_head *done_q);
  53. int scsi_eh_get_sense(struct list_head *work_q,
  54. struct list_head *done_q);
  55. /* scsi_lib.c */
  56. extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
  57. extern void scsi_device_unbusy(struct scsi_device *sdev);
  58. extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
  59. extern void scsi_next_command(struct scsi_cmnd *cmd);
  60. extern void scsi_run_host_queues(struct Scsi_Host *shost);
  61. extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
  62. extern void scsi_free_queue(struct request_queue *q);
  63. extern int scsi_init_queue(void);
  64. extern void scsi_exit_queue(void);
  65. /* scsi_proc.c */
  66. #ifdef CONFIG_SCSI_PROC_FS
  67. extern void scsi_proc_hostdir_add(struct scsi_host_template *);
  68. extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
  69. extern void scsi_proc_host_add(struct Scsi_Host *);
  70. extern void scsi_proc_host_rm(struct Scsi_Host *);
  71. extern int scsi_init_procfs(void);
  72. extern void scsi_exit_procfs(void);
  73. #else
  74. # define scsi_proc_hostdir_add(sht) do { } while (0)
  75. # define scsi_proc_hostdir_rm(sht) do { } while (0)
  76. # define scsi_proc_host_add(shost) do { } while (0)
  77. # define scsi_proc_host_rm(shost) do { } while (0)
  78. # define scsi_init_procfs() (0)
  79. # define scsi_exit_procfs() do { } while (0)
  80. #endif /* CONFIG_PROC_FS */
  81. /* scsi_scan.c */
  82. extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
  83. unsigned int, unsigned int, int);
  84. extern void scsi_forget_host(struct Scsi_Host *);
  85. extern void scsi_rescan_device(struct device *);
  86. /* scsi_sysctl.c */
  87. #ifdef CONFIG_SYSCTL
  88. extern int scsi_init_sysctl(void);
  89. extern void scsi_exit_sysctl(void);
  90. #else
  91. # define scsi_init_sysctl() (0)
  92. # define scsi_exit_sysctl() do { } while (0)
  93. #endif /* CONFIG_SYSCTL */
  94. /* scsi_sysfs.c */
  95. extern int scsi_sysfs_add_sdev(struct scsi_device *);
  96. extern int scsi_sysfs_add_host(struct Scsi_Host *);
  97. extern int scsi_sysfs_register(void);
  98. extern void scsi_sysfs_unregister(void);
  99. extern void scsi_sysfs_device_initialize(struct scsi_device *);
  100. extern int scsi_sysfs_target_initialize(struct scsi_device *);
  101. extern struct scsi_transport_template blank_transport_template;
  102. extern void __scsi_remove_device(struct scsi_device *);
  103. extern struct bus_type scsi_bus_type;
  104. /* scsi_netlink.c */
  105. #ifdef CONFIG_SCSI_NETLINK
  106. extern void scsi_netlink_init(void);
  107. extern void scsi_netlink_exit(void);
  108. extern struct sock *scsi_nl_sock;
  109. #else
  110. static inline void scsi_netlink_init(void) {}
  111. static inline void scsi_netlink_exit(void) {}
  112. #endif
  113. /*
  114. * internal scsi timeout functions: for use by mid-layer and transport
  115. * classes.
  116. */
  117. #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */
  118. extern int scsi_internal_device_block(struct scsi_device *sdev);
  119. extern int scsi_internal_device_unblock(struct scsi_device *sdev);
  120. #endif /* _SCSI_PRIV_H */