~ubuntu-branches/ubuntu/hardy/open-iscsi/hardy-updates

« back to all changes in this revision

Viewing changes to kernel/2.6.12-compat.patch

  • Committer: Bazaar Package Importer
  • Author(s): Martin Zobel-Helas
  • Date: 2006-12-03 16:54:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061203165421-xhttz5j4l9sowg8u
Tags: 2.0.730-0.2
upload to unstable, as no new bugs arised.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
diff -Naurp open-iscsi.diffbase/kernel/iscsi_compat.h open-iscsi.test/kernel/iscsi_compat.h
2
 
--- open-iscsi.diffbase/kernel/iscsi_compat.h   1969-12-31 18:00:00.000000000 -0600
3
 
+++ open-iscsi.test/kernel/iscsi_compat.h       2006-01-16 16:25:56.000000000 -0600
4
 
@@ -0,0 +1,55 @@
5
 
+/*
6
 
+ * compat crap for older kernels.
7
 
+ * do not send to linux-scsi
8
 
+ */
9
 
+#include <linux/version.h>
10
 
+#include <linux/kernel.h>
11
 
+#include <scsi/scsi.h>
12
 
+
13
 
+#ifndef DEFINE_MUTEX
14
 
+
15
 
+/* mutex changes from 2.6.16-rc1 and up */
16
 
+#define DEFINE_MUTEX DECLARE_MUTEX
17
 
+#define mutex_lock down
18
 
+#define mutex_unlock up
19
 
+#define mutex semaphore
20
 
+#define mutex_init init_MUTEX
21
 
+#endif
22
 
+
23
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,12)
24
 
+
25
 
+void int_to_scsilun(unsigned int lun, struct scsi_lun *scsilun)
26
 
+{
27
 
+       int i;
28
 
+
29
 
+       memset(scsilun->scsi_lun, 0, sizeof(scsilun->scsi_lun));
30
 
+
31
 
+       for (i = 0; i < sizeof(lun); i += 2) {
32
 
+               scsilun->scsi_lun[i] = (lun >> 8) & 0xFF;
33
 
+               scsilun->scsi_lun[i+1] = lun & 0xFF;
34
 
+               lun = lun >> 16;
35
 
+       }
36
 
+}
37
 
+
38
 
+#define __nlmsg_put(skb, daemon_pid, seq, type, len, flags) \
39
 
+       __nlmsg_put(skb, daemon_pid, 0, 0, len)
40
 
+
41
 
+#endif
42
 
+
43
 
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
44
 
+
45
 
+#define netlink_kernel_create(uint, groups, input, mod) \
46
 
+       netlink_kernel_create(uint, input)
47
 
+
48
 
+#define gfp_t unsigned
49
 
+
50
 
+void *kzalloc(size_t size, gfp_t flags)
51
 
+{
52
 
+       void *ret = kmalloc(size, flags);
53
 
+       if (ret)
54
 
+               memset(ret, 0, size);
55
 
+       return ret;
56
 
+}
57
 
+
58
 
+#endif
59
 
+
60
 
diff -Naurp open-iscsi.diffbase/kernel/iscsi_tcp.c open-iscsi.test/kernel/iscsi_tcp.c
61
 
--- open-iscsi.diffbase/kernel/iscsi_tcp.c      2006-01-16 15:38:52.000000000 -0600
62
 
+++ open-iscsi.test/kernel/iscsi_tcp.c  2006-01-16 16:10:42.000000000 -0600
63
 
@@ -33,7 +33,6 @@
64
 
 #include <linux/delay.h>
65
 
 #include <linux/kfifo.h>
66
 
 #include <linux/scatterlist.h>
67
 
-#include <linux/mutex.h>
68
 
 #include <net/tcp.h>
69
 
 #include <scsi/scsi_cmnd.h>
70
 
 #include <scsi/scsi_device.h>
71
 
@@ -44,6 +43,7 @@
72
 
 #include <scsi/scsi.h>
73
 
 #include "scsi_transport_iscsi.h"
74
 
 
75
 
+#include "iscsi_compat.h"
76
 
 #include "iscsi_tcp.h"
77
 
 
78
 
 MODULE_AUTHOR("Dmitry Yusupov <dmitry_yus@yahoo.com>, "
79
 
@@ -2948,11 +2948,13 @@ iscsi_eh_host_reset(struct scsi_cmnd *sc
80
 
        struct iscsi_conn *conn = ctask->conn;
81
 
        struct iscsi_session *session = conn->session;
82
 
 
83
 
+       spin_unlock_irq(session->host->host_lock);
84
 
        spin_lock_bh(&session->lock);
85
 
        if (session->state == ISCSI_STATE_TERMINATE) {
86
 
                debug_scsi("failing host reset: session terminated "
87
 
                           "[CID %d age %d]", conn->id, session->age);
88
 
                spin_unlock_bh(&session->lock);
89
 
+               spin_lock_irq(session->host->host_lock);
90
 
                return FAILED;
91
 
        }
92
 
        spin_unlock_bh(&session->lock);
93
 
@@ -2962,6 +2964,7 @@ iscsi_eh_host_reset(struct scsi_cmnd *sc
94
 
                   session->age);
95
 
        iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
96
 
 
97
 
+       spin_lock_irq(session->host->host_lock);
98
 
        return SUCCESS;
99
 
 }
100
 
 
101
 
@@ -2996,6 +2999,7 @@ iscsi_eh_abort(struct scsi_cmnd *sc)
102
 
        conn->eh_abort_cnt++;
103
 
        debug_scsi("aborting [sc %lx itt 0x%x]\n", (long)sc, ctask->itt);
104
 
 
105
 
+       spin_unlock_irq(session->host->host_lock);
106
 
        /*
107
 
         * two cases for ERL=0 here:
108
 
         *
109
 
@@ -3164,6 +3168,8 @@ exit:
110
 
                write_unlock_bh(&sk->sk_callback_lock);
111
 
        }
112
 
        mutex_unlock(&conn->xmitmutex);
113
 
+
114
 
+       spin_lock_irq(session->host->host_lock);
115
 
        return rc;
116
 
 }
117
 
 
118
 
diff -Naurp open-iscsi.diffbase/kernel/scsi_transport_iscsi.c open-iscsi.test/kernel/scsi_transport_iscsi.c
119
 
--- open-iscsi.diffbase/kernel/scsi_transport_iscsi.c   2006-01-16 15:38:52.000000000 -0600
120
 
+++ open-iscsi.test/kernel/scsi_transport_iscsi.c       2006-01-16 15:54:47.000000000 -0600
121
 
@@ -22,7 +22,6 @@
122
 
  */
123
 
 #include <linux/module.h>
124
 
 #include <linux/mempool.h>
125
 
-#include <linux/mutex.h>
126
 
 #include <net/tcp.h>
127
 
 #include <scsi/scsi.h>
128
 
 #include <scsi/scsi_host.h>
129
 
@@ -30,6 +29,7 @@
130
 
 #include <scsi/scsi_transport.h>
131
 
 #include "scsi_transport_iscsi.h"
132
 
 #include "iscsi_if.h"
133
 
+#include "iscsi_compat.h"
134
 
 
135
 
 #define ISCSI_SESSION_ATTRS 8
136
 
 #define ISCSI_CONN_ATTRS 6