Linux虚拟文件系统是一个内核软件层,用来处理与UNIX标准文件系统相关的所有系统调用。其健壮性表现在能为各种文件系统提供一个通用的接口。 Linux虚拟文件系统支持的文件系统可以划分为三种主要的类型:磁盘文件系统这些文件系统管理在本地磁盘分区中可用的磁盘空间或者其他可以起到磁盘作用的设备(比如说一个USB闪存)。网络文件系统这些文件系统允许访问属于其他网络计算机的文件系统所包含的文件。特殊文件系统这些文件系统不管理本地或者远程磁盘空间
通用文件模型虚拟文件系统所隐含的主要思想是引入一个通用的文件模型,这个模型可以支持所有的文件系统类型。下图为VFS在系统中所处的位置。可以把这里的通用文件模型看作是面型对象的。在这里,对象是一个软件结构,其中定义了数据结构也定义了其上的操作方法。处于效率上的考虑,Linux的编码并为采用面向对象的程序设计(比如C++编程)。因此对象作为普通的C数据结构来实现,数据结构中指向函数的字段就对应于对象的方法。
VFS与进程关系进程描述符中与VFS相关的部分:
[cpp] - struct task_struct {
- ……
- /* filesystem information */
- struct fs_struct *fs;
- /* open file information */
- struct files_struct *files;
- /* namespaces */
- struct nsproxy *nsproxy;
- ……
- };
通用文件系统模型与进程关系架构
通用文件系统模型数据结构组成通用文件系统模型由下列对象组成:
超级块对象存放已安装文件系统的有关信息。对基于磁盘的文件系统,这类对象通常对应于存放在磁盘上的文件系统控制块。
[cpp] - /*存放已安装文件系统的有关信息,通常对应于存放在磁盘上的文件系统控制块
- 每挂载一个文件系统对应一个超级块对象*/
- struct super_block {
- struct list_head s_list;/*指向超级块链表的指针*//* Keep this first */
- dev_t s_dev;/*设备标识符*//* search index; _not_ kdev_t */
- unsigned long s_blocksize;/*以字节为单位的块大小*/
- unsigned char s_blocksize_bits;/*以位为单位的块大小*/
- unsigned char s_dirt;/*修改标志*/
- loff_t s_maxbytes;/*文件的最长长度*/ /* Max file size */
- struct file_system_type *s_type;/*文件系统类型*/
- const struct super_operations *s_op;/*超级快方法*/
- const struct dquot_operations *dq_op;/*磁盘限额方法*/
- const struct quotactl_ops *s_qcop;/*磁盘限额管理方法*/
- const struct export_operations *s_export_op;/*网络文件系统使用的输出方法*/
- unsigned long s_flags;/*安装标识*/
- unsigned long s_magic;/*文件系统的魔术*/
- struct dentry *s_root;/*文件系统根目录的目录项对象*/
- struct rw_semaphore s_umount;/*卸载用的信号量*/
- struct mutex s_lock;/*超级块信号量*/
- int s_count;/*引用计数*/
- int s_need_sync;/*表示对超级快的索引节点进行同步标志*/
- atomic_t s_active;/*次级引用计数*/
- #ifdef CONFIG_SECURITY
- void *s_security;/*指向超级安全数据结构的指针*/
- #endif
- struct xattr_handler **s_xattr;/*执行超级快扩展数据结构的指针*/
-
- struct list_head s_inodes;/*所有索引节点的链表*/ /* all inodes */
- struct hlist_head s_anon;/*用于处理网络文件系统的匿名目录项的链表*/ /*
- anonymous dentries for (nfs) exporting */
- struct list_head s_files;/*文件对象的链表*/
- /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
- struct list_head s_dentry_lru;/* /* unused dentry lru */
- int s_nr_dentry_unused; /* # of dentry on lru */
-
- struct block_device *s_bdev;/*指向块设备驱动程序描述符的指针*/
- struct backing_dev_info *s_bdi;/* */
- struct mtd_info *s_mtd;/**/
- struct list_head s_instances;/*用于指定文件系统类型的超级快对象链表指针*/
- struct quota_info s_dquot;/*磁盘限额的描述符*/ /* Diskquota specific options
- */
-
- int s_frozen;/*冻结文件系统时使用的标志*/
- wait_queue_head_t s_wait_unfrozen;/*进程挂起的等待队列,直到文件系统被冻结*/
-
- char s_id[32];/*包含超级快的块设备名称*/ /* Informational name */
-
- void *s_fs_info;/*指向特定文件系统的超级快信息的指针*/ /* Filesystem
- private info */
- fmode_t s_mode;/**/
-
- /*
- * The next field is for VFS *only*. No filesystems have any business
- * even looking at it. You had been warned.
- */
- struct mutex s_vfs_rename_mutex;/*当VFS通过目录命名文件时使用的互斥变量*/ /*
- Kludge */
-
- /* Granularity of c/m/atime in ns.
- Cannot be worse than a second */
- u32 s_time_gran;/*时间戳的粒度*/
-
- /*
- * Filesystem subtype. If non-empty the filesystem type field
- * in /proc/mounts will be "type.subtype"
- */
- char *s_subtype;/**/
-
- /*
- * Saved mount options for lazy filesystems using
- * generic_show_options()
- */
- char *s_options;
- };
如何在Linux环境下安装JDK1.6和Tomcat 6Linux虚拟文件系统(节点路径搜索)相关资讯 Linux基础教程
- Linux基础教程:对文件打包压缩 (03月08日)
- 基础教程:Linux 新手应该知道的 (09/06/2015 21:17:20)
- Linux基础教程:find 与 xargs (04/05/2015 10:20:11)
| - Linux基础教程:tar 命令使用介绍 (12/03/2015 13:19:47)
- Linux基础教程(1)操作系统基础 (08/15/2015 20:44:01)
- Linux基础教程:从源码安装软件 (04/05/2015 10:14:45)
|
本文评论 查看全部评论 (0)