使用 direct_io FUSE fseek 意外行为

发布于 2024-10-06 14:20:17 字数 376 浏览 0 评论 0原文

我正在尝试编写一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

并安 2024-10-13 14:20:17

我也遇到过类似的问题,并向 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

 // error check this

 // fseek (pSourceFile , 0 , SEEK_END);

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

 // error check this

 // fseek (pSourceFile , 0 , SEEK_END);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文