# nothing to be placed to debuginfo package
%define _enable_debug_packages 0
-%define rel 1
+%define rel 2
%define pname lin_tape
Summary: IBM Tape SCSI Device Driver for Linux
Name: %{pname}%{_alt_kernel}
Patch5: linux-4.0.patch
Patch6: linux-4.6.patch
Patch7: no-uname.patch
+Patch8: linux-4.9.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
%patch5 -p1
%patch6 -p1
%patch7 -p1
+%patch8 -p1
install -p %{SOURCE1} .
--- /dev/null
+--- lin_tape-3.0.8/lin_tape_scsi_tape.c~ 2017-01-21 20:53:26.000000000 +0100
++++ lin_tape-3.0.8/lin_tape_scsi_tape.c 2017-01-21 20:58:23.919843647 +0100
+@@ -11480,7 +11480,9 @@
+
+ memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*));
+
+-#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
++ mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, pages, rw ? FOLL_WRITE : 0);
++#elif LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
+ mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, rw, 0, pages);
+ #else
+ down_read(¤t->mm->mmap_sem);
+--- lin_tape-3.0.8/stmp.c~ 2017-01-21 20:59:35.000000000 +0100
++++ lin_tape-3.0.8/stmp.c 2017-01-21 21:01:53.144286074 +0100
+@@ -5329,7 +5329,13 @@
+
+ if ((pages = kmalloc(max_pages * sizeof(*pages), GFP_KERNEL)) == NULL)
+ return -ENOMEM;
+-#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,9,0)
++ res = get_user_pages_unlocked(
++ uaddr,
++ nr_pages,
++ pages,
++ rw == READ ? FOLL_WRITE : 0);
++#elif LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
+ res = get_user_pages_unlocked(
+ uaddr,
+ nr_pages,