Vmware Tools安装过程,如果出现vmhgfs编译出错,会造成共享文件夹不可用,提示“无法更新运行时文件夹共享状态: 在客户机操作系统中装载共享文件夹”。
解决方法:
cd vmware-tools-distrib/lib/modules/source
tar xf vmhgfs.tar
解压出vmhgfs-only文件夹,对下面提到的错误文件进行修改(修改前先改文件属性为可写),修改后重新打包再安装。
tar cf vmhgfs.tar vmhgfs-only
sudo ./vmware-install.pl
错误一:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c: Infunction ‘HgfsPackDirOpenRequest’:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:417:26:error: ‘struct file’ has no member named ‘f_dentry’
file->f_dentry) < 0) {
^
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c: Infunction ‘HgfsDirLlseek’:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:707:32:error: ‘struct file’ has no member named ‘f_dentry’
struct dentry *dentry = file->f_dentry;
^
In file included from/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:39:0:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c: Infunction ‘HgfsReaddirNextEntry’:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:993:31:error: ‘struct file’ has no member named ‘f_dentry’
si = HGFS_SB_TO_COMMON(file->f_dentry->d_inode->i_sb);
^
/tmp/modconfig-VTzwHO/vmhgfs-only/module.h:89:62:note: in definition of macro ‘HGFS_SB_TO_COMMON’
#define HGFS_SB_TO_COMMON(sb) ((HgfsSuperInfo *)(sb)->s_fs_info)
^
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:1082:26:error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = file->f_dentry->d_inode->i_ino;
^
In file included from/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:30:0:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:1088:44:error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = compat_parent_ino(file->f_dentry);
^
/tmp/modconfig-VTzwHO/vmhgfs-only/./shared/compat_fs.h:120:46:note: in definition of macro ‘compat_parent_ino’
#define compat_parent_ino(dentry) parent_ino(dentry)
^
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:1093:52:error: ‘struct file’ has no member named ‘f_dentry’
*entryIno = HgfsGetFileInode(&entryAttrs,file->f_dentry->d_inode->i_sb);
^
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c: Infunction ‘HgfsDoReaddir’:
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:1173:13:error: ‘struct file’ has no member named ‘f_dentry’
!(file->f_dentry) ||
^
/tmp/modconfig-VTzwHO/vmhgfs-only/dir.c:1174:13:error: ‘struct file’ has no member named ‘f_dentry’
!(file->f_dentry->d_inode)) {
^
make[2]: ***[/tmp/modconfig-VTzwHO/vmhgfs-only/dir.o] Error 1
make[1]: ***[_module_/tmp/modconfig-VTzwHO/vmhgfs-only] Error 2
make[1]: Leaving directory`/usr/src/linux-headers-3.19.0-25-generic'
make: *** [vmhgfs.ko] Error 2
make: Leaving directory`/tmp/modconfig-VTzwHO/vmhgfs-only'
解决:将vmhgfs-only/dir.c,vmhgfs-only/page.c,vmhgfs-only/file.c,vmhgfs-only/fsutil.c等文件里的f_dentry替换成f_path.dentry。
错误二:
In file included frominclude/linux/list.h:8:0,
from include/linux/preempt.h:10,
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-E9Upvb/vmhgfs-only/inode.c:29:
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:In function ‘HgfsPermission’:
include/linux/kernel.h:811:27: error:‘struct dentry’ has no member named ‘d_alias’
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#define hlist_entry(ptr, type, member)container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: inexpansion of macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:709:13: note: inexpansion of macro ‘hlist_entry_safe’
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
include/linux/kernel.h:811:48: warning:initialization from incompatible pointer type [enabled by default]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#define hlist_entry(ptr, type, member)container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: inexpansion of macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:709:13: note: inexpansion of macro ‘hlist_entry_safe’
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
In file included frominclude/linux/compiler-gcc.h:106:0,
from include/linux/compiler.h:54,
from include/uapi/linux/stddef.h:1,
from include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from/tmp/modconfig-E9Upvb/vmhgfs-only/./shared/driver-config.h:71,
from /tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:26:
include/linux/compiler-gcc4.h:14:34: error:‘struct dentry’ has no member named ‘d_alias’
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
^
include/linux/stddef.h:17:31: note: inexpansion of macro ‘__compiler_offsetof’
#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
^
include/linux/kernel.h:812:29: note: inexpansion of macro ‘offsetof’
(type *)( (char *)__mptr - offsetof(type,member) );})
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#define hlist_entry(ptr, type, member)container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: inexpansion of macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:709:13: note: inexpansion of macro ‘hlist_entry_safe’
for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
In file included frominclude/linux/preempt.h:10:0,
from include/linux/spinlock.h:50,
from include/linux/mmzone.h:7,
frominclude/linux/gfp.h:5,
from include/linux/mm.h:9,
from include/linux/pagemap.h:7,
from /tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:29:
include/linux/list.h:711:35: error: ‘structdentry’ has no member named ‘d_alias’
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
^
include/linux/list.h:698:12: note: indefinition of macro ‘hlist_entry_safe’
({typeof(ptr) ____ptr = (ptr); \
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
include/linux/list.h:711:35: error: ‘structdentry’ has no member named ‘d_alias’
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
^
include/linux/list.h:698:28: note: indefinition of macro ‘hlist_entry_safe’
({typeof(ptr) ____ptr = (ptr); \
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
In file included frominclude/linux/list.h:8:0,
from include/linux/preempt.h:10,
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-E9Upvb/vmhgfs-only/inode.c:29:
include/linux/kernel.h:811:27: error:‘struct dentry’ has no member named ‘d_alias’
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#define hlist_entry(ptr, type, member)container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: inexpansion of macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:711:13: note: inexpansion of macro ‘hlist_entry_safe’
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
include/linux/kernel.h:811:48: warning:initialization makes pointer from integer without a cast [enabled by default]
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#define hlist_entry(ptr, type, member)container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: in expansionof macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:711:13: note: inexpansion of macro ‘hlist_entry_safe’
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
^
In file included frominclude/linux/compiler-gcc.h:106:0,
from include/linux/compiler.h:54,
from include/uapi/linux/stddef.h:1,
from include/linux/stddef.h:4,
from ./include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from/tmp/modconfig-E9Upvb/vmhgfs-only/./shared/driver-config.h:71,
from /tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:26:
include/linux/compiler-gcc4.h:14:34: error:‘struct dentry’ has no member named ‘d_alias’
#define __compiler_offsetof(a,b) __builtin_offsetof(a,b)
^
include/linux/stddef.h:17:31: note: inexpansion of macro ‘__compiler_offsetof’
#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
^
include/linux/kernel.h:812:29: note: inexpansion of macro ‘offsetof’
(type *)( (char *)__mptr - offsetof(type,member) );})
^
include/linux/list.h:688:40: note: inexpansion of macro ‘container_of’
#definehlist_entry(ptr, type, member) container_of(ptr,type,member)
^
include/linux/list.h:699:15: note: inexpansion of macro ‘hlist_entry’
____ptr ? hlist_entry(____ptr, type, member) : NULL; \
^
include/linux/list.h:711:13: note: inexpansion of macro ‘hlist_entry_safe’
pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member))
^
/tmp/modconfig-E9Upvb/vmhgfs-only/inode.c:1922:7:note: in expansion of macro ‘hlist_for_each_entry’
hlist_for_each_entry(dentry,
解决:将vmhgfs-only/inode.c文件里的d_alias 替换成d_u.d_alias。
错误三:
/tmp/modconfig-4aUBme/vmhgfs-only/page.c:In function ‘HgfsWbRequestUnlock’:
/tmp/modconfig-4aUBme/vmhgfs-only/page.c:1681:4:error: implicit declaration of function ‘smp_mb__before_clear_bit’[-Werror=implicit-function-declaration]
smp_mb__before_clear_bit();
^
/tmp/modconfig-4aUBme/vmhgfs-only/page.c:1683:4:error: implicit declaration of function ‘smp_mb__after_clear_bit’[-Werror=implicit-function-declaration]
smp_mb__after_clear_bit();
^
cc1: some warnings being treated as errors
make[2]: ***[/tmp/modconfig-4aUBme/vmhgfs-only/page.o] Error 1
make[1]: ***[_module_/tmp/modconfig-4aUBme/vmhgfs-only] Error 2
解决:将vmhgfs-only/page.c文件里的smp_mb__before_clear_bit();和smp_mb__after_clear_bit();摒蔽。