0001
0002
0003
0004
0005
0006
0007 #ifndef SCSI_TRANSPORT_H
0008 #define SCSI_TRANSPORT_H
0009
0010 #include <linux/transport_class.h>
0011 #include <linux/blkdev.h>
0012 #include <linux/bug.h>
0013 #include <scsi/scsi_host.h>
0014 #include <scsi/scsi_device.h>
0015
0016 struct scsi_transport_template {
0017
0018 struct transport_container host_attrs;
0019 struct transport_container target_attrs;
0020 struct transport_container device_attrs;
0021
0022
0023
0024
0025 int (*user_scan)(struct Scsi_Host *, uint, uint, u64);
0026
0027
0028
0029
0030 int device_size;
0031 int device_private_offset;
0032 int target_size;
0033 int target_private_offset;
0034 int host_size;
0035
0036
0037
0038
0039
0040 unsigned int create_work_queue : 1;
0041
0042
0043
0044
0045 void (* eh_strategy_handler)(struct Scsi_Host *);
0046 };
0047
0048 #define transport_class_to_shost(tc) \
0049 dev_to_shost((tc)->parent)
0050
0051
0052
0053
0054
0055
0056 static inline void
0057 scsi_transport_reserve_target(struct scsi_transport_template * t, int space)
0058 {
0059 BUG_ON(t->target_private_offset != 0);
0060 t->target_private_offset = ALIGN(t->target_size, sizeof(void *));
0061 t->target_size = t->target_private_offset + space;
0062 }
0063 static inline void
0064 scsi_transport_reserve_device(struct scsi_transport_template * t, int space)
0065 {
0066 BUG_ON(t->device_private_offset != 0);
0067 t->device_private_offset = ALIGN(t->device_size, sizeof(void *));
0068 t->device_size = t->device_private_offset + space;
0069 }
0070 static inline void *
0071 scsi_transport_target_data(struct scsi_target *starget)
0072 {
0073 struct Scsi_Host *shost = dev_to_shost(&starget->dev);
0074 return (u8 *)starget->starget_data
0075 + shost->transportt->target_private_offset;
0076
0077 }
0078 static inline void *
0079 scsi_transport_device_data(struct scsi_device *sdev)
0080 {
0081 struct Scsi_Host *shost = sdev->host;
0082 return (u8 *)sdev->sdev_data
0083 + shost->transportt->device_private_offset;
0084 }
0085
0086 void __scsi_init_queue(struct Scsi_Host *shost, struct request_queue *q);
0087
0088 #endif