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.
7 open-vm-tools/modules/linux/vmhgfs/filesystem.c | 16 ++++++++++++++++
8 open-vm-tools/modules/linux/vmhgfs/module.h | 4 ++++
9 open-vm-tools/modules/linux/vmhgfs/super.c | 3 +++
10 3 files changed, 23 insertions(+)
12 diff --git a/open-vm-tools/modules/linux/vmhgfs/filesystem.c b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
13 index 10dd8ab..3148091 100644
14 --- a/open-vm-tools/modules/linux/vmhgfs/filesystem.c
15 +++ b/open-vm-tools/modules/linux/vmhgfs/filesystem.c
16 @@ -398,8 +398,21 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
19 HGFS_SET_SB_TO_COMMON(sb, si);
21 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
22 + memset(&si->bdi, 0, sizeof(si->bdi));
23 + result = bdi_setup_and_register(&si->bdi, "vmhgfs");
25 + kfree(si->shareName);
30 sb->s_magic = HGFS_SUPER_MAGIC;
31 sb->s_op = &HgfsSuperOperations;
32 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
33 + sb->s_bdi = &si->bdi;
36 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
37 sb->s_d_op = &HgfsDentryOperations;
38 @@ -439,6 +452,9 @@ HgfsReadSuper(struct super_block *sb, // OUT: Superblock object
42 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
43 + bdi_destroy(&si->bdi);
48 diff --git a/open-vm-tools/modules/linux/vmhgfs/module.h b/open-vm-tools/modules/linux/vmhgfs/module.h
49 index b673dc1..f3eeffc 100644
50 --- a/open-vm-tools/modules/linux/vmhgfs/module.h
51 +++ b/open-vm-tools/modules/linux/vmhgfs/module.h
53 #include "driver-config.h"
55 #include <asm/atomic.h>
56 +#include <linux/backing-dev.h>
57 #include "compat_fs.h"
58 #include "compat_semaphore.h"
59 #include "compat_slab.h"
60 @@ -144,6 +145,9 @@ typedef struct HgfsSuperInfo {
61 char *shareName; /* Mounted share name. */
62 size_t shareNameLen; /* To avoid repeated strlen() calls. */
63 uint32 mntFlags; /* HGFS mount flags */
64 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
65 + struct backing_dev_info bdi;
70 diff --git a/open-vm-tools/modules/linux/vmhgfs/super.c b/open-vm-tools/modules/linux/vmhgfs/super.c
71 index 04a2192..41f8713 100644
72 --- a/open-vm-tools/modules/linux/vmhgfs/super.c
73 +++ b/open-vm-tools/modules/linux/vmhgfs/super.c
74 @@ -152,6 +152,9 @@ HgfsPutSuper(struct super_block *sb) // IN: The superblock
76 si = HGFS_SB_TO_COMMON(sb);
78 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
79 + bdi_destroy(&si->bdi);