1 diff -ur lin_tape-3.0.8/Makefile lin_tape-3.0.8-norh/Makefile
2 --- lin_tape-3.0.8/Makefile 2016-06-19 09:57:15.497134019 +0200
3 +++ lin_tape-3.0.8-norh/Makefile 2016-06-19 09:53:34.317661494 +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 cd ${KERNELDIR}; make kernelversion 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
17 PROC := $(shell uname -m)
20 diff -ur lin_tape-3.0.8/pfo.h lin_tape-3.0.8-norh/pfo.h
21 --- lin_tape-3.0.8/pfo.h 2016-03-17 03:37:58.000000000 +0100
22 +++ lin_tape-3.0.8-norh/pfo.h 2016-06-19 09:53:34.000000000 +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
36 -#ifdef KERNELVERSION_2_6_32_279
37 -#define AFTER_RH_62 1
38 -#define BEFORE_RH_64 1
39 -#define BEFORE_RH_65 1
40 -#define BEFORE_RH_66 1
41 -#define BEFORE_RH_67 1
42 -#define BEFORE_RH_70 1
43 -#define BEFORE_RH_71 1
45 -#ifdef KERNELVERSION_2_6_32_358
46 -#define AFTER_RH_62 1
47 -#define AFTER_RH_63 1
48 -#define BEFORE_RH_65 1
49 -#define BEFORE_RH_66 1
50 -#define BEFORE_RH_67 1
51 -#define BEFORE_RH_70 1
52 -#define BEFORE_RH_71 1
54 -#ifdef KERNELVERSION_2_6_32_431
55 -#define AFTER_RH_62 1
56 -#define AFTER_RH_63 1
57 -#define AFTER_RH_64 1
58 -#define BEFORE_RH_66 1
59 -#define BEFORE_RH_67 1
60 -#define BEFORE_RH_70 1
61 -#define BEFORE_RH_71 1
63 -#ifdef KERNELVERSION_2_6_32_504
64 -#define AFTER_RH_62 1
65 -#define AFTER_RH_63 1
66 -#define AFTER_RH_64 1
67 -#define AFTER_RH_65 1
68 -#define BEFORE_RH_67 1
69 -#define BEFORE_RH_70 1
70 -#define BEFORE_RH_71 1
72 -#ifdef KERNELVERSION_2_6_32_573
73 -#define AFTER_RH_62 1
74 -#define AFTER_RH_63 1
75 -#define AFTER_RH_64 1
76 -#define AFTER_RH_65 1
77 -#define AFTER_RH_66 1
78 -#define BEFORE_RH_70 1
79 -#define BEFORE_RH_71 1
81 -#ifdef KERNELVERSION_3_10_0_123
82 -#define AFTER_RH_62 1
83 -#define AFTER_RH_63 1
84 -#define AFTER_RH_64 1
85 -#define AFTER_RH_65 1
86 -#define AFTER_RH_66 1
87 -#define AFTER_RH_67 1
88 -#define AFTER_RH_6x 1
89 -#define BEFORE_RH_71 1
91 -#ifdef KERNELVERSION_3_10_0_229
92 -#define AFTER_RH_62 1
93 -#define AFTER_RH_63 1
94 -#define AFTER_RH_64 1
95 -#define AFTER_RH_65 1
96 -#define AFTER_RH_66 1
97 -#define AFTER_RH_67 1
98 -#define AFTER_RH_6x 1
99 -#define AFTER_RH_70 1
100 -#define BEFORE_RH_72 1
102 -#ifdef KERNELVERSION_3_10_0_327
103 #define AFTER_RH_62 1
104 #define AFTER_RH_63 1
105 #define AFTER_RH_64 1
107 #define AFTER_RH_6x 1
108 #define AFTER_RH_70 1
109 #define AFTER_RH_72 1
112 /* Misc defines needed so source is same for all versions of Linux */
113 #ifndef SDEV_TRANSPORT_OFFLINE
114 diff -ur lin_tape-3.0.8/sgmp.c lin_tape-3.0.8-norh/sgmp.c
115 --- lin_tape-3.0.8/sgmp.c 2016-03-17 04:44:07.000000000 +0100
116 +++ lin_tape-3.0.8-norh/sgmp.c 2016-06-19 09:55:40.075920922 +0200
117 @@ -262,31 +262,11 @@
119 struct sg_fd *sfp = (struct sg_fd *)filp->private_data;
121 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION))
122 - /* RHEL 7.0 and beyond */
123 struct request_queue *q = sfp->parentdp->device->request_queue;
127 - struct request_queue *q = sfp->parentdp->device->request_queue;
131 if (sfp->parentdp->device->type == TYPE_SCANNER)
134 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION))
135 - /* RHEL 7.0 and beyond */
136 - return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE);
140 - return blk_verify_command(q, cmd, filp->f_mode & FMODE_WRITE);
142 - /* RHEL6.3- or SLES11SP3 */
143 return blk_verify_command(cmd, filp->f_mode & FMODE_WRITE);
148 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,32)
149 diff -ur lin_tape-3.0.8/upper.c lin_tape-3.0.8-norh/upper.c
150 --- lin_tape-3.0.8/upper.c 2016-02-23 20:19:55.000000000 +0100
151 +++ lin_tape-3.0.8-norh/upper.c 2016-06-19 09:56:18.759745753 +0200
154 if (copy_from_user(pfo_cmd->scsi_cmd, hdr->cmdp, hdr->cmd_len))
156 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0) && (!defined(SLESVERSION))
157 - /* RHEL 7.0 and beyond */
158 - if (blk_verify_command(q, pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
160 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32)
163 - if (blk_verify_command(q, pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
165 - /* RHEL 6.3- or SLES11SP3 */
166 if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
173 --- lin_tape-3.0.8/sgmp.c~ 2016-06-19 13:18:16.000000000 +0200
174 +++ lin_tape-3.0.8/sgmp.c 2016-06-19 13:21:28.375961483 +0200
175 @@ -1544,7 +1544,7 @@
176 if ((sdp->sgdebug > 0) &&
177 ((CHECK_CONDITION == srp->header.masked_status) ||
178 (COMMAND_TERMINATED == srp->header.masked_status)))
180 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
181 __scsi_print_sense(sdp->device, "sg_cmd_done", sense, SCSI_SENSE_BUFFERSIZE);
184 --- lin_tape-3.0.8/stmp.c~ 2016-06-19 13:18:16.000000000 +0200
185 +++ lin_tape-3.0.8/stmp.c 2016-06-19 13:21:10.882407139 +0200
187 SRpnt->cmd[0], SRpnt->cmd[1], SRpnt->cmd[2],
188 SRpnt->cmd[3], SRpnt->cmd[4], SRpnt->cmd[5]);
189 if (cmdstatp->have_sense)
191 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
192 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);
196 scode != VOLUME_OVERFLOW &&
197 SRpnt->cmd[0] != MODE_SENSE &&
198 SRpnt->cmd[0] != TEST_UNIT_READY) {
200 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,0)
201 __scsi_print_sense(STp->device, name, SRpnt->sense, SCSI_SENSE_BUFFERSIZE);