[PATCH] don't mess with file in scsi_nonblockable_ioctl()
[safe/jmp/linux-2.6] / include / scsi / libiscsi.h
index 176353c..61e53f1 100644 (file)
@@ -52,9 +52,7 @@ struct device;
 #endif
 
 #define ISCSI_DEF_XMIT_CMDS_MAX        128     /* must be power of 2 */
-#define ISCSI_MGMT_CMDS_MAX    16      /* must be power of 2 */
-
-#define ISCSI_MGMT_ITT_OFFSET  0xa00
+#define ISCSI_MGMT_CMDS_MAX    15
 
 #define ISCSI_DEF_CMD_PER_LUN          32
 #define ISCSI_MAX_CMD_PER_LUN          128
@@ -72,7 +70,10 @@ enum {
 /* Connection suspend "bit" */
 #define ISCSI_SUSPEND_BIT              1
 
-#define ISCSI_ITT_MASK                 (0xfff)
+#define ISCSI_ITT_MASK                 (0x1fff)
+#define ISCSI_TOTAL_CMDS_MAX           4096
+/* this must be a power of two greater than ISCSI_MGMT_CMDS_MAX */
+#define ISCSI_TOTAL_CMDS_MIN           16
 #define ISCSI_AGE_SHIFT                        28
 #define ISCSI_AGE_MASK                 (0xf << ISCSI_AGE_SHIFT)
 
@@ -138,11 +139,6 @@ struct iscsi_conn {
        void                    *dd_data;       /* iscsi_transport data */
        struct iscsi_session    *session;       /* parent session */
        /*
-        * LLDs should set this lock. It protects the transport recv
-        * code
-        */
-       rwlock_t                *recv_lock;
-       /*
         * conn_stop() flag: stop to recover, stop to terminate
         */
         int                    stop_stage;
@@ -270,6 +266,8 @@ struct iscsi_session {
        char                    *password;
        char                    *password_in;
        char                    *targetname;
+       char                    *ifacename;
+       char                    *initiatorname;
        /* control data */
        struct iscsi_transport  *tt;
        struct Scsi_Host        *host;
@@ -289,6 +287,11 @@ struct iscsi_session {
        struct iscsi_pool       cmdpool;        /* PDU's pool */
 };
 
+enum {
+       ISCSI_HOST_SETUP,
+       ISCSI_HOST_REMOVED,
+};
+
 struct iscsi_host {
        char                    *initiatorname;
        /* hw address or netdev iscsi connection is bound to */
@@ -297,6 +300,12 @@ struct iscsi_host {
        /* local address */
        int                     local_port;
        char                    local_address[ISCSI_ADDRESS_BUF_LEN];
+
+       wait_queue_head_t       session_removal_wq;
+       /* protects sessions and state */
+       spinlock_t              lock;
+       int                     num_sessions;
+       int                     state;
 };
 
 /*
@@ -304,7 +313,7 @@ struct iscsi_host {
  */
 extern int iscsi_change_queue_depth(struct scsi_device *sdev, int depth);
 extern int iscsi_eh_abort(struct scsi_cmnd *sc);
-extern int iscsi_eh_host_reset(struct scsi_cmnd *sc);
+extern int iscsi_eh_target_reset(struct scsi_cmnd *sc);
 extern int iscsi_eh_device_reset(struct scsi_cmnd *sc);
 extern int iscsi_queuecommand(struct scsi_cmnd *sc,
                              void (*done)(struct scsi_cmnd *));
@@ -331,7 +340,7 @@ extern void iscsi_host_free(struct Scsi_Host *shost);
  */
 extern struct iscsi_cls_session *
 iscsi_session_setup(struct iscsi_transport *, struct Scsi_Host *shost,
-                   uint16_t, int, uint32_t);
+                   uint16_t, int, uint32_t, unsigned int);
 extern void iscsi_session_teardown(struct iscsi_cls_session *);
 extern void iscsi_session_recovery_timedout(struct iscsi_cls_session *);
 extern int iscsi_set_param(struct iscsi_cls_conn *cls_conn,
@@ -353,6 +362,8 @@ extern void iscsi_conn_stop(struct iscsi_cls_conn *, int);
 extern int iscsi_conn_bind(struct iscsi_cls_session *, struct iscsi_cls_conn *,
                           int);
 extern void iscsi_conn_failure(struct iscsi_conn *conn, enum iscsi_err err);
+extern void iscsi_session_failure(struct iscsi_cls_session *cls_session,
+                                 enum iscsi_err err);
 extern int iscsi_conn_get_param(struct iscsi_cls_conn *cls_conn,
                                enum iscsi_param param, char *buf);
 extern void iscsi_suspend_tx(struct iscsi_conn *conn);
@@ -371,10 +382,13 @@ extern int iscsi_conn_send_pdu(struct iscsi_cls_conn *, struct iscsi_hdr *,
                                char *, uint32_t);
 extern int iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
                              char *, int);
+extern int __iscsi_complete_pdu(struct iscsi_conn *, struct iscsi_hdr *,
+                               char *, int);
 extern int iscsi_verify_itt(struct iscsi_conn *, itt_t);
 extern struct iscsi_task *iscsi_itt_to_ctask(struct iscsi_conn *, itt_t);
 extern void iscsi_requeue_task(struct iscsi_task *task);
 extern void iscsi_put_task(struct iscsi_task *task);
+extern void __iscsi_get_task(struct iscsi_task *task);
 
 /*
  * generic helpers