标签:
以前用ubuntu12.04一直没有问题。最近心血来潮将版本更新到最新后发现共享文件夹不能用了。所以就重新安装vmtools。但是在编译vmhgfs时报错。错误如下:
In file included from ./arch/x86/include/asm/percpu.h:44:0, from ./arch/x86/include/asm/preempt.h:5, from include/linux/preempt.h:18, from include/linux/spinlock.h:50, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/mm.h:9, from include/linux/pagemap.h:7, from /tmp/modconfig-p8BmWh/vmhgfs-only/inode.c:29: /tmp/modconfig-p8BmWh/vmhgfs-only/inode.c: In function ‘HgfsPermission’: include/linux/kernel.h:834:27: error: ‘struct dentry’ has no member named ‘d_alias’ const typeof( ((type *)0)->member ) *__mptr = (ptr); ^ include/linux/list.h:687:40: note: in expansion of macro ‘container_of’ #define hlist_entry(ptr, type, member) container_of(ptr,type,member) ^ include/linux/list.h:698:15: note: in expansion of macro ‘hlist_entry’ ____ptr ? hlist_entry(____ptr, type, member) : NULL;
根据打印信息可以知道是HgfsPermission函数中struct dentry没有成员d_alias。这就奇怪了。上网查了下原因居然是vmware的vmhgfs模块在unbutu最新发行版下存在bug。在安装是需要打补丁或者手动修改一下就可以。下面说明手动修改怎么改。
1.进到vm tools中源码所在的位置
cd vmware-tools-distrib/lib/modules/source
2.解压vmhgfs.tar
sudo tar xf vmhgfs.tar
3.修改文件inode.c
先查看内核的版本。我这里是3.16.0
uname -a Linux ubuntu 3.16.0-38-generic #52-Ubuntu SMP Thu May 7 10:51:21 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
修改vmhggs.tar解压后的文件inode.c.进入vmhgfs-only文件夹中。用vim或者gedit修改
第1925行
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) d_alias) { #else d_u.d_alias) { #endif
第1983行
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) struct dentry *dentry = list_entry(pos, struct dentry, d_alias); #else struct dentry *dentry = list_entry(pos, struct dentry, d_u.d_alias); #endif
3.文件修改完后备份原来的vmhgfs.tar
mv vmhgfs.tar vmhgfs.tar.orig
4.重新打包,用修改后的源码生成新的vmhgfs.tar
tar cf vmhgfs.tar vmhgfs-only
5.按照先前的步骤重新安装即可。
vmtools安装后不能实现开发主机和Linux虚拟机之间的文件夹共享的问题解决
标签:
原文地址:http://www.cnblogs.com/sumingyuan/p/4542228.html