aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-05-24 13:06:38 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-05-26 11:27:53 -0400
commita283bd37d00e92e8874ca6325ae071691d4db388 (patch)
tree4c436d59fc326e3545c575a88b92fd31ace841a5 /include/scsi
parent631e8a1398ce4cfef8b30678d51daf0c64313a09 (diff)
[SCSI] Add target alloc/destroy callbacks to the host template
This gives the HBA driver notice when a target is created and destroyed to allow it to manage its own target based allocations accordingly. This is a much reduced verson of the original patch sent in by James.Smart@Emulex.com Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_device.h4
-rw-r--r--include/scsi/scsi_host.h25
2 files changed, 28 insertions, 1 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index c018020d9160..63c91dd85ca1 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -154,7 +154,9 @@ struct scsi_target {
154 unsigned int id; /* target id ... replace 154 unsigned int id; /* target id ... replace
155 * scsi_device.id eventually */ 155 * scsi_device.id eventually */
156 unsigned long create:1; /* signal that it needs to be added */ 156 unsigned long create:1; /* signal that it needs to be added */
157 unsigned long starget_data[0]; 157 void *hostdata; /* available to low-level driver */
158 unsigned long starget_data[0]; /* for the transport */
159 /* starget_data must be the last element!!!! */
158} __attribute__((aligned(sizeof(unsigned long)))); 160} __attribute__((aligned(sizeof(unsigned long))));
159 161
160#define to_scsi_target(d) container_of(d, struct scsi_target, dev) 162#define to_scsi_target(d) container_of(d, struct scsi_target, dev)
diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
index 1cee1e100943..db9914adeac9 100644
--- a/include/scsi/scsi_host.h
+++ b/include/scsi/scsi_host.h
@@ -10,6 +10,7 @@ struct block_device;
10struct module; 10struct module;
11struct scsi_cmnd; 11struct scsi_cmnd;
12struct scsi_device; 12struct scsi_device;
13struct scsi_target;
13struct Scsi_Host; 14struct Scsi_Host;
14struct scsi_host_cmd_pool; 15struct scsi_host_cmd_pool;
15struct scsi_transport_template; 16struct scsi_transport_template;
@@ -228,6 +229,30 @@ struct scsi_host_template {
228 void (* slave_destroy)(struct scsi_device *); 229 void (* slave_destroy)(struct scsi_device *);
229 230
230 /* 231 /*
232 * Before the mid layer attempts to scan for a new device attached
233 * to a target where no target currently exists, it will call this
234 * entry in your driver. Should your driver need to allocate any
235 * structs or perform any other init items in order to send commands
236 * to a currently unused target, then this is where you can perform
237 * those allocations.
238 *
239 * Return values: 0 on success, non-0 on failure
240 *
241 * Status: OPTIONAL
242 */
243 int (* target_alloc)(struct scsi_target *);
244
245 /*
246 * Immediately prior to deallocating the target structure, and
247 * after all activity to attached scsi devices has ceased, the
248 * midlayer calls this point so that the driver may deallocate
249 * and terminate any references to the target.
250 *
251 * Status: OPTIONAL
252 */
253 void (* target_destroy)(struct scsi_target *);
254
255 /*
231 * fill in this function to allow the queue depth of this host 256 * fill in this function to allow the queue depth of this host
232 * to be changeable (on a per device basis). returns either 257 * to be changeable (on a per device basis). returns either
233 * the current queue depth setting (may be different from what 258 * the current queue depth setting (may be different from what