milis/talimatname/genel/o/open-vm-tools-kernel/0004-Support-backing-dev-in...

87 lines
2.8 KiB
Diff
Raw Normal View History

2018-06-09 00:06:58 +02:00
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