]> git.pld-linux.org Git - packages/lin_tape.git/blame - linux-4.11.patch
- rel 3
[packages/lin_tape.git] / linux-4.11.patch
CommitLineData
997e051e
JR
1diff -ur lin_tape-3.0.18/intercept.c lin_tape-3.0.18-4.11/intercept.c
2--- lin_tape-3.0.18/intercept.c 2017-02-23 19:14:41.000000000 +0100
3+++ lin_tape-3.0.18-4.11/intercept.c 2017-05-10 00:35:27.637366919 +0200
4@@ -37,6 +37,9 @@
5 #include <linux/init.h>
6 #include <linux/idr.h>
7 #include <scsi/scsi_driver.h>
8+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
9+#include <scsi/scsi_transport.h>
10+#endif
11
12 #include "scsi.h"
13 #include "pfo.h"
14@@ -1362,7 +1365,12 @@
15 if (pdev->fdev_num != -1) {
16 /* Only for fo devices */
17 /* This 'if' must match the one above in create unique */
18+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
19+ sdev->request_queue = blk_alloc_queue_node(GFP_KERNEL, NUMA_NO_NODE);
20+ __scsi_init_queue(sdev->host, sdev->request_queue);
300a759d 21+#else
997e051e 22 sdev->request_queue = __scsi_alloc_queue(sdev->host, NULL);
300a759d 23+#endif
997e051e 24 }
300a759d 25
997e051e
JR
26 /* set device hierachy so the new dummy dev
27diff -ur lin_tape-3.0.18/lin_tape_ioctl_tape.c lin_tape-3.0.18-4.11/lin_tape_ioctl_tape.c
28--- lin_tape-3.0.18/lin_tape_ioctl_tape.c 2017-05-10 00:36:01.952285733 +0200
29+++ lin_tape-3.0.18-4.11/lin_tape_ioctl_tape.c 2017-05-09 21:45:14.236233622 +0200
300a759d
JR
30@@ -6464,7 +6464,11 @@
31 } /* if */
32
33 tmp_rq = (void*)sdev->request_queue;
34+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
35+ scsi_req_init(req);
36+#else
37 req->cmd_type = REQ_TYPE_BLOCK_PC;
38+#endif
65107090 39 #ifdef REQ_QUIET
300a759d
JR
40 req->cmd_flags |= REQ_QUIET;
41 #else
65107090 42@@ -6536,15 +6540,27 @@
300a759d
JR
43 bio = req->bio;
44 } /* if */
45
46+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
47+ scsi_req(req)->cmd_len = COMMAND_SIZE(cdb[0]);
48+ memset(scsi_req(req)->cmd, '\0', MAX_CDB_SIZE);
49+ memcpy(scsi_req(req)->cmd, cdb, scsi_req(req)->cmd_len);
50+ scsi_req(req)->sense = sense_data;
51+ scsi_req(req)->sense_len = 0;
52+#else
53 req->cmd_len = COMMAND_SIZE(cdb[0]);
54 memset(req->cmd, '\0', MAX_CDB_SIZE);
55 memcpy(req->cmd, cdb, req->cmd_len);
56 req->sense = sense_data;
57 req->sense_len = 0;
58+#endif
59 req->timeout = timeout;
60 req->retries = 0;
300a759d 61 blk_execute_rq(req->q, NULL, req, 1);
300a759d
JR
62+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
63+ *resid = scsi_req(req)->resid_len;
64+#else
65 *resid = req->resid_len;
66+#endif
67 status_code = req->errors;
68
69 if(buf_len && !use_sg) {
997e051e
JR
70diff -ur lin_tape-3.0.18/lin_tape_tape.h lin_tape-3.0.18-4.11/lin_tape_tape.h
71--- lin_tape-3.0.18/lin_tape_tape.h 2017-02-23 19:14:41.000000000 +0100
72+++ lin_tape-3.0.18-4.11/lin_tape_tape.h 2017-05-09 21:45:14.236233622 +0200
73@@ -85,7 +85,11 @@
74 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
75 #define KOBJ_CT(kobj) ((kobj) ? atomic_read(&(kobj)->refcount) : 0)
76 #else
77+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
78 #define KOBJ_CT(kobj) ((kobj) ? atomic_read(&(kobj)->kref.refcount) : 0)
79+#else
80+#define KOBJ_CT(kobj) ((kobj) ? kref_read(&(kobj)->kref) : 0)
81+#endif
82 #endif
83
84 /* global definitions */
85diff -ur lin_tape-3.0.18/lower.c lin_tape-3.0.18-4.11/lower.c
86--- lin_tape-3.0.18/lower.c 2017-02-23 19:14:41.000000000 +0100
87+++ lin_tape-3.0.18-4.11/lower.c 2017-05-10 00:21:19.106042388 +0200
88@@ -69,7 +69,11 @@
89 /* Local function prototypes */
90 static int lower_scsi_execute(struct scsi_device *sdev,
91 struct apfo_scsi_command *pfo_cmd,
92+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
93+ unsigned char *local_raw_sense, struct scsi_sense_hdr *sshdr);
94+#else
95 unsigned char *local_raw_sense);
96+#endif
97
98 /** Look at the errors from the SCSI command,
99 * translate them to OS independent values.
100@@ -267,11 +271,20 @@
101 /* SCSI Command from decide code */
102 result = scsi_execute(sdev, pfo_cmd->scsi_cmd,
103 pfo_cmd->data_direction, pfo_cmd->buffer,
104+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
105 pfo_cmd->bufflen, local_raw_sense, pfo_cmd->timeout,
106 pfo_cmd->retries, pfo_cmd->flags, &pfo_cmd->resid_len);
107+#else
108+ pfo_cmd->bufflen, local_raw_sense, &local_sense_data, pfo_cmd->timeout,
109+ pfo_cmd->retries, pfo_cmd->flags, 0, &pfo_cmd->resid_len);
110+#endif
111 } else {
112 /* SCSI Command from user space */
113+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
114 result = lower_scsi_execute(sdev, pfo_cmd, local_raw_sense);
115+#else
116+ result = lower_scsi_execute(sdev, pfo_cmd, local_raw_sense, &local_sense_data);
117+#endif
118 }
119 /* Release this path */
120 scsi_device_put(sdev);
121@@ -440,7 +453,11 @@
122 */
123 static int lower_scsi_execute(struct scsi_device *sdev,
124 struct apfo_scsi_command *pfo_cmd,
125+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
126+ unsigned char *local_raw_sense, struct scsi_sense_hdr *sshdr) {
127+#else
128 unsigned char *local_raw_sense) {
129+#endif
130
131 int err = 0;
132 struct request *rq;
133@@ -452,7 +469,11 @@
134 return DRIVER_ERROR << 24;
135 }
136
137+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
138+ scsi_req_init(rq);
139+#else
140 rq->cmd_type = REQ_TYPE_BLOCK_PC;
141+#endif
142 rq->cmd_flags |= pfo_cmd->flags;
143
144 if ((pfo_cmd->bufflen > 0) && (pfo_cmd->data_direction != DMA_NONE)) {
145@@ -533,11 +554,19 @@
146 }
147 }
148
149+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
150+ scsi_req(rq)->cmd_len = pfo_cmd->cmd_len;
151+ memset(scsi_req(rq)->cmd, 0, BLK_MAX_CDB);
152+ memcpy(scsi_req(rq)->cmd, pfo_cmd->scsi_cmd, pfo_cmd->cmd_len);
153+ scsi_req(rq)->sense = local_raw_sense;
154+ scsi_req(rq)->sense_len = 0;
155+#else
156 rq->cmd_len = pfo_cmd->cmd_len;
157 memset(rq->cmd, 0, BLK_MAX_CDB);
158 memcpy(rq->cmd, pfo_cmd->scsi_cmd, pfo_cmd->cmd_len);
159 rq->sense = local_raw_sense;
160 rq->sense_len = 0;
161+#endif
162 rq->timeout = pfo_cmd->timeout;
163 rq->retries = pfo_cmd->retries;
164 rq->end_io_data = pfo_cmd;
165@@ -551,8 +580,15 @@
166 DBG_ERROR("unmap returns: %d\n", err);
167 }
168 }
169+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
170+ pfo_cmd->resid_len = scsi_req(rq)->resid_len;
171+ pfo_cmd->sense_len = scsi_req(rq)->sense_len;
172+ if (sshdr)
173+ scsi_normalize_sense(scsi_req(rq)->sense, scsi_req(rq)->sense_len, sshdr);
174+#else
175 pfo_cmd->resid_len = rq->resid_len;
176 pfo_cmd->sense_len = rq->sense_len;
177+#endif
178 pfo_cmd->errors = rq->errors;
179
180 blk_put_request(rq);
This page took 0.08428 seconds and 4 git commands to generate.