0004-Support-backing-dev-info-kernel-4.0.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From 122f184d946a007a7ba3ae68386a20f33ed62e1e Mon Sep 17 00:00:00 2001
  2. From: lotan <lotan@gmx.de>
  3. Date: Mon, 8 Jun 2015 14:20:06 +0200
  4. Subject: [PATCH] Support backing dev info kernel 4.0.
  5. ---
  6. open-vm-tools/modules/linux/vmhgfs/filesystem.c | 16 ++++++++++++++++
  7. open-vm-tools/modules/linux/vmhgfs/module.h | 4 ++++
  8. open-vm-tools/modules/linux/vmhgfs/super.c | 3 +++
  9. 3 files changed, 23 insertions(+)
  10. diff --git a/open-vm-tools/modules/linux/vmhgfs/filesystem.c b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
  11. index 10dd8ab..3148091 100644
  12. --- a/open-vm-tools/modules/linux/vmhgfs/filesystem.c
  13. +++ b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
  14. @@ -398,8 +398,21 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
  15. return PTR_ERR(si);
  16. }
  17. HGFS_SET_SB_TO_COMMON(sb, si);
  18. +
  19. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
  20. + memset(&si->bdi, 0, sizeof(si->bdi));
  21. + result = bdi_setup_and_register(&si->bdi, "vmhgfs");
  22. + if (result) {
  23. + kfree(si->shareName);
  24. + kfree(si);
  25. + }
  26. +#endif
  27. +
  28. sb->s_magic = HGFS_SUPER_MAGIC;
  29. sb->s_op = &HgfsSuperOperations;
  30. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
  31. + sb->s_bdi = &si->bdi;
  32. +#endif
  33. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
  34. sb->s_d_op = &HgfsDentryOperations;
  35. @@ -439,6 +452,9 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
  36. exit:
  37. if (result) {
  38. dput(rootDentry);
  39. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
  40. + bdi_destroy(&si->bdi);
  41. +#endif
  42. kfree(si->shareName);
  43. kfree(si);
  44. }
  45. diff --git a/open-vm-tools/modules/linux/vmhgfs/module.h b/open-vm-tools/modules/linux/vmhgfs/module.h
  46. index b673dc1..f3eeffc 100644
  47. --- a/open-vm-tools/modules/linux/vmhgfs/module.h
  48. +++ b/open-vm-tools/modules/linux/vmhgfs/module.h
  49. @@ -29,6 +29,7 @@
  50. #include "driver-config.h"
  51. #include <asm/atomic.h>
  52. +#include <linux/backing-dev.h>
  53. #include "compat_fs.h"
  54. #include "compat_semaphore.h"
  55. #include "compat_slab.h"
  56. @@ -144,6 +145,9 @@ typedef struct HgfsSuperInfo {
  57. char *shareName; /* Mounted share name. */
  58. size_t shareNameLen; /* To avoid repeated strlen() calls. */
  59. uint32 mntFlags; /* HGFS mount flags */
  60. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
  61. + struct backing_dev_info bdi;
  62. +#endif
  63. } HgfsSuperInfo;
  64. /*
  65. diff --git a/open-vm-tools/modules/linux/vmhgfs/super.c b/open-vm-tools/modules/linux/vmhgfs/super.c
  66. index 04a2192..41f8713 100644
  67. --- a/open-vm-tools/modules/linux/vmhgfs/super.c
  68. +++ b/open-vm-tools/modules/linux/vmhgfs/super.c
  69. @@ -152,6 +152,9 @@ HgfsPutSuper(struct super_block *sb) // IN: The superblock
  70. si = HGFS_SB_TO_COMMON(sb);
  71. +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
  72. + bdi_destroy(&si->bdi);
  73. +#endif
  74. kfree(si->shareName);
  75. kfree(si);
  76. }
  77. --
  78. 2.3.6