1
2
3
4
5
6
7
8
9
10
11
12
13#include <scsi/scsi_device.h>
14
15enum {
16 SCSI_DH_OK = 0,
17
18
19
20 SCSI_DH_DEV_FAILED,
21 SCSI_DH_DEV_TEMP_BUSY,
22 SCSI_DH_DEV_UNSUPP,
23 SCSI_DH_DEVICE_MAX,
24
25
26
27
28 SCSI_DH_NOTCONN = SCSI_DH_DEVICE_MAX + 1,
29 SCSI_DH_CONN_FAILURE,
30 SCSI_DH_TRANSPORT_MAX,
31
32
33
34
35 SCSI_DH_IO = SCSI_DH_TRANSPORT_MAX + 1,
36 SCSI_DH_INVALID_IO,
37 SCSI_DH_RETRY,
38 SCSI_DH_IMM_RETRY,
39 SCSI_DH_TIMED_OUT,
40 SCSI_DH_RES_TEMP_UNAVAIL,
41 SCSI_DH_DEV_OFFLINED,
42 SCSI_DH_NOMEM,
43 SCSI_DH_NOSYS,
44 SCSI_DH_DRIVER_MAX,
45};
46
47typedef void (*activate_complete)(void *, int);
48struct scsi_device_handler {
49
50 struct list_head list;
51
52
53 struct module *module;
54 const char *name;
55 int (*check_sense)(struct scsi_device *, struct scsi_sense_hdr *);
56 int (*attach)(struct scsi_device *);
57 void (*detach)(struct scsi_device *);
58 int (*activate)(struct scsi_device *, activate_complete, void *);
59 blk_status_t (*prep_fn)(struct scsi_device *, struct request *);
60 int (*set_params)(struct scsi_device *, const char *);
61 void (*rescan)(struct scsi_device *);
62};
63
64#ifdef CONFIG_SCSI_DH
65extern int scsi_dh_activate(struct request_queue *, activate_complete, void *);
66extern int scsi_dh_attach(struct request_queue *, const char *);
67extern const char *scsi_dh_attached_handler_name(struct request_queue *, gfp_t);
68extern int scsi_dh_set_params(struct request_queue *, const char *);
69#else
70static inline int scsi_dh_activate(struct request_queue *req,
71 activate_complete fn, void *data)
72{
73 fn(data, 0);
74 return 0;
75}
76static inline int scsi_dh_attach(struct request_queue *req, const char *name)
77{
78 return SCSI_DH_NOSYS;
79}
80static inline const char *scsi_dh_attached_handler_name(struct request_queue *q,
81 gfp_t gfp)
82{
83 return NULL;
84}
85static inline int scsi_dh_set_params(struct request_queue *req, const char *params)
86{
87 return -SCSI_DH_NOSYS;
88}
89#endif
90