From 6f6082f9ac320bc0d5ed2b6c65ea67b5d6c41444 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20R=C4=99korajski?= Date: Sat, 21 Jan 2017 21:02:34 +0100 Subject: [PATCH] - fix building with linux 4.9 - rel 2 --- lin_tape.spec | 4 +++- linux-4.9.patch | 30 ++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 linux-4.9.patch diff --git a/lin_tape.spec b/lin_tape.spec index 34af321..4a7909a 100644 --- a/lin_tape.spec +++ b/lin_tape.spec @@ -5,7 +5,7 @@ # 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} @@ -24,6 +24,7 @@ Patch4: linux-3.19.patch 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 @@ -79,6 +80,7 @@ compatible platforms.\ %patch5 -p1 %patch6 -p1 %patch7 -p1 +%patch8 -p1 install -p %{SOURCE1} . diff --git a/linux-4.9.patch b/linux-4.9.patch new file mode 100644 index 0000000..22da2ce --- /dev/null +++ b/linux-4.9.patch @@ -0,0 +1,30 @@ +--- 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, -- 2.43.0