vmhgfs-bdi-kernel-4.0-tools-9.9.2.patch

转自:https://github.com/rasa/vmware-tools-patches/blob/master/patches/vmhgfs/15-vmhgfs-bdi-kernel-4.0-tools-9.9.2.patch

--- a/filesystem.c
+++ b/filesystem.c
@@ -386,8 +386,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;
@@ -427,6 +437,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);
    }

--- a/module.h
+++ b/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"
@@ -130,6 +131,9 @@ typedef struct HgfsSuperInfo {
    uint32 ttl;                      /* Maximum dentry age (in ticks). */
    char *shareName;                 /* Mounted share name. */
    size_t shareNameLen;             /* To avoid repeated strlen() calls. */
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
+   struct backing_dev_info bdi;
+#endif
 } HgfsSuperInfo;
 
 /*

--- a/super.c
+++ b/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);
 }


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值