From e816b7a79b609f67caaf5149c743e5789d7075a9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Mon, 3 May 2021 22:20:03 +0200 Subject: [PATCH] - up to 3.0.56 --- clean-ifdefs.patch | 2 +- kernel-5.0.patch | 44 ------------- kernel-5.12.patch | 111 +++++++++++++++++++++++++++++++++ kernel-5.6.patch | 152 --------------------------------------------- lin_tape.spec | 12 ++-- 5 files changed, 117 insertions(+), 204 deletions(-) delete mode 100644 kernel-5.0.patch create mode 100644 kernel-5.12.patch delete mode 100644 kernel-5.6.patch diff --git a/clean-ifdefs.patch b/clean-ifdefs.patch index 7f6cb58..89a8998 100644 --- a/clean-ifdefs.patch +++ b/clean-ifdefs.patch @@ -178,7 +178,7 @@ diff -ur lin_tape-3.0.18/pfo.h lin_tape-3.0.18-ifdefs/pfo.h @@ -64,9 +64,6 @@ ("IBM Tape Drives and Libraries"); MODULE_LICENSE("GPL"); - MODULE_VERSION("3.0.52"); + MODULE_VERSION("3.0.56"); -#if defined(SLESVERSION) -MODULE_INFO(supported, "external"); -#endif // defined diff --git a/kernel-5.0.patch b/kernel-5.0.patch deleted file mode 100644 index 5bad8f6..0000000 --- a/kernel-5.0.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- lin_tape-3.0.33/lin_tape_ioctl_tape.c~ 2019-03-10 18:06:13.000000000 +0100 -+++ lin_tape-3.0.33/lin_tape_ioctl_tape.c 2019-03-10 18:11:48.544963300 +0100 -@@ -23,6 +23,7 @@ - #include "ibmekm/inc/dd_event.h" - #include "lin_tape_scsi_tape.h" - #include -+#include - - /***************************************************************************** - * * -@@ -2825,7 +2826,16 @@ - if(rc != STATUS_SUCCESS) goto EXIT_LABEL; - - memset(tv, '\0', sizeof(struct timeval)); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(tv); -+#else -+ struct timespec64 __now__; -+ -+ ktime_get_real_ts64(&__now__); -+ -+ tv->tv_sec = __now__.tv_sec, -+ tv->tv_usec = __now__.tv_nsec/1000, -+#endif - - /* tv.sec in structure timeval is a "long" integer - * it has 4 bytes in 32-bit kernel, but 8 bytes in 64-bit kernel -@@ -8843,7 +8853,16 @@ - - /* get time info to set TOD */ - memset(tv, '\0', sizeof(struct timeval)); -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(tv); -+#else -+ struct timespec64 __now__; -+ -+ ktime_get_real_ts64(&__now__); -+ -+ tv->tv_sec = __now__.tv_sec, -+ tv->tv_usec = __now__.tv_nsec/1000, -+#endif - - /* tv.sec in structure timeval is a "long" integer - * it has 4 bytes in 32-bit kernel, but 8 bytes in 64-bit kernel diff --git a/kernel-5.12.patch b/kernel-5.12.patch new file mode 100644 index 0000000..bec0408 --- /dev/null +++ b/kernel-5.12.patch @@ -0,0 +1,111 @@ +diff -ur lin_tape-3.0.56/lin_tape_ioctl_tape.c lin_tape-3.0.56-5.12/lin_tape_ioctl_tape.c +--- lin_tape-3.0.56/lin_tape_ioctl_tape.c 2020-12-07 05:40:22.000000000 +0100 ++++ lin_tape-3.0.56-5.12/lin_tape_ioctl_tape.c 2021-05-03 22:15:51.643418382 +0200 +@@ -6552,7 +6552,11 @@ + srq->retries = 0; + #endif + req->timeout = timeout; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) + blk_execute_rq(req->q, NULL, req, 1); ++#else ++ blk_execute_rq(NULL, req, 1); ++#endif + #if LINUX_VERSION_CODE <= KERNEL_VERSION(4,11,0) + *resid = req->resid_len; + status_code = req->errors; +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 +@@ -60,8 +60,6 @@ + MODULE_AUTHOR("IBM Corporation"); + MODULE_DESCRIPTION + ("IBM Linux SCSI Tape Device Driver for IBM and other vendor Tape Devices"); +-MODULE_SUPPORTED_DEVICE +- ("IBM Tape Drives and Libraries"); + 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,12,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,12,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,12,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 +@@ -541,7 +541,11 @@ + rq->timeout = pfo_cmd->timeout; + rq->end_io_data = pfo_cmd; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,12,0) + blk_execute_rq(rq->q, NULL, rq, 1); ++#else ++ blk_execute_rq(NULL, rq, 1); ++#endif + + if (bio && (pfo_cmd->source != PFO_SOURCE_CMD_1) && + (pfo_cmd->source != PFO_SOURCE_EXEC)) { diff --git a/kernel-5.6.patch b/kernel-5.6.patch deleted file mode 100644 index 8bf8ce3..0000000 --- a/kernel-5.6.patch +++ /dev/null @@ -1,152 +0,0 @@ -diff -urNp -x '*.orig' lin_tape-3.0.52.org/lin_tape_ioctl_tape.c lin_tape-3.0.52/lin_tape_ioctl_tape.c ---- lin_tape-3.0.52.org/lin_tape_ioctl_tape.c 2021-02-24 22:06:04.675258765 +0100 -+++ lin_tape-3.0.52/lin_tape_ioctl_tape.c 2021-02-24 22:06:04.715258642 +0100 -@@ -26,6 +26,16 @@ - #include - #include - -+ -+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0) -+struct lin_tape_timeval { -+ __kernel_long_t tv_sec; -+ __kernel_suseconds_t tv_usec; -+}; -+#else -+#define lin_tape_timeval timeval -+#endif -+ - /***************************************************************************** - * * - * Tape Drive Ioctls * -@@ -2795,7 +2805,7 @@ EXIT_LABEL: - - ssize_t tape_set_tod(struct tape_descriptor** drvp) - { -- struct timeval* tv = NULL; -+ struct lin_tape_timeval* tv = NULL; - struct tod_control* buffer = NULL; - struct tape_descriptor *drv = *drvp; - int now = 0, rc = STATUS_SUCCESS; -@@ -2811,20 +2821,20 @@ ssize_t tape_set_tod(struct tape_descrip - goto EXIT_LABEL; - } /* if */ - -- tv = kmalloc(sizeof(struct timeval), GFP_KERNEL); -+ tv = kmalloc(sizeof(struct lin_tape_timeval), GFP_KERNEL); - if(!tv) { - rc = -ENOMEM; - goto EXIT_LABEL; - } /* if */ - - memset(buffer, '\0', sizeof(struct tod_control)); -- memset(tv, '\0', sizeof(struct timeval)); -+ memset(tv, '\0', sizeof(struct lin_tape_timeval)); - - rc = tape_modesense_page(&drv, TODControlPageNumber, (unchar*)buffer, - sizeof(struct tod_control), True, True); - if(rc != STATUS_SUCCESS) goto EXIT_LABEL; - -- memset(tv, '\0', sizeof(struct timeval)); -+ memset(tv, '\0', sizeof(struct lin_tape_timeval)); - #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(tv); - #else -@@ -8940,7 +8950,7 @@ EXIT_LABEL: - - int erp_tod(struct tape_descriptor* drv, union cdb* tmp_cdb, char* sense_data) - { -- struct timeval* tv = NULL; -+ struct lin_tape_timeval* tv = NULL; - struct tod_control* tod_buf = NULL; - int now = 0, rc = -EIO; - -@@ -8950,7 +8960,7 @@ int erp_tod(struct tape_descriptor* drv, - goto EXIT_LABEL; - } /* if */ - -- tv = kmalloc(sizeof(struct timeval), GFP_KERNEL); -+ tv = kmalloc(sizeof(struct lin_tape_timeval), GFP_KERNEL); - if(!tv) { - rc = -ENOMEM; - goto EXIT_LABEL; -@@ -8961,7 +8971,7 @@ int erp_tod(struct tape_descriptor* drv, - if(rc != STATUS_SUCCESS) goto EXIT_LABEL; - - /* get time info to set TOD */ -- memset(tv, '\0', sizeof(struct timeval)); -+ memset(tv, '\0', sizeof(struct lin_tape_timeval)); - #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 0, 0) - do_gettimeofday(tv); - #else -diff -urNp -x '*.orig' lin_tape-3.0.52.org/lin_tape_scsi_config.h lin_tape-3.0.52/lin_tape_scsi_config.h ---- lin_tape-3.0.52.org/lin_tape_scsi_config.h 2021-02-24 22:06:04.671925441 +0100 -+++ lin_tape-3.0.52/lin_tape_scsi_config.h 2021-02-24 22:06:04.715258642 +0100 -@@ -220,6 +220,7 @@ static int tape_open_proc(struct inode * - { - return single_open(file, tape_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) - static struct file_operations tape_proc_ops = { - .owner = THIS_MODULE, - .open = tape_open_proc, -@@ -227,6 +228,14 @@ static struct file_operations tape_proc_ - .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 +261,7 @@ static int changer_open_proc(struct inod - { - return single_open(file, changer_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) - static struct file_operations changer_proc_ops = { - .owner = THIS_MODULE, - .open = changer_open_proc, -@@ -259,6 +269,14 @@ static struct file_operations changer_pr - .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 +288,7 @@ static int status_open_proc(struct inode - { - return single_open(file, status_read_proc, NULL); - } -+#if LINUX_VERSION_CODE < KERNEL_VERSION(5,6,0) - static struct file_operations status_proc_ops = { - .owner = THIS_MODULE, - .open = status_open_proc, -@@ -277,6 +296,14 @@ static struct file_operations status_pro - .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 --git a/lin_tape.spec b/lin_tape.spec index 92d09a3..c3d1bd2 100644 --- a/lin_tape.spec +++ b/lin_tape.spec @@ -5,22 +5,21 @@ # nothing to be placed to debuginfo package %define _enable_debug_packages 0 -%define rel 3 +%define rel 1 %define pname lin_tape Summary: IBM Tape SCSI Device Driver for Linux Name: %{pname}%{_alt_kernel} -Version: 3.0.52 +Version: 3.0.56 Release: %{rel}%{?_pld_builder:@%{_kernel_ver_str}} License: GPL v2/LGPL Group: Base/Kernel Source0: %{pname}-%{version}.tgz -# Source0-md5: 75cba1cbb76359085dedb5366afa7683 +# Source0-md5: 78169618f77dc1c112f3b10b2c5fe9f7 Source1: %{pname}.fixlist Patch0: use-module-dir.patch Patch1: clean-ifdefs.patch -Patch2: kernel-5.0.patch -Patch3: kernel-5.6.patch -Patch4: kernel-5.8.patch +Patch2: kernel-5.8.patch +Patch3: 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 @@ -72,7 +71,6 @@ compatible platforms.\ %patch1 -p1 %patch2 -p1 %patch3 -p1 -%patch4 -p1 install -p %{SOURCE1} . -- 2.43.0