man page for the splice
system call表示 splice
可能会失败并将 errno
设置为 EINVAL
如果:
Target file system doesn't support splicing; neither of the descriptors refers to a pipe; or offset given for non-seekable device
哪些文件系统支持拼接?
最佳答案
我的原始答案部分不正确,这是一次重大重写。
Linux 2.6.30.10及以下
在 Linux 2.6.30.10 及更早版本中,splice
在源或目标文件系统不支持拼接时返回 EINVAL
。以下是支持拼接的文件系统:
- 在读取模式下:adfs、affs、afs、bfs、btrfs、coda、ecryptfs、exofs、ext2、ext3、ext4、fat、fuse、hpfs、jffs2、jfs、minix、nfs、 nilfs2、ntfs、ocfs2、omfs、qnx4、reiserfs、smbfs、sysv、ubifs、udf、ufs。
- 写入模式:exofs、ext2、ext3、ext4、jfs、ocfs2、reiserfs、ubifs。
详情如下。 do_splice_to()
中确定支持拼接在“文件到管道”案例和 do_splice_from()
中的函数“管道到文件”情况下的功能。这是通过检查相关的 struct file_operations
是否分别包含 .splice_read
或 .splice_write
来完成的。为了生成上面的文件系统列表,我在 fs/*/file.c
中搜索了 .splice_read
和 .splice_write
.
Linux 2.6.31及以上
从Linux 2.6.31开始,所有的文件系统都支持读写拼接。
详情如下。当文件系统在其 struct file_operations
中没有 .splice_read
或 .splice_write
时,将使用回退函数:default_file_splice_read
和 default_file_splice_write
,分别。参见 do_splice_to()
和 do_splice_from()
用于实现。注意:由于文档中列出的其他原因,EINVAL
可能仍会返回。
关于c - 哪些文件系统支持通过 Linux 的 splice(2) 进行拼接?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3638657/