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 BEFORE_RH_70 1
93 -#define BEFORE_RH_71 1
94 -#define BEFORE_RH_72 1
96 -#ifdef KERNELVERSION_3_10_0_123
97 -#define AFTER_RH_62 1
98 -#define AFTER_RH_63 1
99 -#define AFTER_RH_64 1
100 -#define AFTER_RH_65 1
101 -#define AFTER_RH_66 1
102 -#define AFTER_RH_67 1
103 -#define AFTER_RH_6x 1
104 -#define BEFORE_RH_71 1
106 -#ifdef KERNELVERSION_3_10_0_229
107 -#define AFTER_RH_62 1
108 -#define AFTER_RH_63 1
109 -#define AFTER_RH_64 1
110 -#define AFTER_RH_65 1
111 -#define AFTER_RH_66 1
112 -#define AFTER_RH_67 1
113 -#define AFTER_RH_6x 1
114 -#define AFTER_RH_70 1
115 -#define BEFORE_RH_72 1
117 -#ifdef KERNELVERSION_3_10_0_327
118 #define AFTER_RH_62 1
119 #define AFTER_RH_63 1
120 #define AFTER_RH_64 1
122 #define AFTER_RH_6x 1
123 #define AFTER_RH_70 1
124 #define AFTER_RH_71 1
127 /* Misc defines needed so source is same for all versions of Linux */
128 #ifndef SDEV_TRANSPORT_OFFLINE
129 diff -ur lin_tape-3.0.18/sgmp.c lin_tape-3.0.18-ifdefs/sgmp.c
130 --- lin_tape-3.0.18/sgmp.c 2017-02-23 19:14:41.000000000 +0100
131 +++ lin_tape-3.0.18-ifdefs/sgmp.c 2017-05-09 21:10:20.295643954 +0200
132 @@ -262,27 +262,12 @@
134 struct sg_fd *sfp = (struct sg_fd *)filp->private_data;
136 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION))
137 - /* RHEL 7.0 and beyond */
138 struct request_queue *q = sfp->parentdp->device->request_queue;
142 - struct request_queue *q = sfp->parentdp->device->request_queue;
146 if (sfp->parentdp->device->type == TYPE_SCANNER)
149 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
150 return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE);
152 - /* RHEL 6.4 and beyond */
153 - return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE);
155 -//6.3 blk_verify_command(cmd, filp->f_mode & FMODE_WRITE);
159 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
163 q = sdp->device->request_queue;
164 -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION))
165 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
166 sdp->sg_tablesize = min(queue_max_hw_segments(q),
167 queue_max_phys_segments(q));
169 @@ -1546,7 +1531,7 @@
170 if ((sdp->sgdebug > 0) &&
171 ((CHECK_CONDITION == srp->header.masked_status) ||
172 (COMMAND_TERMINATED == srp->header.masked_status)))
174 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
175 __scsi_print_sense(sdp->device, "sg_cmd_done", sense, SCSI_SENSE_BUFFERSIZE);
178 @@ -1677,7 +1662,7 @@
179 INIT_LIST_HEAD(&sdp->sfds);
180 init_waitqueue_head(&sdp->o_excl_wait);
182 -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32) && (defined(SLESVERSION))
183 +#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,32)
184 sdp->sg_tablesize = min(queue_max_hw_segments(q),
185 queue_max_phys_segments(q));
187 @@ -3069,7 +3054,7 @@
188 scsidp->id, scsidp->lun, (int) scsidp->type,
190 (int) scsidp->queue_depth,
192 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
193 (int) atomic_read(&scsidp->device_busy),
195 (int) scsidp->device_busy,
196 diff -ur lin_tape-3.0.18/stmp.c lin_tape-3.0.18-ifdefs/stmp.c
197 --- lin_tape-3.0.18/stmp.c 2017-02-23 19:14:41.000000000 +0100
198 +++ lin_tape-3.0.18-ifdefs/stmp.c 2017-05-09 21:11:01.113125428 +0200
200 SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
201 SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
202 if (cmdstatp->have_sense)
204 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
205 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
209 scode != VOLUME_OVERFLOW &&
210 SRpnt->cmd[0] != MODE_SENSE &&
211 SRpnt->cmd[0] != TEST_UNIT_READY) {
213 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
214 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
217 diff -ur lin_tape-3.0.18/upper.c lin_tape-3.0.18-ifdefs/upper.c
218 --- lin_tape-3.0.18/upper.c 2017-02-23 19:14:41.000000000 +0100
219 +++ lin_tape-3.0.18-ifdefs/upper.c 2017-05-09 21:09:37.868126006 +0200
221 if (copy_from_user(pfo_cmd->scsi_cmd, hdr->cmdp, hdr->cmd_len))
224 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
225 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
226 if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
228 /* RHEL 6.4 and beyond */
230 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
233 -#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) || defined(SLESVERSION)
234 +#if LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
235 err = blk_verify_command(scsi_cmd, mode & FMODE_WRITE);
237 /* RHEL 6.4 and beyond */