File kernel-6.16-page-index.patch of Package virtualbox

From: Jiri Slaby <jslaby@suse.cz>
Subject: sharedfolders/regops: use __folio_index

page::index was renamed to page::__folio_index in 6.16's:
commit acc53a0b4c156877773da6e9eea4113dc7e770ae
Author: Matthew Wilcox (Oracle) <willy@infradead.org>
Date:   Wed May 14 19:15:07 2025 +0100

    mm: rename page->index to page->__folio_index

---
 src/VBox/Additions/linux/sharedfolders/regops.c |   40 +++++++++++++++++++++---
 1 file changed, 36 insertions(+), 4 deletions(-)

--- a/src/VBox/Additions/linux/sharedfolders/regops.c
+++ b/src/VBox/Additions/linux/sharedfolders/regops.c
@@ -1789,7 +1789,11 @@ static void vbsf_reg_write_sync_page_cac
             struct page  *pDstPage   = find_lock_page(mapping, idxPage);
             if (pDstPage) {
                 if (   pDstPage->mapping == mapping /* ignore if re-purposed (paranoia) */
+#if RTLNX_VER_MIN(6,16,0)
+                    && pDstPage->__folio_index == idxPage
+#else
                     && pDstPage->index == idxPage
+#endif
                     && !PageDirty(pDstPage)         /* ignore if dirty */
                     && !PageWriteback(pDstPage)     /* ignore if being written back */ ) {
                     /*
@@ -1820,7 +1824,13 @@ static void vbsf_reg_write_sync_page_cac
 # endif
                 } else
                     SFLOGFLOW(("vbsf_reg_write_sync_page_cache: Skipping page %p: mapping=%p (vs %p) writeback=%d offset=%#lx (vs%#lx)\n",
-                               pDstPage, pDstPage->mapping, mapping, PageWriteback(pDstPage), pDstPage->index, idxPage));
+                               pDstPage, pDstPage->mapping, mapping, PageWriteback(pDstPage),
+#if RTLNX_VER_MIN(6,16,0)
+			       pDstPage->__folio_index,
+#else
+			       pDstPage->index,
+#endif
+			       idxPage));
                 unlock_page(pDstPage);
                 vbsf_put_page(pDstPage);
             }
@@ -3632,7 +3642,13 @@ static int vbsf_readpage(struct file *fi
     struct inode *inode = VBSF_GET_F_DENTRY(file)->d_inode;
     int           err;
 
-    SFLOGFLOW(("vbsf_readpage: inode=%p file=%p page=%p off=%#llx\n", inode, file, page, (uint64_t)page->index << PAGE_SHIFT));
+    SFLOGFLOW(("vbsf_readpage: inode=%p file=%p page=%p off=%#llx\n", inode, file, page,
+#if RTLNX_VER_MIN(6,16,0)
+	       (uint64_t)page->__folio_index << PAGE_SHIFT
+#else
+	       (uint64_t)page->index << PAGE_SHIFT
+#endif
+	      ));
     Assert(PageLocked(page));
 
     if (PageUptodate(page)) {
@@ -3653,7 +3669,11 @@ static int vbsf_readpage(struct file *fi
             vrc = VbglR0SfHostReqReadPgLst(pSuperInfo->map.root,
                                            pReq,
                                            sf_r->Handle.hHost,
+#if RTLNX_VER_MIN(6,16,0)
+                                           (uint64_t)page->__folio_index << PAGE_SHIFT,
+#else
                                            (uint64_t)page->index << PAGE_SHIFT,
+#endif
                                            PAGE_SIZE,
                                            1 /*cPages*/);
 
@@ -3709,16 +3729,28 @@ static int vbsf_writepage(struct page *p
     int                     err;
 
     SFLOGFLOW(("vbsf_writepage: inode=%p page=%p off=%#llx pHandle=%p (%#llx)\n",
-               inode, page, (uint64_t)page->index << PAGE_SHIFT, pHandle, pHandle ? pHandle->hHost : 0));
-
+               inode, page,
+#if RTLNX_VER_MIN(6,16,0)
+	       (uint64_t)page->__folio_index << PAGE_SHIFT,
+#else
+	       (uint64_t)page->index << PAGE_SHIFT,
+#endif
+	       pHandle, pHandle ? pHandle->hHost : 0));
     if (pHandle) {
         struct vbsf_super_info *pSuperInfo = VBSF_GET_SUPER_INFO(inode->i_sb);
         VBOXSFWRITEPGLSTREQ    *pReq       = (VBOXSFWRITEPGLSTREQ *)VbglR0PhysHeapAlloc(sizeof(*pReq));
         if (pReq) {
             uint64_t const cbFile          = i_size_read(inode);
+
+#if RTLNX_VER_MIN(6,16,0)
+            uint64_t const offInFile       = (uint64_t)page->__folio_index << PAGE_SHIFT;
+            uint32_t const cbToWrite       = page->__folio_index != (cbFile >> PAGE_SHIFT) ? PAGE_SIZE
+                                           : (uint32_t)cbFile & (uint32_t)PAGE_OFFSET_MASK;
+#else
             uint64_t const offInFile       = (uint64_t)page->index << PAGE_SHIFT;
             uint32_t const cbToWrite       = page->index != (cbFile >> PAGE_SHIFT) ? PAGE_SIZE
                                            : (uint32_t)cbFile & (uint32_t)PAGE_OFFSET_MASK;
+#endif
             int            vrc;
 
             pReq->PgLst.offFirstPage = 0;
openSUSE Build Service is sponsored by