]> git.pld-linux.org Git - packages/lin_tape.git/blob - clean-ifdefs.patch
- up to 3.0.66, builds up to kernel 5.15
[packages/lin_tape.git] / clean-ifdefs.patch
1 Only in lin_tape-3.0.66-ifdefs: lin_tape.fixlist
2 diff -ur lin_tape-3.0.66/lin_tape_scsi_tape.c lin_tape-3.0.66-ifdefs/lin_tape_scsi_tape.c
3 --- lin_tape-3.0.66/lin_tape_scsi_tape.c        2023-08-08 23:45:15.000000000 +0200
4 +++ lin_tape-3.0.66-ifdefs/lin_tape_scsi_tape.c 2023-12-25 23:05:43.253011166 +0100
5 @@ -2028,8 +2028,8 @@
6                                         &drv->tape_log_len, TRC_SCSI_IOC);
7  #ifdef KERNELVERSION_5_14_0_70
8                         rc = scsi_ioctl(drv->dev_obj, command, (void*)arg);
9 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
10 -                       rc = scsi_ioctl(drv->dev_obj, filp->f_flags, command, (void*)arg);
11 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
12 +                       rc = scsi_ioctl(drv->dev_obj, NULL, filp->f_flags, command, (void*)arg);
13  #else
14                         rc = scsi_ioctl(drv->dev_obj, command, (void*)arg);
15  #endif
16 @@ -5597,8 +5597,8 @@
17                 log_changer((*chgp), TRC_SMCIOC_CMD, True);
18  #ifdef KERNELVERSION_5_14_0_70
19                 rc = scsi_ioctl((*chgp)->dev_obj, command, (void*)arg);
20 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5,14,1) || defined(SLESSP5))
21 -               rc = scsi_ioctl((*chgp)->dev_obj, filp->f_flags, command, (void*)arg);
22 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
23 +               rc = scsi_ioctl((*chgp)->dev_obj, NULL, filp->f_flags, command, (void*)arg);
24  #else
25                 rc = scsi_ioctl((*chgp)->dev_obj, command, (void*)arg);
26  #endif
27 @@ -11556,7 +11556,7 @@
28  
29         memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*));
30  
31 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
33         down_read(&current->mm->mmap_lock);
34  #else
35         down_read(&current->mm->mmap_sem);
36 @@ -11577,7 +11577,7 @@
37         mapped_pages = get_user_pages(current, current->mm,
38                 (ulong)user_location, number_pages, rw, 0, pages, NULL);
39  #endif
40 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
41 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,8,0)
42         up_read(&current->mm->mmap_lock);
43  #else
44         up_read(&current->mm->mmap_sem);
45 diff -ur lin_tape-3.0.66/Makefile lin_tape-3.0.66-ifdefs/Makefile
46 --- lin_tape-3.0.66/Makefile    2023-08-08 23:45:15.000000000 +0200
47 +++ lin_tape-3.0.66-ifdefs/Makefile     2023-12-25 23:02:51.396800274 +0100
48 @@ -20,55 +20,10 @@
49  lin_tape-objs := join.o lin_tape_scsi_config.o lin_tape_scsi_tape.o lin_tape_scsi_trace.o \
50               lin_tape_ioctl_tape.o lin_tape_ioctl_changer.o lin_tape_extra_ioctl.o
51  
52 -RHELRELEASE := $(shell [ -f "/etc/redhat-release" ] && echo 1 || echo 0)
53 -ifeq ($(RHELRELEASE), 1)
54 -KERNELDIR ?= /lib/modules/$(shell uname -r)/build
55 -KERNELVER = $(shell uname -r 2>/dev/null|sed "s/[\.-]/_/g"|sed "s/\([0-9]*_[0-9]*_[0-9]*_[0-9]*\).*/\1/")
56 -EXTRA_CFLAGS += -DKERNELVERSION_${KERNELVER}
57 -else
58 -UBUNTURELEASE := $(shell [ -f "/etc/os-release" ] && grep -qi Ubuntu /etc/os-release && echo 1 || echo 0)
59 -ifeq ($(UBUNTURELEASE), 1)
60 -EXTRA_CFLAGS += -DUBUNTUVERSION
61 -else
62 -EXTRA_CFLAGS += -DSLESVERSION
63 -KERNELDIR ?= /lib/modules/$(shell uname -r)/build
64 -KERNELVER = $(shell uname -r 2>/dev/null|sed "s/[\.-]/_/g"|sed "s/\([0-9]*_[0-9]*_[0-9]*_[0-9]*\).*/\1/")
65 -EXTRA_CFLAGS += -DSLESKERNEL_${KERNELVER}
66 -SLESSP2 := $(shell grep -qi SP2 /etc/*release && echo 1 || echo 0)
67 -SLESSP5 := $(shell grep -qi SP5 /etc/*release && echo 1 || echo 0)
68 -ifeq ($(SLESSP2), 1)
69 -EXTRA_CFLAGS += -DSLESSP2
70 -endif
71 -ifeq ($(SLESSP5), 1)
72 -EXTRA_CFLAGS += -DSLESSP5
73 -endif
74 -endif
75 -endif
76 -
77  ifeq ($(SFMP), 1)
78  EXTRA_CFLAGS += -DSFMPENABLED
79  endif
80  
81 -PROC := $(shell uname -m)
82 -ifeq ($(UBUNTURELEASE), 0)
83 -ifeq ($(PROC), ppc64)
84 -EXTRA_CFLAGS += -m64
85 -endif
86 -
87 -ifeq ($(PROC), powerpc64)
88 -EXTRA_CFLAGS += -m64
89 -endif
90 -
91 -ifeq ($(PROC), powerpc)
92 -EXTRA_CFLAGS += -m64 -msoft-float
93 -LDFLAGS += -melf64ppc
94 -endif
95 -
96 -ifeq ($(PROC), x86_64)
97 -EXTRA_CFLAGS += -mcmodel=kernel
98 -endif
99 -endif
100 -
101  VERSION := $(word 1,$(VERSIONRELEASE))
102  RELEASE := $(word 2,$(VERSIONRELEASE))
103  ifeq ($(RELEASE),)
104 diff -ur lin_tape-3.0.66/pfo.h lin_tape-3.0.66-ifdefs/pfo.h
105 --- lin_tape-3.0.66/pfo.h       2023-08-08 23:45:15.000000000 +0200
106 +++ lin_tape-3.0.66-ifdefs/pfo.h        2023-12-25 23:02:51.400133506 +0100
107 @@ -23,149 +23,6 @@
108  
109  #include "apfo.h"
110  #include <scsi/scsi_ioctl.h>
111 -/* The intent of the following defines is that the code
112 - * will build for various releases of Linux.  This is how
113 - * we track different versions using ifdef in the source.
114 - */
115 -#ifdef KERNELVERSION_2_6_32_220
116 -#define BEFORE_RH_63 1
117 -#define BEFORE_RH_64 1
118 -#define BEFORE_RH_65 1
119 -#define BEFORE_RH_66 1
120 -#define BEFORE_RH_67 1
121 -#define BEFORE_RH_70 1
122 -#define BEFORE_RH_71 1
123 -#define BEFORE_RH_72 1
124 -#endif
125 -#ifdef KERNELVERSION_2_6_32_279
126 -#define AFTER_RH_62 1
127 -#define BEFORE_RH_64 1
128 -#define BEFORE_RH_65 1
129 -#define BEFORE_RH_66 1
130 -#define BEFORE_RH_67 1
131 -#define BEFORE_RH_70 1
132 -#define BEFORE_RH_71 1
133 -#define BEFORE_RH_72 1
134 -#endif
135 -#ifdef KERNELVERSION_2_6_32_358
136 -#define AFTER_RH_62 1
137 -#define AFTER_RH_63 1
138 -#define BEFORE_RH_65 1
139 -#define BEFORE_RH_66 1
140 -#define BEFORE_RH_67 1
141 -#define BEFORE_RH_70 1
142 -#define BEFORE_RH_72 1
143 -#endif
144 -#ifdef KERNELVERSION_2_6_32_431
145 -#define AFTER_RH_62 1
146 -#define AFTER_RH_63 1
147 -#define AFTER_RH_64 1
148 -#define BEFORE_RH_66 1
149 -#define BEFORE_RH_67 1
150 -#define BEFORE_RH_70 1
151 -#define BEFORE_RH_71 1
152 -#define BEFORE_RH_72 1
153 -#endif
154 -#ifdef KERNELVERSION_2_6_32_504
155 -#define AFTER_RH_62 1
156 -#define AFTER_RH_63 1
157 -#define AFTER_RH_64 1
158 -#define AFTER_RH_65 1
159 -#define BEFORE_RH_67 1
160 -#define BEFORE_RH_70 1
161 -#define BEFORE_RH_71 1
162 -#define BEFORE_RH_72 1
163 -#endif
164 -#ifdef KERNELVERSION_2_6_32_573
165 -#define AFTER_RH_62 1
166 -#define AFTER_RH_63 1
167 -#define AFTER_RH_64 1
168 -#define AFTER_RH_65 1
169 -#define AFTER_RH_66 1
170 -#define BEFORE_RH_70 1
171 -#define BEFORE_RH_71 1
172 -#define BEFORE_RH_72 1
173 -#endif
174 -#ifdef KERNELVERSION_2_6_32_642
175 -#define AFTER_RH_62 1
176 -#define AFTER_RH_63 1
177 -#define AFTER_RH_64 1
178 -#define AFTER_RH_65 1
179 -#define AFTER_RH_66 1
180 -#define AFTER_RH_67 1
181 -#define BEFORE_RH_70 1
182 -#define BEFORE_RH_71 1
183 -#define BEFORE_RH_72 1
184 -#endif
185 -#ifdef KERNELVERSION_2_6_32_696
186 -#define AFTER_RH_62 1
187 -#define AFTER_RH_63 1
188 -#define AFTER_RH_64 1
189 -#define AFTER_RH_65 1
190 -#define AFTER_RH_66 1
191 -#define AFTER_RH_67 1
192 -#define AFTER_RH_68 1
193 -#define BEFORE_RH_70 1
194 -#define BEFORE_RH_71 1
195 -#define BEFORE_RH_72 1
196 -#endif
197 -#ifdef KERNELVERSION_3_10_0_123
198 -#define AFTER_RH_62 1
199 -#define AFTER_RH_63 1
200 -#define AFTER_RH_64 1
201 -#define AFTER_RH_65 1
202 -#define AFTER_RH_66 1
203 -#define AFTER_RH_67 1
204 -#define AFTER_RH_6x 1
205 -#define BEFORE_RH_71 1
206 -#endif
207 -#ifdef KERNELVERSION_3_10_0_229
208 -#define AFTER_RH_62 1
209 -#define AFTER_RH_63 1
210 -#define AFTER_RH_64 1
211 -#define AFTER_RH_65 1
212 -#define AFTER_RH_66 1
213 -#define AFTER_RH_67 1
214 -#define AFTER_RH_6x 1
215 -#define AFTER_RH_70 1
216 -#define BEFORE_RH_72 1
217 -#endif
218 -#ifdef KERNELVERSION_3_10_0_327
219 -#define AFTER_RH_62 1
220 -#define AFTER_RH_63 1
221 -#define AFTER_RH_64 1
222 -#define AFTER_RH_65 1
223 -#define AFTER_RH_66 1
224 -#define AFTER_RH_67 1
225 -#define AFTER_RH_6x 1
226 -#define AFTER_RH_70 1
227 -#define AFTER_RH_71 1
228 -#endif
229 -#ifdef KERNELVERSION_3_10_0_514
230 -#define AFTER_RH_62 1
231 -#define AFTER_RH_63 1
232 -#define AFTER_RH_64 1
233 -#define AFTER_RH_65 1
234 -#define AFTER_RH_66 1
235 -#define AFTER_RH_67 1
236 -#define AFTER_RH_6x 1
237 -#define AFTER_RH_70 1
238 -#define AFTER_RH_71 1
239 -#define AFTER_RH_72 1
240 -#endif
241 -#ifdef KERNELVERSION_3_10_0_693
242 -#define AFTER_RH_62 1
243 -#define AFTER_RH_63 1
244 -#define AFTER_RH_64 1
245 -#define AFTER_RH_65 1
246 -#define AFTER_RH_66 1
247 -#define AFTER_RH_67 1
248 -#define AFTER_RH_6x 1
249 -#define AFTER_RH_70 1
250 -#define AFTER_RH_71 1
251 -#define AFTER_RH_72 1
252 -#define AFTER_RH_73 1
253 -#endif
254  
255  /* Misc defines needed so source is same for all versions of Linux */
256  #ifndef SDEV_TRANSPORT_OFFLINE
257 diff -ur lin_tape-3.0.66/upper.c lin_tape-3.0.66-ifdefs/upper.c
258 --- lin_tape-3.0.66/upper.c     2023-08-08 23:45:15.000000000 +0200
259 +++ lin_tape-3.0.66-ifdefs/upper.c      2023-12-25 23:05:43.253011166 +0100
260 @@ -255,8 +255,8 @@
261                         DBG_INFO("Sent to kernel cmd=0x%04X\n", ioctl_cmd);
262  #ifdef KERNELVERSION_5_14_0_70
263                         return scsi_ioctl(sdev, ioctl_cmd, arg);
264 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
265 -                       return scsi_ioctl(sdev, filp->f_flags, ioctl_cmd, arg);
266 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
267 +                       return scsi_ioctl(sdev, NULL, filp->f_flags, ioctl_cmd, arg);
268  #else
269                         return scsi_ioctl(sdev, ioctl_cmd, arg);
270  #endif
271 @@ -279,8 +279,8 @@
272         } else {
273  #ifdef KERNELVERSION_5_14_0_70
274                 return scsi_ioctl(sdev, ioctl_cmd, arg);
275 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
276 -               return scsi_ioctl(sdev, filp->f_flags, ioctl_cmd, arg);
277 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0)
278 +               return scsi_ioctl(sdev, NULL, filp->f_flags, ioctl_cmd, arg);
279  #else
280                 return scsi_ioctl(sdev, ioctl_cmd, arg);
281  #endif         
282 @@ -305,9 +305,9 @@
283  
284  #ifdef KERNELVERSION_5_14_0_70 
285         if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
286 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
287 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
288         if (!scsi_cmd_allowed(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
289 -#elif LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) && (defined(SLESVERSION) || defined(UBUNTUVERSION))
290 +#elif LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
291         if (blk_verify_command(pfo_cmd->scsi_cmd, mode & FMODE_WRITE))
292  #else
293         /* RHEL 6.4 and beyond */
294 @@ -564,14 +564,12 @@
295                 /* SG_IO howto says that the shorter of the two wins */
296                 iov_data_len = iov_length((struct iovec *)iov,
297                                         hdr->iovec_count);
298 -#if !defined (UBUNTUVERSION)
299                 if (hdr->dxfer_len < iov_data_len) {
300                         hdr->iovec_count = iov_shorten((struct iovec *)iov,
301                                                         hdr->iovec_count,
302                                                         hdr->dxfer_len);
303                         iov_data_len = hdr->dxfer_len;
304                 }
305 -#endif
306                 pfo_cmd.buffer = iov;
307                 pfo_cmd.bufflen = iov_data_len;
308                 pfo_cmd.iov_count = hdr->iovec_count;
309 @@ -663,9 +661,9 @@
310  
311  #ifdef KERNELVERSION_5_14_0_70 
312         err = blk_verify_command(scsi_cmd, mode & FMODE_WRITE);
313 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
314 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
315         err = !scsi_cmd_allowed(scsi_cmd, mode & FMODE_WRITE);
316 -#elif LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0) && (defined(SLESVERSION) || defined(UBUNTUVERSION))
317 +#elif LINUX_VERSION_CODE > KERNEL_VERSION(3,12,0)
318         err = blk_verify_command(scsi_cmd, mode & FMODE_WRITE);
319  #else
320         /* RHEL 6.4 and beyond */
321 @@ -785,8 +783,8 @@
322                         DBG_INFO("Sent to kernel cmd=0x%04X\n", ioctl_cmd);
323  #ifdef KERNELVERSION_5_14_0_70
324                         return scsi_cmd_ioctl(q, disk, mode, ioctl_cmd, arg);
325 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
326 -                       return scsi_ioctl(sdev, mode, ioctl_cmd, arg);
327 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
328 +                       return scsi_ioctl(sdev, disk, mode, ioctl_cmd, arg);
329  #else
330                         return scsi_cmd_ioctl(q, disk, mode, ioctl_cmd, arg);
331  #endif
332 @@ -809,8 +807,8 @@
333         } else {
334  #ifdef KERNELVERSION_5_14_0_70
335                 return scsi_cmd_ioctl(q, disk, mode, ioctl_cmd, arg);
336 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
337 -               return scsi_ioctl(sdev, mode, ioctl_cmd, arg);
338 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
339 +               return scsi_ioctl(sdev, disk, mode, ioctl_cmd, arg);
340  #else
341                 return scsi_cmd_ioctl(q, disk, mode, ioctl_cmd, arg);
342  #endif
343 @@ -963,8 +961,8 @@
344         } else {
345  #ifdef KERNELVERSION_5_14_0_70
346                 return sg_scsi_ioctl(q, disk, mode, sic);
347 -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,14,0) && (LINUX_VERSION_CODE < KERNEL_VERSION(5, 14, 1) || defined(SLESSP5))
348 -               return scsi_ioctl(sdev, mode, cmd_in, sic);
349 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5,15,0)
350 +               return scsi_ioctl(sdev, disk, mode, cmd_in, sic);
351  #else
352                 return sg_scsi_ioctl(q, disk, mode, sic);
353  #endif
This page took 0.124175 seconds and 4 git commands to generate.