wok-next view linux-cloop/stuff/patches/4.3-to-4.12.patch @ rev 21264

updated firefox-official (69.0 -> 71.0)
author Hans-G?nter Theisgen
date Fri Dec 06 15:46:28 2019 +0100 (2019-12-06)
parents 519b1ed1878f
children
line source
1 --- a/cloop.c
2 +++ b/cloop.c
3 @@ -17,7 +17,7 @@
4 \************************************************************************/
6 #define CLOOP_NAME "cloop"
7 -#define CLOOP_VERSION "4.3"
8 +#define CLOOP_VERSION "4.12"
9 #define CLOOP_MAX 8
11 #ifndef KBUILD_MODNAME
12 @@ -257,8 +257,14 @@
13 {
14 size_t outputSize = clo->head.block_size;
15 /* We should adjust outputSize here, in case the last block is smaller than block_size */
16 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) /* field removed */
17 err = lz4_decompress(clo->compressed_buffer, (size_t *) &compressed_length,
18 clo->buffer[clo->current_bufnum], outputSize);
19 +#else
20 + err = LZ4_decompress_safe(clo->compressed_buffer,
21 + clo->buffer[clo->current_bufnum],
22 + compressed_length, outputSize);
23 +#endif
24 if (err >= 0)
25 {
26 err = 0;
27 @@ -438,6 +444,7 @@
28 offset += length_in_buffer;
29 } /* while inner loop */
30 kunmap(bvec.bv_page);
31 + cond_resched();
32 } /* end rq_for_each_segment*/
33 return ((buffered_blocknum!=-1) || preloaded);
34 }
35 @@ -490,10 +497,18 @@
36 int rw;
37 /* quick sanity checks */
38 /* blk_fs_request() was removed in 2.6.36 */
39 - if (unlikely(req == NULL || (req->cmd_type != REQ_TYPE_FS)))
40 + if (unlikely(req == NULL
41 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) /* field removed */
42 + || (req->cmd_type != REQ_TYPE_FS)
43 +#endif
44 + ))
45 goto error_continue;
46 rw = rq_data_dir(req);
47 - if (unlikely(rw != READ && rw != READA))
48 + if (unlikely(rw != READ
49 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
50 + && rw != READA
51 +#endif
52 + ))
53 {
54 DEBUGP("cloop_do_request: bad command\n");
55 goto error_continue;
56 @@ -509,7 +524,11 @@
57 continue; /* next request */
58 error_continue:
59 DEBUGP(KERN_ERR "cloop_do_request: Discarding request %p.\n", req);
60 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
61 req->errors++;
62 +#else
63 + req->error_count++;
64 +#endif
65 __blk_end_request_all(req, -EIO);
66 }
67 }
68 @@ -926,7 +945,11 @@
69 struct kstat stat;
70 int err;
71 if (!file) return -ENXIO;
72 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
73 err = vfs_getattr(&file->f_path, &stat);
74 +#else
75 + err = vfs_getattr(&file->f_path, &stat, STATX_INO, AT_STATX_SYNC_AS_STAT);
76 +#endif
77 if (err) return err;
78 memset(info, 0, sizeof(*info));
79 info->lo_number = clo->clo_number;
80 @@ -1096,7 +1119,7 @@
81 /* losetup uses write-open and flags=0x8002 to set a new file */
82 if(mode & FMODE_WRITE)
83 {
84 - printk(KERN_WARNING "%s: Can't open device read-write in mode 0x%x\n", cloop_name, mode);
85 + printk(KERN_INFO "%s: Open in read-write mode 0x%x requested, ignored.\n", cloop_name, mode);
86 return -EROFS;
87 }
88 cloop_dev[cloop_num]->refcnt+=1;
89 @@ -1154,6 +1177,10 @@
90 goto error_out;
91 }
92 clo->clo_queue->queuedata = clo;
93 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
94 + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, clo->clo_queue);
95 + queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, clo->clo_queue);
96 +#endif
97 clo->clo_disk = alloc_disk(1);
98 if(!clo->clo_disk)
99 {