为什么 FUSE readdir 返回输入/输出错误?
我在熔断器中实现 readdir()
功能时遇到一个奇怪的问题。基本上,当我在 fusion 中的任何目录上执行 ls
时,我会收到如下错误:
#ls
ls: 读取目录 .: 输入/输出错误
文件1.c 文件2.c
但奇怪的是,readdir() 正在做它应该做的事情。从某种意义上说,在该特定目录中,我有两个名为 file1.c
和 file2.c
的文件,并且它能够正确读取它。
在调试问题时,我注意到fuse filler
函数(fuse_fill_dir_t
作为参数传递给readdir()
)可能是导致此错误的原因。
这是因为如果我只是使用调试 printf
打印目录的内容而不使用填充函数返回内容,我就不会看到错误。
但是,一旦我开始使用填充函数返回内容,我就开始看到此错误。
我有两个与此相关的问题:
1)有人知道为什么 filler
函数可能会导致此问题吗?
2) 如何查找fuse_fill_dir_t
函数的代码定义?我已经使用此类参数查看了大多数熔断函数,但到目前为止还没有运气。
任何帮助表示赞赏!
干杯, 维奈
I am seeing a strange issue while implementing the readdir()
functionality in fuse. Basically when I do ls
on any directory in fuse, I get an error such as:
# ls
ls: reading directory .: Input/output error
file1.c file2.c
But the strange thing is, readdir()
is doing exactly what it is supposed to do. In the sense that in that particular directory, I have two files named file1.c
and file2.c
and it is able to read it correctly.
While debugging the issue I noticed that fuse filler
function (fuse_fill_dir_t
passed as an argument to readdir()
) is what may be causing this error.
This is because if I simply print the contents of the directory using a debug printf
without returning the contents using the filler function, I do not see the error.
But as soon as I start using the filler function to return the contents, I start seeing this error.
I have two questions related to this:
1) Anybody have any idea as to why the filler
function might be causing this problem?
2) How do I look for the definition of the code for the fuse_fill_dir_t
function? I have looked through most of the fuse functions with that kind of arguments but have had no luck until now.
Any help is appreciated!
Cheers,
Vinay
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此类消息可能是由于调用其他(可能未实现的)FUSE 回调(例如 getxattr())失败而引起的。然后调用
readdir()
并获得正确的结果。您可以使用键
-d
(调试模式)调试运行其可执行文件的 FUSE 文件系统,该文件系统不会守护进程并打印有关 FUSE 调用的详细调试输出。另外,最好知道您的平台是什么(Linux/OS X/等)。
Such messages may be caused by failed calls to other (possibly unimplemented) FUSE callbacks like
getxattr()
. Thenreaddir()
is called and results are obtained right.You can debug a FUSE filesystem running its executable with key
-d
(debug mode), - that does not daemonize process and prints detailed debug output about FUSE calls.Also, it would be nice to know what is your platform (Linux/OS X/etc).
我最近遇到了这个。请务必阅读
fuse.h
中的注释,以确保您正确使用填充函数:I ran across this recently. Be sure to read the comments in
fuse.h
to ensure you are using the filler function correctly: