Andrew Geissler | 5199d83 | 2021-09-24 16:47:35 -0500 | [diff] [blame^] | 1 | Subject: Fix regops build errors with linux 5.14 |
| 2 | |
| 3 | Upstream-Status: backport |
| 4 | |
| 5 | svn-id: r90497 |
| 6 | |
| 7 | Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> |
| 8 | |
| 9 | Index: a/src/VBox/Additions/linux/sharedfolders/regops.c |
| 10 | =================================================================== |
| 11 | --- a/src/VBox/Additions/linux/sharedfolders/regops.c (revision 88716) |
| 12 | +++ a/src/VBox/Additions/linux/sharedfolders/regops.c (revision 90497) |
| 13 | @@ -2126,7 +2126,11 @@ |
| 14 | int rc = 0; |
| 15 | |
| 16 | Assert(iov_iter_count(iter) + pStash->cb > 0); |
| 17 | +# if RTLNX_VER_MIN(5,14,0) |
| 18 | + if (!(iter->iter_type & ITER_KVEC)) { |
| 19 | +#else |
| 20 | if (!(iter->type & ITER_KVEC)) { |
| 21 | +#endif |
| 22 | /* |
| 23 | * Do we have a stashed page? |
| 24 | */ |
| 25 | @@ -2372,7 +2376,9 @@ |
| 26 | static size_t vbsf_iter_max_span_of_pages(struct iov_iter *iter) |
| 27 | { |
| 28 | size_t cPages; |
| 29 | -# if RTLNX_VER_MIN(3,16,0) |
| 30 | +#if RTLNX_VER_MIN(5,14,0) |
| 31 | + if (iter_is_iovec(iter) || (iter->iter_type & ITER_KVEC)) { |
| 32 | +#elif RTLNX_VER_MIN(3,16,0) |
| 33 | if (iter_is_iovec(iter) || (iter->type & ITER_KVEC)) { |
| 34 | #endif |
| 35 | const struct iovec *pCurIov = iter->iov; |
| 36 | @@ -2436,7 +2442,11 @@ |
| 37 | } else { |
| 38 | /* Won't bother with accurate counts for the next two types, just make |
| 39 | some rough estimates (does pipes have segments?): */ |
| 40 | +# if RTLNX_VER_MIN(5,14,0) |
| 41 | + size_t cSegs = iter->iter_type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1; |
| 42 | +# else |
| 43 | size_t cSegs = iter->type & ITER_BVEC ? RT_MAX(1, iter->nr_segs) : 1; |
| 44 | +#endif |
| 45 | cPages = (iov_iter_count(iter) + (PAGE_SIZE * 2 - 2) * cSegs) >> PAGE_SHIFT; |
| 46 | } |
| 47 | # endif |
| 48 | @@ -2588,8 +2598,14 @@ |
| 49 | struct vbsf_reg_info *sf_r = kio->ki_filp->private_data; |
| 50 | struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb); |
| 51 | |
| 52 | +#if RTLNX_VER_MIN(5,14,0) |
| 53 | SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", |
| 54 | + inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->iter_type)); |
| 55 | +#else |
| 56 | + SFLOGFLOW(("vbsf_reg_read_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", |
| 57 | inode, kio->ki_filp, cbToRead, kio->ki_pos, iter->type)); |
| 58 | +#endif |
| 59 | + |
| 60 | AssertReturn(S_ISREG(inode->i_mode), -EINVAL); |
| 61 | |
| 62 | /* |
| 63 | @@ -2823,9 +2839,13 @@ |
| 64 | bool const fAppend = RT_BOOL(kio->ki_filp->f_flags & O_APPEND); |
| 65 | # endif |
| 66 | |
| 67 | - |
| 68 | +#if RTLNX_VER_MIN(5,14,0) |
| 69 | SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", |
| 70 | + inode, kio->ki_filp, cbToWrite, offFile, iter->iter_type)); |
| 71 | +#else |
| 72 | + SFLOGFLOW(("vbsf_reg_write_iter: inode=%p file=%p size=%#zx off=%#llx type=%#x\n", |
| 73 | inode, kio->ki_filp, cbToWrite, offFile, iter->type)); |
| 74 | +#endif |
| 75 | AssertReturn(S_ISREG(inode->i_mode), -EINVAL); |
| 76 | |
| 77 | /* |
| 78 | @@ -3737,7 +3757,27 @@ |
| 79 | } |
| 80 | #endif /* KERNEL_VERSION >= 2.6.24 */ |
| 81 | |
| 82 | +#if RTLNX_VER_MIN(5,14,0) |
| 83 | +static int vbsf_write_end(struct file *file, struct address_space *mapping, |
| 84 | + loff_t pos, unsigned int len, unsigned int copied, |
| 85 | + struct page *page, void *fsdata) |
| 86 | +{ |
| 87 | + static uint64_t volatile s_cCalls = 0; |
| 88 | + if (s_cCalls++ < 16) |
| 89 | + { |
| 90 | + printk("vboxsf: Unexpected call to vbsf_write_end(pos=%#llx len=%#x)! Please report.\n", |
| 91 | + (unsigned long long)pos, len); |
| 92 | + RTLogBackdoorPrintf("vboxsf: Unexpected call to vbsf_write_end(pos=%#llx len=%#x)! Please report.\n", |
| 93 | + (unsigned long long)pos, len); |
| 94 | +# ifdef WARN_ON |
| 95 | + WARN_ON(1); |
| 96 | +# endif |
| 97 | + } |
| 98 | |
| 99 | + return -ENOTSUPP; |
| 100 | +} |
| 101 | +#endif |
| 102 | + |
| 103 | #if RTLNX_VER_MIN(2,4,10) |
| 104 | |
| 105 | # ifdef VBOX_UEK |
| 106 | @@ -3791,8 +3831,11 @@ |
| 107 | #if RTLNX_VER_MIN(2,5,12) |
| 108 | .set_page_dirty = __set_page_dirty_buffers, |
| 109 | #endif |
| 110 | -#if RTLNX_VER_MIN(2,6,24) |
| 111 | +#if RTLNX_VER_MIN(5,14,0) |
| 112 | .write_begin = vbsf_write_begin, |
| 113 | + .write_end = vbsf_write_end, |
| 114 | +#elif RTLNX_VER_MIN(2,6,24) |
| 115 | + .write_begin = vbsf_write_begin, |
| 116 | .write_end = simple_write_end, |
| 117 | #elif RTLNX_VER_MIN(2,5,45) |
| 118 | .prepare_write = simple_prepare_write, |