在VMware 10下安装CentOS 7.0后,在安装VMware Tools时会报错,导致虚拟机的共享文件夹无法正常添加,如果使用使用最小化安装,拷贝文件什么的还是挺麻烦的
处理方法:将WMware Tools 的.tar.gz压缩包拷贝到tmp目录下,解压出vmware-tools-distrib文件夹
在vmware-tools-distrib/lib/modules/source下找到vmhgts.tar,将里面的vmhgfs-only文件夹解压出来修改如下信息
1. 错误信息
/tmp/modconfig-3GKV5K/vmhgfs-only/filesystem.c: In function ‘HgfsInitSuperInfo’:
/tmp/modconfig-3GKV5K/vmhgfs-only/filesystem.c:234:15: error: incompatible types when assigning to type ‘uid_t’ from type ‘kuid_t’
si->uid = current_uid();
/tmp/modconfig-3GKV5K/vmhgfs-only/filesystem.c:240:15: error: incompatible types when assigning to type ‘gid_t’ from type ‘kgid_t’
si->gid = current_gid();
1.1 vmhgfs-only / file.c
HgfsSetUidGid(iparent, file->f_dentry,
current_fsuid(), current_fsgid());
修改为
HgfsSetUidGid(iparent, file->f_dentry,
__kuid_val(current_fsuid()),
__kgid_val(current_fsgid()));
1.2 vmhgfs-only / filesystem.c
if (si->uidSet) {
si->uid = mountInfo->uid;
} else {
si->uid = current_uid();
}
si->gidSet = mountInfo->gidSet;
if (si->gidSet) {
si->gid = mountInfo->gid;
} else {
si->gid = current_gid();
}
if (si->uidSet) {
si->uid = mountInfo->uid;
} else {
si->uid = __kuid_val(current_uid());
}
si->gidSet = mountInfo->gidSet;
if (si->gidSet) {
si->gid = mountInfo->gid;
} else {
si->gid = __kgid_val(current_gid());
}
1.3 vmhgfs-only / fsutil.c
if (si->uidSet || (attr->mask & HGFS_ATTR_VALID_USERID) == 0) {
inode->i_uid = si->uid;
} else {
inode->i_uid = attr->userId;
}
if (si->gidSet || (attr->mask & HGFS_ATTR_VALID_GROUPID) == 0) {
inode->i_gid = si->gid;
} else {
inode->i_gid = attr->groupId;
}
if (si->uidSet || (attr->mask & HGFS_ATTR_VALID_USERID) == 0) {
inode->i_uid = KUIDT_INIT(si->uid);
} else {
inode->i_uid = KUIDT_INIT(attr->userId);
}
if (si->gidSet || (attr->mask & HGFS_ATTR_VALID_GROUPID) == 0) {
inode->i_gid = KGIDT_INIT(si->gid);
} else {
inode->i_gid = KGIDT_INIT(attr->groupId);
}
1.4 vmhgfs-only / inode.c
HgfsSetUidGid(dir, dentry, current_fsuid(), current_fsgid());
修改为
HgfsSetUidGid(dir, dentry, __kuid_val(current_fsuid()), __kgid_val(current_fsgid()));
2. 错误信息:
/tmp/modconfig-3GKV5K/vmhgfs-only/inode.c: In function ‘HgfsPermission':
/tmp/modconfig-3GKV5K/vmhgfs-only/./shared/compat_dcache.h:57:38: error: ‘struct dentry’ has no member named ‘d_count’
#define compat_d_count(dentry) dentry->d_count
/tmp/modconfig-3GKV5K/vmhgfs-only/inode.c:1904:23: note: in expansion of macro ‘compat_d_count
修改vmhgfs-only/compat_dcache.h
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)