Linux内核具体体系结构之虚拟文件系统.doc
《Linux内核具体体系结构之虚拟文件系统.doc》由会员分享,可在线阅读,更多相关《Linux内核具体体系结构之虚拟文件系统.doc(8页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、 Linux内核具体体系结构之虚拟文件系统 收藏 此文于2009-10-23被推荐到CSDN首页如何被推荐?Linux内核具体体系结构之虚拟文件系统译自:Concrete Architecture of the Linux Kernel 作者: Waterloo, Ontario N2L 3G1 CS 746G, Winter 1998 刘建文略译( )3.3 Virtual File System3.3.1 GoalsLinux被设计成支持驱动多种不同物理设备的现代操作系统。注意,即便是同一种的硬件设备也可能存在多种不同的接口,比如硬盘有PATA、SATA、SCSI、 USB等不同接口(KE
2、MIN:注意接口与总线的区别)。除了支持不同的物理设备接口外,Linux还支持各种不同的逻辑文件系统( logical file systems),这个功能有助于Linux与其它的操作系统共存和互操作。虚拟文件系统泛化和囊括了外设输入输出和逻辑文件系统功能,实现以下一些“伟大”目标: * Multiple hardware devices - provide access to many different hardware devices * Multiple logical file systems - support many different logical file systems
3、 * Multiple executable formats - support several different executable file formats (like a.out, ELF, java) * Homogeneity - present a common interface to all of the logical file systems and all hardware devices * Performance - provide high-speed access to files * Safety - do not lose or corrupt data
4、* Security - restrict user access to access files; restrict user total file size with quotas 3.3.2 External Interface虚拟文件系统为系统边界提供了两层的接口:对外的是给用户进程调用的系统调用(system-call);对内是给内核其它子系统调用的底层函数。对外系统调用函数是符合POSIX标准的,包括文件操作open/close/read/write/seek/tell,和目录操作readdir/creat/unlink/chmod/stat。对内的接口则更丰富一些,除了公开文件系
5、统的功能函数,还会对内核其它子系统公开一些实现的数据结构。比如, inode 和 file。以下两个接口定义可在文件系统C头文件(/include/linux/fs.h)中找到:Inode Interface: * create(): create a file in a directory * lookup(): find a file by name within a directory * link() / symlink() / unlink() / readlink() / follow_link(): manage file system links * mkdir() / rmd
6、ir(): create or remove sub-directories * mknod(): create a directory, special file, or regular file * readpage() / writepage(): read or write a page of physical memory to a backing store * truncate(): set the length of a file to zero * permission(): check to see if a user process has permission to e
7、xecute an operation * smap(): map a logical file block to a physical device sector * bmap(): map a logical file block to a physical device block * rename(): rename a file or directory 注:除了以上inode的接口,其它内核子系统还可以调用namei() 函数查出与inode相关联的文件或目录。File Interface: * open() / release(): open or close the file
8、* read() / write(): read or write to the file * select(): wait until the file is in a particular state (readable or writeable) * lseek(): if supported, move to a particular offset in the file * mmap(): map a region of the file into the virtual memory of a user process * fsync() / fasync(): synchroni
9、ze any memory buffers with the physical device * readdir: read the files that are pointed to by a directory file * ioctl: set file attributes * check_media_change: check to see if a removable media has been removed (such as a floppy) * revalidate: verify that all cached information is valid 3.3.3 Su
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Linux 内核 具体 体系结构 虚拟 文件系统
限制150内