scsi_priv.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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_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 enum blk_eh_timer_return scsi_times_out(struct request *req);
  43. extern int scsi_error_handler(void *host);
  44. extern int scsi_decide_disposition(struct scsi_cmnd *cmd);
  45. extern void scsi_eh_wakeup(struct Scsi_Host *shost);
  46. extern int scsi_eh_scmd_add(struct scsi_cmnd *, int);
  47. void scsi_eh_ready_devs(struct Scsi_Host *shost,
  48. struct list_head *work_q,
  49. struct list_head *done_q);
  50. int scsi_eh_get_sense(struct list_head *work_q,
  51. struct list_head *done_q);
  52. /* scsi_lib.c */
  53. extern int scsi_maybe_unblock_host(struct scsi_device *sdev);
  54. extern void scsi_device_unbusy(struct scsi_device *sdev);
  55. extern int scsi_queue_insert(struct scsi_cmnd *cmd, int reason);
  56. extern void scsi_next_command(struct scsi_cmnd *cmd);
  57. extern void scsi_io_completion(struct scsi_cmnd *, unsigned int);
  58. extern void scsi_run_host_queues(struct Scsi_Host *shost);
  59. extern struct request_queue *scsi_alloc_queue(struct scsi_device *sdev);
  60. extern void scsi_free_queue(struct request_queue *q);
  61. extern int scsi_init_queue(void);
  62. extern void scsi_exit_queue(void);
  63. struct request_queue;
  64. struct request;
  65. extern int scsi_prep_fn(struct request_queue *, struct request *);
  66. extern struct kmem_cache *scsi_sdb_cache;
  67. /* scsi_proc.c */
  68. #ifdef CONFIG_SCSI_PROC_FS
  69. extern void scsi_proc_hostdir_add(struct scsi_host_template *);
  70. extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
  71. extern void scsi_proc_host_add(struct Scsi_Host *);
  72. extern void scsi_proc_host_rm(struct Scsi_Host *);
  73. extern int scsi_init_procfs(void);
  74. extern void scsi_exit_procfs(void);
  75. #else
  76. # define scsi_proc_hostdir_add(sht) do { } while (0)
  77. # define scsi_proc_hostdir_rm(sht) do { } while (0)
  78. # define scsi_proc_host_add(shost) do { } while (0)
  79. # define scsi_proc_host_rm(shost) do { } while (0)
  80. # define scsi_init_procfs() (0)
  81. # define scsi_exit_procfs() do { } while (0)
  82. #endif /* CONFIG_PROC_FS */
  83. /* scsi_scan.c */
  84. extern int scsi_scan_host_selected(struct Scsi_Host *, unsigned int,
  85. unsigned int, unsigned int, int);
  86. extern void scsi_forget_host(struct Scsi_Host *);
  87. extern void scsi_rescan_device(struct device *);
  88. /* scsi_sysctl.c */
  89. #ifdef CONFIG_SYSCTL
  90. extern int scsi_init_sysctl(void);
  91. extern void scsi_exit_sysctl(void);
  92. #else
  93. # define scsi_init_sysctl() (0)
  94. # define scsi_exit_sysctl() do { } while (0)
  95. #endif /* CONFIG_SYSCTL */
  96. /* scsi_sysfs.c */
  97. extern int scsi_sysfs_add_sdev(struct scsi_device *);
  98. extern int scsi_sysfs_add_host(struct Scsi_Host *);
  99. extern int scsi_sysfs_register(void);
  100. extern void scsi_sysfs_unregister(void);
  101. extern void scsi_sysfs_device_initialize(struct scsi_device *);
  102. extern int scsi_sysfs_target_initialize(struct scsi_device *);
  103. extern struct scsi_transport_template blank_transport_template;
  104. extern void __scsi_remove_device(struct scsi_device *);
  105. extern struct bus_type scsi_bus_type;
  106. extern struct attribute_group *scsi_sysfs_shost_attr_groups[];
  107. /* scsi_netlink.c */
  108. #ifdef CONFIG_SCSI_NETLINK
  109. extern void scsi_netlink_init(void);
  110. extern void scsi_netlink_exit(void);
  111. extern struct sock *scsi_nl_sock;
  112. #else
  113. static inline void scsi_netlink_init(void) {}
  114. static inline void scsi_netlink_exit(void) {}
  115. #endif
  116. /*
  117. * internal scsi timeout functions: for use by mid-layer and transport
  118. * classes.
  119. */
  120. #define SCSI_DEVICE_BLOCK_MAX_TIMEOUT 600 /* units in seconds */
  121. extern int scsi_internal_device_block(struct scsi_device *sdev);
  122. extern int scsi_internal_device_unblock(struct scsi_device *sdev);
  123. #endif /* _SCSI_PRIV_H */