VM12安装centos7安装VMare-tool后,hgfs下没有共享文件夹

原文地址:http://blog.csdn.net/a39206821/article/details/54313326

在VM上安装了CentOS虚拟机,想使用共享文件夹,安装VMwareTools,hgfs下找不到响应的目录,但是使用vmware-hgfsclient命令 却能看到我设置的共享目录. 

仔细再进行了一遍检查,发现在安装VMwareTools时编译报错. 
报错如下

CC [M]  /tmp/modconfig-71euqe/vmhgfs-only/page.o

/tmp/modconfig-71euqe/vmhgfs-only/page.c: In functionHgfsWbRequestWait’:

/tmp/modconfig-71euqe/vmhgfs-only/page.c:1649:23: warning: passing argument 3 of ‘wait_on_bit’ makes integer from pointer without a cast [enabled by default]

                       TASK_UNINTERRUPTIBLE);

                       ^

In file included from include/linux/mmzone.h:9:0,

                 from include/linux/gfp.h:5,

                 from include/linux/mm.h:9,

                 from include/linux/pagemap.h:7,

                 from /tmp/modconfig-71euqe/vmhgfs-only/page.c:28:

include/linux/wait.h:1044:1: note: expected ‘unsigned int’ but argument is of type ‘int (*)(void *)’

wait_on_bit(void *word, int bit, unsigned mode)

^

/tmp/modconfig-71euqe/vmhgfs-only/page.c:1649:23: error: too many arguments to functionwait_on_bitTASK_UNINTERRUPTIBLE);

                       ^

In file included from include/linux/mmzone.h:9:0,

                 from include/linux/gfp.h:5,

                 from include/linux/mm.h:9,

                 from include/linux/pagemap.h:7,

                 from /tmp/modconfig-71euqe/vmhgfs-only/page.c:28:

include/linux/wait.h:1044:1: note: declared here

wait_on_bit(void *word, int bit, unsigned mode)

^

make[2]: *** [/tmp/modconfig-71euqe/vmhgfs-only/page.o] Error 1

make[2]: *** Waiting for unfinished jobs....

make[1]: *** [_module_/tmp/modconfig-71euqe/vmhgfs-only] Error 2

make[1]: Leaving directory `/usr/src/kernels/3.10.0-514.2.2.el7.x86_64'

make: *** [vmhgfs.ko] Error 2

make: Leaving directory `/tmp/modconfig-71euqe/vmhgfs-only'
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59

通过查看后发现因为centos 7的Linux内核用的3.10版本,在函数 wait_on_bit_io()中有三个参数,而vmtool的代码在内核3.19后才用3个参数的wait_on_bit_io()函数,代码如下

   1639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
   1640    return wait_on_bit_io(&req->wb_flags,
   1641                          PG_BUSY,
   1642                          TASK_UNINTERRUPTIBLE);
   1643 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 13)
   1644    return wait_on_bit(&req->wb_flags,
   1645                       PG_BUSY,
   1646 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
   1647                       HgfsWbRequestWaitUninterruptible,
   1648 #endif
   1649                       TASK_UNINTERRUPTIBLE);
   1650 #else
 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

个人推测,在其他linux版本中可能也会出现类是的问题,只要看看报错源码,如果是由于#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0),这种判断造成的报错,只要把宏改成当前的版本号,一般都能解决问题.

vmware-tools-distrib/lib/modules/source的目录下有不少tar文件,我是根据报错的提示 
“/tmp/modconfig-71euqe/vmhgfs-only/page.c:1649:23: error: too many arguments to function ‘wait_on_bit’” 一个个去解压了找的

解压指令 
tar xf vmhgfs.tar

修改目录下的page文件的1639行

   1639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
 
 
  • 1
  • 1

改为如下↓

   1639 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 10, 0)
 
 
  • 1
  • 1

解压后修改完成打包指令 
tar cf vmhgfs.tar vmhgfs-only

然后执行vmware-install.pl 问题解决

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值