]> git.pld-linux.org Git - packages/lin_tape.git/blame - linux-4.6.patch
- fix building with linux 4.10
[packages/lin_tape.git] / linux-4.6.patch
CommitLineData
6986ddb6
JR
1diff -ur lin_tape-3.0.8.orig/lin_tape_scsi_tape.c lin_tape-3.0.8/lin_tape_scsi_tape.c
2--- lin_tape-3.0.8.orig/lin_tape_scsi_tape.c 2016-02-23 22:16:42.000000000 +0100
3+++ lin_tape-3.0.8/lin_tape_scsi_tape.c 2016-06-19 13:17:29.632951394 +0200
4@@ -11480,10 +11480,14 @@
5
6 memset(pages, '\0', drv->supported_sg_tablesize * sizeof(struct page*));
7
8+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
9+ mapped_pages = get_user_pages_unlocked((ulong)user_location, number_pages, rw, 0, pages);
10+#else
11 down_read(&current->mm->mmap_sem);
12 mapped_pages = get_user_pages(current, current->mm,
13 (ulong)user_location, number_pages, rw, 0, pages, NULL);
14 up_read(&current->mm->mmap_sem);
15+#endif
16
17 if(mapped_pages < number_pages) {
18 rc = -EFAULT;
19@@ -11532,7 +11536,11 @@
20 EXIT_LABEL:
21
22 if(rc < STATUS_SUCCESS)
23+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
24+ for(i = 0; i < mapped_pages; i++) put_page(pages[i]);
25+#else
26 for(i = 0; i < mapped_pages; i++) page_cache_release(pages[i]);
27+#endif
28 if(pages_allocd) kfree(pages);
29 return rc;
30 } /* lin_tape_get_user_pages() */
31@@ -11567,7 +11575,11 @@
32 &drv->sg_list->gather[i]))) {
33 SetPageDirty(sg_page(&drv->sg_list->gather[i]));
34 } /* if */
35+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
36+ put_page(sg_page(&drv->sg_list->gather[i]));
37+#else
38 page_cache_release(sg_page(&drv->sg_list->gather[i]));
39+#endif
40 } /* if */
41 } /* for */
42
43diff -ur lin_tape-3.0.8.orig/stmp.c lin_tape-3.0.8/stmp.c
44--- lin_tape-3.0.8.orig/stmp.c 2016-06-19 13:17:14.000000000 +0200
45+++ lin_tape-3.0.8/stmp.c 2016-06-19 13:17:29.632951394 +0200
46@@ -5329,7 +5329,14 @@
47
48 if ((pages = kmalloc(max_pages * sizeof(*pages), GFP_KERNEL)) == NULL)
49 return -ENOMEM;
50-
51+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
52+ res = get_user_pages_unlocked(
53+ uaddr,
54+ nr_pages,
55+ rw == READ,
56+ 0, /* don't force */
57+ pages);
58+#else
59 /* Try to fault in all of the necessary pages */
60 down_read(&current->mm->mmap_sem);
61 /* rw==READ means read from drive, write into memory area */
62@@ -5343,6 +5350,7 @@
63 pages,
64 NULL);
65 up_read(&current->mm->mmap_sem);
66+#endif
67
68 /* Errors and no page mapped should return here */
69 if (res < nr_pages)
70@@ -5362,7 +5370,11 @@
71 out_unmap:
72 if (res > 0) {
73 for (j=0; j < res; j++)
74+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
75+ put_page(pages[j]);
76+#else
77 page_cache_release(pages[j]);
78+#endif
79 res = 0;
80 }
81 kfree(pages);
82@@ -5384,7 +5396,11 @@
83 /* FIXME: cache flush missing for rw==READ
84 * FIXME: call the correct reference counting function
85 */
86+#if LINUX_VERSION_CODE > KERNEL_VERSION(4,5,0)
87+ put_page(page);
88+#else
89 page_cache_release(page);
90+#endif
91 }
92 kfree(STbp->mapped_pages);
93 STbp->mapped_pages = NULL;
94Only in lin_tape-3.0.8: stmp.c.orig
This page took 0.040614 seconds and 4 git commands to generate.