標籤:
在centos虛機安裝vmtools過程中有如下報錯
/tmp/modconfig-ygOywn/vmhgfs-only/inode.c: 在函數‘HgfsPermission’中: tmp/modconfig-ygOywn/vmhgfs-only/./shared/compat_dcache.h:57:38: 錯誤:‘struct dentry’沒有名為‘d_count’的成員 #define compat_d_count(dentry) dentry->d_count ^ /tmp/modconfig-ygOywn/vmhgfs-only/inode.c:1904:23: 附註:in expansion of macro compat_d_count’ int dcount = compat_d_count(dentry);
這就導致虛機centos無法和windows共用目錄了, 需要留意的是,centos虛機的解決辦法是不同於ubuntu虛機的。
這裡, 我們需要修改源碼compat_dcacche中的.h檔案
[root@localhost ~]# cd /tmp/vmware-tools-distrib/lib/modules/source/
[root@localhost source]# tar -xf vmhgfs.tar –解壓vmhgfs.tar,裡面有個vmhgfs-only檔案夾
[root@localhost source]# cd vmhgfs-only/–進入解壓後目錄
[root@localhost vmhgfs-only]# cd shared/
[root@localhost shared]# vim compat_dcache.h–開啟標頭檔
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)#define compat_d_count(dentry) d_count(dentry)#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)#define compat_d_count(dentry) dentry->d_count#else#define compat_d_count(dentry) atomic_read(&dentry->d_count);#endif
這裡報錯了,不知道為什麼這樣,將
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
下面的#define改成
#define compat_d_count(dentry) d_count(dentry)
改完源碼後,重新歸檔
[root@localhost source]# tar -cf vmhgfs.tar vmhgfs-only/
[root@localhost source] cd /tmp/vmware-tools-distrib
[root@localhost vmware-tools-distrib]# ./vmware-install.p
重新安裝。這下成功了。。。
轉載一篇解決windows和centos虛擬機器共用主機目錄問題的方法,方法不同於ubuntu虛機