使用 direct_io FUSE fseek 意外行为
我正在尝试编写一个 FUSE 文件系统,将流音乐呈现为 mp3 文件。我不想在仅读取 ID3v1.1 标签时开始流式传输音频,因此我使用 direct_io 和 max_readahead=0 挂载文件系统。
但是当我这样做时(这也是 libid3tag 所做的),我读取了 2752 个字节,距末尾偏移量为 -2880 个字节:
char tmp[255];
FILE* f = fopen("foo.mp3", "r");
fseek(f, -128, SEEK_END);
fread(tmp, 1, 10, f);
这是为什么?我希望得到一个读取调用,其偏移量距末尾正好 128 个字节,大小为 10。
读取的字节量似乎有所不同。
I'm trying to write a FUSE filesystem that presents streamable music as mp3 files. I don't want to start to stream the audio when just the ID3v1.1 tag is read, so I mount the filesystem with direct_io and max_readahead=0.
But when I do this (which is also what libid3tag does), I get reads of 2752 bytes with offset -2880 bytes from the end:
char tmp[255];
FILE* f = fopen("foo.mp3", "r");
fseek(f, -128, SEEK_END);
fread(tmp, 1, 10, f);
Why is this? I expect to get a call to read with an offset exactly 128 bytes from the end with size 10..
The amount of bytes read seems to vary somewhat.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也遇到过类似的问题,并向 s3fs 提交了问题。结账问题:http://code.google.com/p/s3fs/issues/detail?can=2&q=&colspec=ID%20Type% 20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=241
另外,检查 s3fs.cpp 中的第 1611 行:
http://code.google.com/p/s3fs/source/browse/trunk/src/s3fs .cpp?r=316
I've had similar issue and filed an issue with s3fs. Checkout issue : http://code.google.com/p/s3fs/issues/detail?can=2&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=241
additionally, checkout line 1611 in the s3fs.cpp:
http://code.google.com/p/s3fs/source/browse/trunk/src/s3fs.cpp?r=316