Advertisement
tasuku

Untitled

Aug 1st, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.97 KB | None | 0 0
  1. diff --git a/vmblock-only/linux/inode.c b/vmblock-only/linux/inode.c
  2. index 5991f3d..987b50d 100644
  3. --- a/vmblock-only/linux/inode.c
  4. +++ b/vmblock-only/linux/inode.c
  5. @@ -44,7 +44,9 @@ static struct dentry *InodeOpLookup(struct inode *, struct dentry *, unsigned in
  6.  static int InodeOpReadlink(struct dentry *, char __user *, int);
  7.  #endif
  8.  
  9. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
  10. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  11. +static const char *InodeOpFollowlink(struct dentry *dentry, struct inode *inode, struct delayed_call *delayed_call);
  12. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
  13.  static const char *InodeOpFollowlink(struct dentry *dentry, struct inode *inode, void **cookie);
  14.  #elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
  15.  static const char *InodeOpFollowlink(struct dentry *dentry, void **cookie);
  16. @@ -240,7 +242,9 @@ InodeOpFollowlink(struct dentry *dentry,  // IN : dentry of symlink
  17.  #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 99)
  18.                    struct inode *inode,
  19.  #endif
  20. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
  21. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  22. +                  struct delayed_call *delayed_call) // OUT:
  23. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
  24.                    void **cookie)          // OUT: stores opaque pointer
  25.  #else
  26.                    struct nameidata *nd)   // OUT: stores result
  27. @@ -269,7 +273,9 @@ InodeOpFollowlink(struct dentry *dentry,  // IN : dentry of symlink
  28.        goto out;
  29.     }
  30.  
  31. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
  32. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  33. +   return iinfo->name;
  34. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(4, 1, 99)
  35.     return *cookie = iinfo->name;
  36.  #else
  37.     nd_set_link(nd, iinfo->name);
  38. diff --git a/vmci-only/linux/driver.c b/vmci-only/linux/driver.c
  39. index 759b28a..edc72d4 100644
  40. --- a/vmci-only/linux/driver.c
  41. +++ b/vmci-only/linux/driver.c
  42. @@ -1468,8 +1468,13 @@ VMCIUserVALockPage(VA addr) // IN:
  43.     int retval;
  44.  
  45.     down_read(&current->mm->mmap_sem);
  46. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  47. +   retval = get_user_pages(addr,
  48. +                           1, 1, 0, &page, NULL);
  49. +#else
  50.     retval = get_user_pages(current, current->mm, addr,
  51.                             1, 1, 0, &page, NULL);
  52. +#endif
  53.     up_read(&current->mm->mmap_sem);
  54.  
  55.     if (retval != 1) {
  56. diff --git a/vmci-only/linux/vmciKernelIf.c b/vmci-only/linux/vmciKernelIf.c
  57. index a8512ed..e119f4e 100644
  58. --- a/vmci-only/linux/vmciKernelIf.c
  59. +++ b/vmci-only/linux/vmciKernelIf.c
  60. @@ -1835,7 +1835,11 @@ VMCIReleasePages(struct page **pages,  // IN
  61.        if (dirty) {
  62.           set_page_dirty(pages[i]);
  63.        }
  64. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  65. +      put_page(pages[i]);
  66. +#else
  67.        page_cache_release(pages[i]);
  68. +#endif
  69.        pages[i] = NULL;
  70.     }
  71.  }
  72. @@ -2049,6 +2053,13 @@ VMCIHost_GetUserMemory(VA64 produceUVA,       // IN
  73.     int err = VMCI_SUCCESS;
  74.  
  75.     down_write(&current->mm->mmap_sem);
  76. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  77. +   retval = get_user_pages((VA)produceUVA,
  78. +                           produceQ->kernelIf->numPages,
  79. +                           1, 0,
  80. +                           produceQ->kernelIf->u.h.headerPage,
  81. +                           NULL);
  82. +#else
  83.     retval = get_user_pages(current,
  84.                             current->mm,
  85.                             (VA)produceUVA,
  86. @@ -2056,6 +2067,7 @@ VMCIHost_GetUserMemory(VA64 produceUVA,       // IN
  87.                             1, 0,
  88.                             produceQ->kernelIf->u.h.headerPage,
  89.                             NULL);
  90. +#endif
  91.     if (retval < produceQ->kernelIf->numPages) {
  92.        Log("get_user_pages(produce) failed (retval=%d)\n", retval);
  93.        VMCIReleasePages(produceQ->kernelIf->u.h.headerPage, retval, FALSE);
  94. @@ -2063,6 +2075,13 @@ VMCIHost_GetUserMemory(VA64 produceUVA,       // IN
  95.        goto out;
  96.     }
  97.  
  98. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  99. +   retval = get_user_pages((VA)consumeUVA,
  100. +                           consumeQ->kernelIf->numPages,
  101. +                           1, 0,
  102. +                           consumeQ->kernelIf->u.h.headerPage,
  103. +                           NULL);
  104. +#else
  105.     retval = get_user_pages(current,
  106.                             current->mm,
  107.                             (VA)consumeUVA,
  108. @@ -2070,6 +2089,7 @@ VMCIHost_GetUserMemory(VA64 produceUVA,       // IN
  109.                             1, 0,
  110.                             consumeQ->kernelIf->u.h.headerPage,
  111.                             NULL);
  112. +#endif
  113.     if (retval < consumeQ->kernelIf->numPages) {
  114.        Log("get_user_pages(consume) failed (retval=%d)\n", retval);
  115.        VMCIReleasePages(consumeQ->kernelIf->u.h.headerPage, retval, FALSE);
  116. diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
  117. index 918e8ce..20f450c 100644
  118. --- a/vmmon-only/linux/hostif.c
  119. +++ b/vmmon-only/linux/hostif.c
  120. @@ -1163,8 +1163,13 @@ HostIFGetUserPages(void *uvAddr,          // IN
  121.     int retval;
  122.  
  123.     down_read(&current->mm->mmap_sem);
  124. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  125. +   retval = get_user_pages((unsigned long)uvAddr,
  126. +                           numPages, 0, 0, ppages, NULL);
  127. +#else
  128.     retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
  129.                             numPages, 0, 0, ppages, NULL);
  130. +#endif
  131.     up_read(&current->mm->mmap_sem);
  132.  
  133.     return retval != numPages;
  134. diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
  135. index 4e457ba..b2b8059 100644
  136. --- a/vmnet-only/userif.c
  137. +++ b/vmnet-only/userif.c
  138. @@ -113,8 +113,13 @@ UserifLockPage(VA addr) // IN
  139.     int retval;
  140.  
  141.     down_read(&current->mm->mmap_sem);
  142. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 99)
  143. +   retval = get_user_pages(addr,
  144. +                          1, 1, 0, &page, NULL);
  145. +#else
  146.     retval = get_user_pages(current, current->mm, addr,
  147.                            1, 1, 0, &page, NULL);
  148. +#endif
  149.     up_read(&current->mm->mmap_sem);
  150.  
  151.     if (retval != 1) {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement