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