2.6.21版本linux kernel上支持使用nfs访问ntfs移动硬盘问题

「已注销」 2010-02-25 09:09:37
最近从事的项目中,要求能够使用nfs访问ntfs移动硬盘,这个功能在2.6.27以上的kernel中实现,但是我们的kernel是2.6.21版本的,且不允许升级到2.6.27,所以只好移植一些应用程序来支持这个功能。需要的程序有ntfs-3g和fuse2.7.4。

因为ntfs-3g已经包含了fuse的用户空间的库及组件,所以我就直接把fuse2.7.4的kernel部分移植到linux kernel模块中了,具体方法如下:
1. 将fuse2.7.4 kernel源代码拷贝到linux-2.6.21/fs/fuse中
2. 拷贝fuse2.7.4相关头文件到fuse目录
3. 补充所需其他头文件
4. 重新编译内核

但是在编译过程中,出现这样的错误:
In file included from include/linux/compiler-gcc4.h:4,
from include/linux/compiler.h:42,
from include/linux/stddef.h:4,
from include/linux/list.h:6,
from include/linux/wait.h:22,
from include/linux/fs.h:270,
from fs/fuse/fuse_i.h:68,
from fs/fuse/inode.c:9:
include/linux/compiler-gcc.h:34:1: warning: this is the location of the previous definition
fs/fuse/inode.c:703: warning: initialization from incompatible pointer type
fs/fuse/inode.c:957: error: static declaration of 'fs_subsys' follows non-static declaration
include/linux/fs.h:1420: error: previous declaration of 'fs_subsys' was here


我看了一下源代码,inode.c 957行是这样的:
#ifdef KERNEL_2_6_25_PLUS
static struct kobject *fuse_kobj;
static struct kobject *connections_kobj;
#else
#ifndef HAVE_FS_SUBSYS
static decl_subsys(fs, NULL, NULL); ----------------- inode.c 957行
#endif
static decl_subsys(fuse, NULL, NULL);
static decl_subsys(connections, NULL, NULL);
#endif

这里和“fs_subsys”有什么关系呢?fs.h的1420行只是声明了一个外部变量而已,而且这里也没有用到这个变量啊:
/* /sys/fs */
extern struct subsystem fs_subsys; ------------------------ fs.h 1420行

一开始我以为是头文件重复包含了,检查了一下相关的头文件,都有防止头文件重复包含的宏。如果把inode.c 957行注释

我之所以没有用--enable-kernel-module编译fuse2.7.4,是因为在configure阶段还要传入其他一些options,--enable-kernel-module和这些options一起传入的时候,似乎不起作用。

掉,就可以编译通过。但是2.6.21 kernel的fuse源代码,这部分也是这么写的,却可以编译通过。

请教各位大侠,出现这样的错误,会是什么原因呢?谢谢。
...全文
267 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
「已注销」 2010-02-25
  • 打赏
  • 举报
回复
自己顶起来,继续请教

23,110

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧