This source file includes following definitions.
- scsi_transport_reserve_target
- scsi_transport_reserve_device
- scsi_transport_target_data
- scsi_transport_device_data
1
2
3
4
5
6
7 #ifndef SCSI_TRANSPORT_H
8 #define SCSI_TRANSPORT_H
9
10 #include <linux/transport_class.h>
11 #include <linux/blkdev.h>
12 #include <linux/bug.h>
13 #include <scsi/scsi_host.h>
14 #include <scsi/scsi_device.h>
15
16 struct scsi_transport_template {
17
18 struct transport_container host_attrs;
19 struct transport_container target_attrs;
20 struct transport_container device_attrs;
21
22
23
24
25 int (*user_scan)(struct Scsi_Host *, uint, uint, u64);
26
27
28
29
30 int device_size;
31 int device_private_offset;
32 int target_size;
33 int target_private_offset;
34 int host_size;
35
36
37
38
39
40 unsigned int create_work_queue : 1;
41
42
43
44
45 void (* eh_strategy_handler)(struct Scsi_Host *);
46 };
47
48 #define transport_class_to_shost(tc) \
49 dev_to_shost((tc)->parent)
50
51
52
53
54
55
56 static inline void
57 scsi_transport_reserve_target(struct scsi_transport_template * t, int space)
58 {
59 BUG_ON(t->target_private_offset != 0);
60 t->target_private_offset = ALIGN(t->target_size, sizeof(void *));
61 t->target_size = t->target_private_offset + space;
62 }
63 static inline void
64 scsi_transport_reserve_device(struct scsi_transport_template * t, int space)
65 {
66 BUG_ON(t->device_private_offset != 0);
67 t->device_private_offset = ALIGN(t->device_size, sizeof(void *));
68 t->device_size = t->device_private_offset + space;
69 }
70 static inline void *
71 scsi_transport_target_data(struct scsi_target *starget)
72 {
73 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
74 return (u8 *)starget->starget_data
75 + shost->transportt->target_private_offset;
76
77 }
78 static inline void *
79 scsi_transport_device_data(struct scsi_device *sdev)
80 {
81 struct Scsi_Host *shost = sdev->host;
82 return (u8 *)sdev->sdev_data
83 + shost->transportt->device_private_offset;
84 }
85
86 void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q);
87
88 #endif