From ced059820869947c97e6c5c30903945623e4a2d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Mon, 3 May 2021 23:20:48 +0200 Subject: [PATCH] - fix building against 5.10 and 5.12 --- kernel-5.10.patch | 73 +++++++++++++++++++++++++++++++++++++++++++++++ kernel-5.12.patch | 73 ++--------------------------------------------- lin_tape.spec | 4 ++- 3 files changed, 78 insertions(+), 72 deletions(-) create mode 100644 kernel-5.10.patch diff --git a/kernel-5.10.patch b/kernel-5.10.patch new file mode 100644 index 0000000..d0f1b13 --- /dev/null +++ b/kernel-5.10.patch @@ -0,0 +1,73 @@ +diff -ur lin_tape-3.0.56/lin_tape_scsi_config.h lin_tape-3.0.56-5.12/lin_tape_scsi_config.h +--- lin_tape-3.0.56/lin_tape_scsi_config.h 2021-05-03 22:17:53.707525951 +0200 ++++ lin_tape-3.0.56-5.12/lin_tape_scsi_config.h 2021-05-03 22:16:45.960370794 +0200 +@@ -220,6 +218,7 @@ + { + return single_open(file, tape_read_proc, NULL); + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + static struct file_operations tape_proc_ops = { + .owner = THIS_MODULE, + .open = tape_open_proc, +@@ -227,6 +226,14 @@ + .llseek = seq_lseek, + .release = single_release, + }; ++#else ++static struct proc_ops tape_proc_ops = { ++ .proc_open = tape_open_proc, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++#endif + #endif + + int rd_pc_initial +@@ -252,6 +259,7 @@ + { + return single_open(file, changer_read_proc, NULL); + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + static struct file_operations changer_proc_ops = { + .owner = THIS_MODULE, + .open = changer_open_proc, +@@ -259,6 +267,14 @@ + .llseek = seq_lseek, + .release = single_release, + }; ++#else ++static struct proc_ops changer_proc_ops = { ++ .proc_open = changer_open_proc, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++#endif + #endif + + static int status_read_proc +@@ -270,6 +286,7 @@ + { + return single_open(file, status_read_proc, NULL); + } ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) + static struct file_operations status_proc_ops = { + .owner = THIS_MODULE, + .open = status_open_proc, +@@ -277,6 +294,14 @@ + .llseek = seq_lseek, + .release = single_release, + }; ++#else ++static struct proc_ops status_proc_ops = { ++ .proc_open = status_open_proc, ++ .proc_read = seq_read, ++ .proc_lseek = seq_lseek, ++ .proc_release = single_release, ++}; ++#endif + #endif + + int rdstatus_pc_initial + (pfo_cmd->source != PFO_SOURCE_EXEC)) { diff --git a/kernel-5.12.patch b/kernel-5.12.patch index 1d6371a..e2b464e 100644 --- a/kernel-5.12.patch +++ b/kernel-5.12.patch @@ -5,7 +5,7 @@ diff -ur lin_tape-3.0.56/lin_tape_ioctl_tape.c lin_tape-3.0.56-5.12/lin_tape_ioc srq->retries = 0; #endif req->timeout = timeout; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) blk_execute_rq(req->q, NULL, req, 1); +#else + blk_execute_rq(NULL, req, 1); @@ -25,75 +25,6 @@ diff -ur lin_tape-3.0.56/lin_tape_scsi_config.h lin_tape-3.0.56-5.12/lin_tape_sc MODULE_LICENSE("GPL"); MODULE_VERSION("3.0.56"); /* driver parameters */ -@@ -220,6 +218,7 @@ - { - return single_open(file, tape_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) - static struct file_operations tape_proc_ops = { - .owner = THIS_MODULE, - .open = tape_open_proc, -@@ -227,6 +226,14 @@ - .llseek = seq_lseek, - .release = single_release, - }; -+#else -+static struct proc_ops tape_proc_ops = { -+ .proc_open = tape_open_proc, -+ .proc_read = seq_read, -+ .proc_lseek = seq_lseek, -+ .proc_release = single_release, -+}; -+#endif - #endif - - int rd_pc_initial -@@ -252,6 +259,7 @@ - { - return single_open(file, changer_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) - static struct file_operations changer_proc_ops = { - .owner = THIS_MODULE, - .open = changer_open_proc, -@@ -259,6 +267,14 @@ - .llseek = seq_lseek, - .release = single_release, - }; -+#else -+static struct proc_ops changer_proc_ops = { -+ .proc_open = changer_open_proc, -+ .proc_read = seq_read, -+ .proc_lseek = seq_lseek, -+ .proc_release = single_release, -+}; -+#endif - #endif - - static int status_read_proc -@@ -270,6 +286,7 @@ - { - return single_open(file, status_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) - static struct file_operations status_proc_ops = { - .owner = THIS_MODULE, - .open = status_open_proc, -@@ -277,6 +294,14 @@ - .llseek = seq_lseek, - .release = single_release, - }; -+#else -+static struct proc_ops status_proc_ops = { -+ .proc_open = status_open_proc, -+ .proc_read = seq_read, -+ .proc_lseek = seq_lseek, -+ .proc_release = single_release, -+}; -+#endif - #endif - - int rdstatus_pc_initial diff -ur lin_tape-3.0.56/lower.c lin_tape-3.0.56-5.12/lower.c --- lin_tape-3.0.56/lower.c 2020-12-07 05:40:22.000000000 +0100 +++ lin_tape-3.0.56-5.12/lower.c 2021-05-03 22:17:26.597339365 +0200 @@ -101,7 +32,7 @@ diff -ur lin_tape-3.0.56/lower.c lin_tape-3.0.56-5.12/lower.c rq->timeout = pfo_cmd->timeout; rq->end_io_data = pfo_cmd; -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) blk_execute_rq(rq->q, NULL, rq, 1); +#else + blk_execute_rq(NULL, rq, 1); diff --git a/lin_tape.spec b/lin_tape.spec index c3d1bd2..806c2db 100644 --- a/lin_tape.spec +++ b/lin_tape.spec @@ -19,7 +19,8 @@ Source1: %{pname}.fixlist Patch0: use-module-dir.patch Patch1: clean-ifdefs.patch Patch2: kernel-5.8.patch -Patch3: kernel-5.12.patch +Patch3: kernel-5.10.patch +Patch4: kernel-5.12.patch # System Storage, Tape systems, Tape drivers and software, Tape device drivers (Linux) URL: http://www.ibm.com/support/fixcentral/ BuildRequires: rpmbuild(macros) >= 1.701 @@ -71,6 +72,7 @@ compatible platforms.\ %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 install -p %{SOURCE1} . -- 2.43.0