]> err.no Git - linux-2.6/blobdiff - include/scsi/scsi_host.h
[PATCH] Serial: Split 8250 port table
[linux-2.6] / include / scsi / scsi_host.h
index 27f2c4e8943ac35941cdbe36c9bd929ced644b79..db9914adeac94b510b5f51a9cde33331f5f93d4d 100644 (file)
@@ -10,6 +10,7 @@ struct block_device;
 struct module;
 struct scsi_cmnd;
 struct scsi_device;
+struct scsi_target;
 struct Scsi_Host;
 struct scsi_host_cmd_pool;
 struct scsi_transport_template;
@@ -227,6 +228,30 @@ struct scsi_host_template {
         */
        void (* slave_destroy)(struct scsi_device *);
 
+       /*
+        * Before the mid layer attempts to scan for a new device attached
+        * to a target where no target currently exists, it will call this
+        * entry in your driver.  Should your driver need to allocate any
+        * structs or perform any other init items in order to send commands
+        * to a currently unused target, then this is where you can perform
+        * those allocations.
+        *
+        * Return values: 0 on success, non-0 on failure
+        *
+        * Status: OPTIONAL
+        */
+       int (* target_alloc)(struct scsi_target *);
+
+       /*
+        * Immediately prior to deallocating the target structure, and
+        * after all activity to attached scsi devices has ceased, the
+        * midlayer calls this point so that the driver may deallocate
+        * and terminate any references to the target.
+        *
+        * Status: OPTIONAL
+        */
+       void (* target_destroy)(struct scsi_target *);
+
        /*
         * fill in this function to allow the queue depth of this host
         * to be changeable (on a per device basis).  returns either
@@ -448,8 +473,14 @@ struct Scsi_Host {
        wait_queue_head_t       host_wait;
        struct scsi_host_template *hostt;
        struct scsi_transport_template *transportt;
-       volatile unsigned short host_busy;   /* commands actually active on low-level */
-       volatile unsigned short host_failed; /* commands that failed. */
+
+       /*
+        * The following two fields are protected with host_lock;
+        * however, eh routines can safely access during eh processing
+        * without acquiring the lock.
+        */
+       unsigned int host_busy;            /* commands actually active on low-level */
+       unsigned int host_failed;          /* commands that failed. */
     
        unsigned short host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */
        int resetting; /* if set, it means that last_reset is a valid value */