0006-vmhgfs-support-linux-4.2.x-kernel.patch 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From b3a634a491da35d47a5e6e6120a21cba514fc3ec Mon Sep 17 00:00:00 2001
  2. From: JackM
  3. Date: Wed, 30 Sep 2015 23:16:40 +0300
  4. Subject: [PATCH] vmhgfs support linux 4.2.x kernel
  5. ---
  6. modules/linux/vmhgfs/link.c | 30 +++++++++++++++++++++++++-----
  7. 1 file changed, 25 insertions(+), 5 deletions(-)
  8. diff --git a/open-vm-tools/modules/linux/vmhgfs/link.c b/open-vm-tools/modules/linux/vmhgfs/link.c
  9. index 06f693b..72e97ff 100644
  10. --- a/open-vm-tools/modules/linux/vmhgfs/link.c
  11. +++ b/open-vm-tools/modules/linux/vmhgfs/link.c
  12. @@ -35,7 +35,9 @@
  13. #include "vm_assert.h"
  14. /* HGFS symlink operations. */
  15. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  16. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  17. +static void *HgfsFollowlink(struct dentry *dentry, void **cookie, struct nameidata *nd);
  18. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  19. static void *HgfsFollowlink(struct dentry *dentry,
  20. struct nameidata *nd);
  21. #else
  22. @@ -45,7 +47,10 @@ static int HgfsFollowlink(struct dentry *dentry,
  23. static int HgfsReadlink(struct dentry *dentry,
  24. char __user *buffer,
  25. int buflen);
  26. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  27. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  28. +static void HgfsPutlink(struct dentry *dentry,
  29. + void *cookie);
  30. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  31. static void HgfsPutlink(struct dentry *dentry,
  32. struct nameidata *nd,
  33. void *cookie);
  34. @@ -85,7 +90,9 @@ struct inode_operations HgfsLinkInodeOperations = {
  35. *----------------------------------------------------------------------
  36. */
  37. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  38. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  39. +static void *HgfsFollowlink(struct dentry *dentry, void **cookie, struct nameidata *nd)
  40. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  41. static void *
  42. HgfsFollowlink(struct dentry *dentry, // IN: Dentry containing link
  43. struct nameidata *nd) // OUT: Contains target dentry
  44. @@ -124,7 +131,11 @@ HgfsFollowlink(struct dentry *dentry, // IN: Dentry containing link
  45. } else {
  46. LOG(6, (KERN_DEBUG "VMware hgfs: %s: calling nd_set_link %s\n",
  47. __func__, fileName));
  48. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  49. + *cookie = fileName;
  50. +#else
  51. nd_set_link(nd, fileName);
  52. +#endif
  53. }
  54. }
  55. out:
  56. @@ -219,7 +230,10 @@ HgfsReadlink(struct dentry *dentry, // IN: Dentry containing link
  57. *----------------------------------------------------------------------
  58. */
  59. -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  60. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  61. +static void HgfsPutlink(struct dentry *dentry,
  62. + void *cookie)
  63. +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
  64. static void
  65. HgfsPutlink(struct dentry *dentry, // dentry
  66. struct nameidata *nd, // lookup name information
  67. @@ -235,11 +249,17 @@ HgfsPutlink(struct dentry *dentry, // dentry
  68. LOG(6, (KERN_DEBUG "VMware hgfs: %s: put for %s\n",
  69. __func__, dentry->d_name.name));
  70. - fileName = nd_get_link(nd);
  71. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
  72. + fileName = cookie;
  73. +#else
  74. + fileName = nd_get_link(nd);
  75. +#endif
  76. if (!IS_ERR(fileName)) {
  77. LOG(6, (KERN_DEBUG "VMware hgfs: %s: putting %s\n",
  78. __func__, fileName));
  79. kfree(fileName);
  80. +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0)
  81. nd_set_link(nd, NULL);
  82. +#endif
  83. }
  84. }
  85. --
  86. 2.5.0.windows.1