您的位置:首页 > 其它

ubuntu-13.10安装vmware tools报struct dentry’ has no member named ‘d_count错,修正方法

2013-11-24 11:04 441 查看
在安装vmware tools时,报错如下

/tmp/modconfig-76hAvV/vmhgfs-only/inode.c: In function ‘HgfsPermission’:

/tmp/modconfig-76hAvV/vmhgfs-only/inode.c:1893:29: error: ‘struct dentry’ has no member named ‘d_count’

int dcount = dentry->d_count;

网上查了有许多网友遇到该问题,原因是内核版本太高,下了补丁和脚本,修复不了,于是再找相关资料研究了下

http://www.cnblogs.com/SelaSelah/archive/2013/05/05/3060671.html

以上链接问题类似,写得很好,不过修正点稍有不同

报错是在文件inode.c,解压vmware tools,在以下路径找到inode.c文件:

vmware-tools-distrib/lib/modules/source/vmhgfs-only

打开该文件,找到出错代码如下:



hlist_for_each_entry(dentry,

#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0)

p,

#endif

&inode->i_dentry,

d_alias) {

int dcount = dentry->d_count; //这里调用d_count失败

if (dcount) {

LOG(4, ("Found %s %d \n", dentry->d_name.name, dcount));

return HgfsAccessInt(dentry, mask & (MAY_READ | MAY_WRITE | MAY_EXEC));

}

}

ASSERT(FALSE);

很高兴看到最后有一句ASSERT(FALSE);,表示代码不会执行到这里,那么就要在之前返回,于是乎判断dcount值!=0,

因此将int dount=dentry->d_count改为int dcount =1;当然也可以将dcount变量去掉

保存后,删除vmhgfs.tar,再执行tar -cf vmhgfs.tar vmhgfs-only生成新的vmhgfs.tar

回到vmware-tools-distrib目录,./vmware-install.pl执行vmware-install.pl大功告成!

PS:

查看了下当前内核版本:cat /proc/version

显示:Linux version 3.11.0-12-generic (buildd@allspice) (gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu7) ) #19-Ubuntu SMP Wed Oct 9 16:20:46 UTC 2013

可看到内核为:Linux version 3.11.0-12,纠心了下,非稳定版本,既然跟内核版本有关,那么下个该内核源码来确认下问题

https://www.kernel.org/pub/linux/kernel/v3.x/下载linux 3.11.1(未找到3.11.0)

查看刚才下载的内核源码3.11.1中的inode定义如下:

struct dentry {

/* RCU lookup touched fields */

unsigned int d_flags; /* protected by d_lock */

seqcount_t d_seq; /* per dentry seqlock */

struct hlist_bl_node d_hash; /* lookup hash list */

struct dentry *d_parent; /* parent directory */

struct qstr d_name;

struct inode *d_inode; /* Where the name belongs to - NULL is

* negative */

unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */

/* Ref lookup also touches following */

struct lockref d_lockref; /* per-dentry lock and refcount */

const struct dentry_operations *d_op;

struct super_block *d_sb; /* The root of the dentry tree */

unsigned long d_time; /* used by d_revalidate */

void *d_fsdata; /* fs-specific data */

struct list_head d_lru; /* LRU list */

/*

* d_child and d_rcu can share memory

*/

union {

struct list_head d_child; /* child of parent list */

struct rcu_head d_rcu;

} d_u;

struct list_head d_subdirs; /* our children */

struct hlist_node d_alias; /* inode alias list */

};

该结构体确实没有d_count,于是报错

以上不妥之处,欢迎朋友们斧正
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐