scsi_priv.h 4.6 KB

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