OSDN Git Service

[add] : Added packages
[alterlinux/hayao-aur-packages.git] / open-vm-tools-dkms / 0004-Support-backing-dev-info-kernel-4.0.patch
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 ---
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(+)
11
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
17        return PTR_ERR(si);
18     }
19     HGFS_SET_SB_TO_COMMON(sb, si);
20 +
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");
24 +   if (result) {
25 +      kfree(si->shareName);
26 +      kfree(si);
27 +   }
28 +#endif
29 +
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;
34 +#endif
35  
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
39    exit:
40     if (result) {
41        dput(rootDentry);
42 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
43 +      bdi_destroy(&si->bdi);
44 +#endif
45        kfree(si->shareName);
46        kfree(si);
47     }
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
52 @@ -29,6 +29,7 @@
53  #include "driver-config.h"
54  
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;
66 +#endif
67  } HgfsSuperInfo;
68  
69  /*
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
75  
76     si = HGFS_SB_TO_COMMON(sb);
77  
78 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
79 +   bdi_destroy(&si->bdi);
80 +#endif
81     kfree(si->shareName);
82     kfree(si);
83  }
84 -- 
85 2.3.6
86