File vbox_fix_4.9_api_changes.patch of Package virtualbox.5880

Index: VirtualBox-5.1.8/src/VBox/Additions/linux/sharedfolders/dirops.c
===================================================================
--- VirtualBox-5.1.8.orig/src/VBox/Additions/linux/sharedfolders/dirops.c
+++ VirtualBox-5.1.8/src/VBox/Additions/linux/sharedfolders/dirops.c
@@ -747,8 +747,14 @@ static int sf_rmdir(struct inode *parent
  * @param new_dentry    new directory cache entry
  * @returns 0 on success, Linux error code otherwise
  */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 9, 0)
 static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,
                      struct inode *new_parent, struct dentry *new_dentry)
+#else
+static int sf_rename(struct inode *old_parent, struct dentry *old_dentry,
+                     struct inode *new_parent, struct dentry *new_dentry,
+		     unsigned int flags)
+#endif
 {
     int err = 0, rc = VINF_SUCCESS;
     struct sf_glob_info *sf_g = GET_GLOB_INFO(old_parent->i_sb);
Index: VirtualBox-5.1.8/src/VBox/Additions/linux/drm/vbox_ttm.c
===================================================================
--- VirtualBox-5.1.8.orig/src/VBox/Additions/linux/drm/vbox_ttm.c
+++ VirtualBox-5.1.8/src/VBox/Additions/linux/drm/vbox_ttm.c
@@ -221,7 +221,8 @@ static int vbox_bo_move(struct ttm_buffe
                struct ttm_mem_reg *new_mem)
 {
     int r;
-#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) || \
+    LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
     r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
 #else
     r = ttm_bo_move_memcpy(bo, evict, interruptible, no_wait_gpu, new_mem);
Index: VirtualBox-5.1.8/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- VirtualBox-5.1.8.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ VirtualBox-5.1.8/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -1045,7 +1045,27 @@ DECLHIDDEN(int) rtR0MemObjNativeLockUser
         /*
          * Get user pages.
          */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)
+        if (R0Process == RTR0ProcHandleSelf())
+            rc = get_user_pages(R3Ptr,                  /* Where from. */
+                                cPages,                 /* How many pages. */
+                                fWrite,                 /* Write to memory. */
+                                &pMemLnx->apPages[0],   /* Page array. */
+                                papVMAs);               /* vmas */
+        /*
+         * Actually this should not happen at the moment as call this function
+         * only for our own process.
+         */
+        else
+            rc = get_user_pages_remote(
+                                pTask,                  /* Task for fault accounting. */
+                                pTask->mm,              /* Whose pages. */
+                                R3Ptr,                  /* Where from. */
+                                cPages,                 /* How many pages. */
+                                fWrite,                 /* Write to memory. */
+                                &pMemLnx->apPages[0],   /* Page array. */
+                                papVMAs);               /* vmas */
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)
         if (R0Process == RTR0ProcHandleSelf())
             rc = get_user_pages(R3Ptr,                  /* Where from. */
                                 cPages,                 /* How many pages. */
openSUSE Build Service is sponsored by