sockfs: the most simple file system in linux kernel
来源:互联网 发布:淘宝查假冒伪劣处罚 编辑:程序博客网 时间:2024/06/05 21:58
几年前做windows 网络的时候,就一直很好奇,为什么对一个socket既可以使用recv,send等socket API,同时又可以使用writefile和readfile?转到Linux下后,受Everything is file的熏陶,越发对VFS实现产生兴趣,便想结合sockfs对VFS做一个具体的分析。
然而,实践证明,把诸多元素混杂在一起,试图一劳永逸的做法有时候反而会让分析过程更加拖沓和反复,试图使用sockfs来了解整个VFS的实现也是不现实的,因为各个文件系统的使用场景是不相同的。
在明确了上述两点之后,从socket使用场景来入手,会更好一些,这里,只考虑与VFS相关内容,不在考虑诸如accept,listen以及地址域等网络相关的操作。
从文件系统角度来看,socket的几个特殊之处在于:
- socket fd只能通过socket()函数获取,open()无法获取socket的fd
- 虽然socket是一个文件系统,但是它是一个特殊的文件系统,不允许用户mount sockfs
- sockfs 不支持路径查找
由于种种的限制,决定了sockfs的实现比其他文件系统实现要简单的多。我们可以从sockfs的dentry_operations和super_operations中看出来sockfs在偷工减料,尤其是dentry_operations,仅仅实现了一个d_dname.
static const struct dentry_operations sockfs_dentry_operations = {.d_dname = sockfs_dname,};
static const struct super_operations sockfs_ops = {.alloc_inode= sock_alloc_inode,.destroy_inode= sock_destroy_inode,.statfs= simple_statfs,};
- sockfs: the most simple file system in linux kernel
- Demystifying the Linux Kernel Socket File Systems (Sockfs)
- Demystifying the Linux Kernel Socket File Systems (Sockfs)
- file lock in the Linux system
- The "Virtual File System" in Linux
- Add a system call to the linux kernel in Ubuntu
- The File System in JOS
- Describe the process of opening a file in Linux system, what actions the operating system w
- Linux Annoyances for Geeks : Getting the Most Flexible System in the World Just the Way You Want It
- Kbuild: the Linux Kernel Build System
- kbuild:the linux kernel build system
- Kbuild: the Linux Kernel Build System
- The longest absolute path in file system
- Feature: High Memory In The Linux Kernel
- Feature: High Memory In The Linux Kernel
- Init Call Mechanism in the Linux Kernel
- High Memory In The Linux Kernel(Cited)
- Init Call Mechanism in the Linux Kernel
- 幼儿园教育应坚持积极鼓励教育
- mule进阶之jdbc transport:
- Android中的Socket编程的基本思路
- C++ 回忆录8 copy constructor and Assigment Operator
- jrtplib 源码分析 (一) 辅助类
- sockfs: the most simple file system in linux kernel
- C# 上传 下载 源代码
- 一个教训
- 大数运算小结
- 实例repeater 分页、表头不动、添加列序号(dataset实现)
- js通过Class Name获取一个对象的数组
- xen体系结构
- 【转载】Lua 脚本语法说明
- Linux驱动调试的Debugfs的使用简介