1 diff -ur lin_tape-3.0.18/Makefile lin_tape-3.0.18-ifdefs/Makefile
2 --- lin_tape-3.0.18/Makefile 2017-05-09 21:11:32.977092391 +0200
3 +++ lin_tape-3.0.18-ifdefs/Makefile 2017-05-09 21:05:59.610307494 +0200
5 lin_tape-objs := join.o lin_tape_scsi_config.o lin_tape_scsi_tape.o lin_tape_scsi_trace.o \
6 lin_tape_ioctl_tape.o lin_tape_ioctl_changer.o lin_tape_extra_ioctl.o
8 -RHELRELEASE := $(shell [ -f "/etc/redhat-release" ] && echo 1 || echo 0)
9 -ifeq ($(RHELRELEASE), 1)
10 -KERNELDIR ?= /lib/modules/$(shell uname -r)/build
11 -KERNELVER = $(shell uname -r 2>/dev/null|sed "s/[\.-]/_/g"|sed "s/\([0-9]*_[0-9]*_[0-9]*_[0-9]*\).*/\1/")
12 -EXTRA_CFLAGS += -DKERNELVERSION_${KERNELVER}
14 -EXTRA_CFLAGS += -DSLESVERSION
18 EXTRA_CFLAGS += -DSFMPENABLED
20 diff -ur lin_tape-3.0.18/pfo.h lin_tape-3.0.18-ifdefs/pfo.h
21 --- lin_tape-3.0.18/pfo.h 2017-02-23 19:14:41.000000000 +0100
22 +++ lin_tape-3.0.18-ifdefs/pfo.h 2017-05-09 21:06:34.117699008 +0200
24 * will build for various releases of Linux. This is how
25 * we track different versions using ifdef in the source.
27 -#ifdef KERNELVERSION_2_6_32_220
28 -#define BEFORE_RH_63 1
29 -#define BEFORE_RH_64 1
30 -#define BEFORE_RH_65 1
31 -#define BEFORE_RH_66 1
32 -#define BEFORE_RH_67 1
33 -#define BEFORE_RH_70 1
34 -#define BEFORE_RH_71 1
35 -#define BEFORE_RH_72 1
37 -#ifdef KERNELVERSION_2_6_32_279
38 -#define AFTER_RH_62 1
39 -#define BEFORE_RH_64 1
40 -#define BEFORE_RH_65 1
41 -#define BEFORE_RH_66 1
42 -#define BEFORE_RH_67 1
43 -#define BEFORE_RH_70 1
44 -#define BEFORE_RH_71 1
45 -#define BEFORE_RH_72 1
47 -#ifdef KERNELVERSION_2_6_32_358
48 -#define AFTER_RH_62 1
49 -#define AFTER_RH_63 1
50 -#define BEFORE_RH_65 1
51 -#define BEFORE_RH_66 1
52 -#define BEFORE_RH_67 1
53 -#define BEFORE_RH_70 1
54 -#define BEFORE_RH_72 1
56 -#ifdef KERNELVERSION_2_6_32_431
57 -#define AFTER_RH_62 1
58 -#define AFTER_RH_63 1
59 -#define AFTER_RH_64 1
60 -#define BEFORE_RH_66 1
61 -#define BEFORE_RH_67 1
62 -#define BEFORE_RH_70 1
63 -#define BEFORE_RH_71 1
64 -#define BEFORE_RH_72 1
66 -#ifdef KERNELVERSION_2_6_32_504
67 -#define AFTER_RH_62 1
68 -#define AFTER_RH_63 1
69 -#define AFTER_RH_64 1
70 -#define AFTER_RH_65 1
71 -#define BEFORE_RH_67 1
72 -#define BEFORE_RH_70 1
73 -#define BEFORE_RH_71 1
74 -#define BEFORE_RH_72 1
76 -#ifdef KERNELVERSION_2_6_32_573
77 -#define AFTER_RH_62 1
78 -#define AFTER_RH_63 1
79 -#define AFTER_RH_64 1
80 -#define AFTER_RH_65 1
81 -#define AFTER_RH_66 1
82 -#define BEFORE_RH_70 1
83 -#define BEFORE_RH_71 1
84 -#define BEFORE_RH_72 1
86 -#ifdef KERNELVERSION_2_6_32_642
87 -#define AFTER_RH_62 1
88 -#define AFTER_RH_63 1
89 -#define AFTER_RH_64 1
90 -#define AFTER_RH_65 1
91 -#define AFTER_RH_66 1
92 -#define AFTER_RH_67 1
93 -#define BEFORE_RH_70 1
94 -#define BEFORE_RH_71 1
95 -#define BEFORE_RH_72 1
97 -#ifdef KERNELVERSION_2_6_32_696
98 -#define AFTER_RH_62 1
99 -#define AFTER_RH_63 1
100 -#define AFTER_RH_64 1
101 -#define AFTER_RH_65 1
102 -#define AFTER_RH_66 1
103 -#define AFTER_RH_67 1
104 -#define AFTER_RH_68 1
105 -#define BEFORE_RH_70 1
106 -#define BEFORE_RH_71 1
107 -#define BEFORE_RH_72 1
109 -#ifdef KERNELVERSION_3_10_0_123
110 -#define AFTER_RH_62 1
111 -#define AFTER_RH_63 1
112 -#define AFTER_RH_64 1
113 -#define AFTER_RH_65 1
114 -#define AFTER_RH_66 1
115 -#define AFTER_RH_67 1
116 -#define AFTER_RH_6x 1
117 -#define BEFORE_RH_71 1
119 -#ifdef KERNELVERSION_3_10_0_229
120 -#define AFTER_RH_62 1
121 -#define AFTER_RH_63 1
122 -#define AFTER_RH_64 1
123 -#define AFTER_RH_65 1
124 -#define AFTER_RH_66 1
125 -#define AFTER_RH_67 1
126 -#define AFTER_RH_6x 1
127 -#define AFTER_RH_70 1
128 -#define BEFORE_RH_72 1
130 -#ifdef KERNELVERSION_3_10_0_327
131 -#define AFTER_RH_62 1
132 -#define AFTER_RH_63 1
133 -#define AFTER_RH_64 1
134 -#define AFTER_RH_65 1
135 -#define AFTER_RH_66 1
136 -#define AFTER_RH_67 1
137 -#define AFTER_RH_6x 1
138 -#define AFTER_RH_70 1
139 -#define AFTER_RH_71 1
141 -#ifdef KERNELVERSION_3_10_0_514
142 -#define AFTER_RH_62 1
143 -#define AFTER_RH_63 1
144 -#define AFTER_RH_64 1
145 -#define AFTER_RH_65 1
146 -#define AFTER_RH_66 1
147 -#define AFTER_RH_67 1
148 -#define AFTER_RH_6x 1
149 -#define AFTER_RH_70 1
150 -#define AFTER_RH_71 1
151 -#define AFTER_RH_72 1
153 -#ifdef KERNELVERSION_3_10_0_693
154 #define AFTER_RH_62 1
155 #define AFTER_RH_63 1
156 #define AFTER_RH_64 1
158 #define AFTER_RH_71 1
159 #define AFTER_RH_72 1
160 #define AFTER_RH_73 1
163 /* Misc defines needed so source is same for all versions of Linux */
164 #ifndef SDEV_TRANSPORT_OFFLINE
165 diff -ur lin_tape-3.0.18/sgmp.c lin_tape-3.0.18-ifdefs/sgmp.c
166 --- lin_tape-3.0.18/sgmp.c 2017-02-23 19:14:41.000000000 +0100
167 +++ lin_tape-3.0.18-ifdefs/sgmp.c 2017-05-09 21:10:20.295643954 +0200
168 @@ -262,27 +262,12 @@
170 struct sg_fd *sfp = (struct sg_fd *)filp->private_data;
172 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION))
173 - /* RHEL 7.0 and beyond */
174 struct request_queue *q = sfp->parentdp->device->request_queue;
178 - struct request_queue *q = sfp->parentdp->device->request_queue;
182 if (sfp->parentdp->device->type == TYPE_SCANNER)
185 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
186 return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE);
188 - /* RHEL 6.4 and beyond */
189 - return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE);
191 -//6.3 blk_verify_command(cmd, filp->f_mode & FMODE_WRITE);
195 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
199 q = sdp->device->request_queue;
200 -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION))
201 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
202 sdp->sg_tablesize = min(queue_max_hw_segments(q),
203 queue_max_phys_segments(q));
205 @@ -1546,7 +1531,7 @@
206 if ((sdp->sgdebug > 0) &&
207 ((CHECK_CONDITION == srp->header.masked_status) ||
208 (COMMAND_TERMINATED == srp->header.masked_status)))
209 -#if defined(AFTER_RH_71) || LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
210 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
211 __scsi_print_sense(sdp->device, "sg_cmd_done", sense, SCSI_SENSE_BUFFERSIZE);
214 @@ -1677,7 +1662,7 @@
215 INIT_LIST_HEAD(&sdp->sfds);
216 init_waitqueue_head(&sdp->o_excl_wait);
218 -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION))
219 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
220 sdp->sg_tablesize = min(queue_max_hw_segments(q),
221 queue_max_phys_segments(q));
223 @@ -3069,7 +3054,7 @@
224 scsidp->id, scsidp->lun, (int) scsidp->type,
226 (int) scsidp->queue_depth,
228 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
229 (int) atomic_read(&scsidp->device_busy),
231 (int) scsidp->device_busy,
232 diff -ur lin_tape-3.0.18/stmp.c lin_tape-3.0.18-ifdefs/stmp.c
233 --- lin_tape-3.0.18/stmp.c 2017-02-23 19:14:41.000000000 +0100
234 +++ lin_tape-3.0.18-ifdefs/stmp.c 2017-05-09 21:11:01.113125428 +0200
236 SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
237 SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
238 if (cmdstatp->have_sense)
239 -#if defined(AFTER_RH_70) || LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
240 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
241 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
245 SRpnt->cmd[0] != MODE_SENSE &&
246 SRpnt->cmd[0] != TEST_UNIT_READY) {
248 -#if defined(AFTER_RH_71) || LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
249 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,4,21)
250 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
253 diff -ur lin_tape-3.0.18/upper.c lin_tape-3.0.18-ifdefs/upper.c
254 --- lin_tape-3.0.18/upper.c 2017-02-23 19:14:41.000000000 +0100
255 +++ lin_tape-3.0.18-ifdefs/upper.c 2017-05-09 21:09:37.868126006 +0200
257 if (copy_from_user(pfo_cmd->scsi_cmd, hdr->cmdp, hdr->cmd_len))
260 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
261 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
262 if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
264 /* RHEL 6.4 and beyond */
266 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
269 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
270 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
271 err = blk_verify_command(scsi_cmd, mode & FMODE_WRITE);
273 /* RHEL 6.4 and beyond */