aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support/vboxguestdrivers/vboxguestdrivers/r90497-regops-5.14-fix.patch
blob: 0d960fa4f53c80d3a4d0568523a392ff3c1972c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
Subject: Fix regops build errors with linux 5.14

Upstream-Status: backport

svn-id: r90497

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>

Index: a/src/VBox/Additions/linux/sharedfolders/regops.c
===================================================================
--- a/src/VBox/Additions/linux/sharedfolders/regops.c	(revision 88716)
+++ a/src/VBox/Additions/linux/sharedfolders/regops.c	(revision 90497)
@@ -2126,7 +2126,11 @@
     int    rc       = 0;
 
     Assert(iov_iter_count(iter) + pStash->cb > 0);
+# if RTLNX_VER_MIN(5,14,0)
+    if (!(iter->iter_type & ITER_KVEC)) {
+#else
     if (!(iter->type & ITER_KVEC)) {
+#endif
         /*
          * Do we have a stashed page?
          */
@@ -2372,7 +2376,9 @@
 static size_t vbsf_iter_max_span_of_pages(struct iov_iter *iter)
 {
     size_t cPages;
-# if RTLNX_VER_MIN(3,16,0)
+#if RTLNX_VER_MIN(5,14,0)
+    if (iter_is_iovec(iter) || (iter->iter_type & ITER_KVEC)) {
+#elif RTLNX_VER_MIN(3,16,0)
     if (iter_is_iovec(iter) || (iter->type & ITER_KVEC)) {
 #endif
         const struct iovec *pCurIov    = iter->iov;
@@ -2436,7 +2442,11 @@
     } else {
         /* Won't bother with accurate counts for the next two types, just make
            some rough estimates (does pipes have segments?): */
+#  if RTLNX_VER_MIN(5,14,0)
+        size_t cSegs = iter->iter_type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1;
+#  else
         size_t cSegs = iter->type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1;
+#endif
         cPages = (iov_iter_count(iter) + (PAGE_SIZE * 2 - 2) * cSegs) >> PAGE_SHIFT;
     }
 # endif
@@ -2588,8 +2598,14 @@
     struct vbsf_reg_info   *sf_r       = kio->ki_filp->private_data;
     struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
 
+#if RTLNX_VER_MIN(5,14,0)
     SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
+               inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->iter_type));
+#else
+    SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
                inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->type));
+#endif
+
     AssertReturn(S_ISREG(inode->i_mode), -EINVAL);
 
     /*
@@ -2823,9 +2839,13 @@
     bool const              fAppend    = RT_BOOL(kio->ki_filp->f_flags & O_APPEND);
 # endif
 
-
+#if RTLNX_VER_MIN(5,14,0)
     SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
+               inode, kio->ki_filp, cbToWrite, offFile, iter->iter_type));
+#else
+    SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n",
                inode, kio->ki_filp, cbToWrite, offFile, iter->type));
+#endif
     AssertReturn(S_ISREG(inode->i_mode), -EINVAL);
 
     /*
@@ -3737,7 +3757,27 @@
 }
 #endif /* KERNEL_VERSION >= 2.6.24 */
 
+#if RTLNX_VER_MIN(5,14,0)
+static int vbsf_write_end(struct file *file, struct address_space *mapping,
+                loff_t pos, unsigned int len, unsigned int copied,
+                struct page *page, void *fsdata)
+{
+    static uint64_t volatile s_cCalls = 0;
+    if (s_cCalls++ < 16)
+    {
+        printk("vboxsf: Unexpected call to vbsf_write_end(pos=%#llx len=%#x)! Please report.\n",
+               (unsigned long long)pos, len);
+        RTLogBackdoorPrintf("vboxsf: Unexpected call to vbsf_write_end(pos=%#llx len=%#x)!  Please report.\n",
+                            (unsigned long long)pos, len);
+# ifdef WARN_ON
+        WARN_ON(1);
+# endif
+    }
 
+    return -ENOTSUPP;
+}
+#endif
+
 #if RTLNX_VER_MIN(2,4,10)
 
 # ifdef VBOX_UEK
@@ -3791,8 +3831,11 @@
 #if RTLNX_VER_MIN(2,5,12)
     .set_page_dirty = __set_page_dirty_buffers,
 #endif
-#if RTLNX_VER_MIN(2,6,24)
+#if RTLNX_VER_MIN(5,14,0)
     .write_begin    = vbsf_write_begin,
+    .write_end      = vbsf_write_end,
+#elif RTLNX_VER_MIN(2,6,24)
+    .write_begin    = vbsf_write_begin,
     .write_end      = simple_write_end,
 #elif RTLNX_VER_MIN(2,5,45)
     .prepare_write  = simple_prepare_write,