当前位置: 首页 > news >正文

西安二手房出售信息seo自己怎么做

西安二手房出售信息,seo自己怎么做,网站建设 服务内容,做神马网站优化通用文件接口 VFS 使得可以直接使用 open()、read()、write() 这样的系统调用而无需考虑具体文件系统和实际物理介质。 好处:新的文件系统和新类型的存储介质需要挂载时,程序无需重写,甚至无需重新编译。 VFS 将各种不同的文件系统抽象后采…

通用文件接口

VFS 使得可以直接使用 open()、read()、write() 这样的系统调用而无需考虑具体文件系统和实际物理介质。

好处:新的文件系统和新类型的存储介质需要挂载时,程序无需重写,甚至无需重新编译。

VFS 将各种不同的文件系统抽象后采用统一的方式进行操作。

image-20230427193920113

文件系统抽象层

可以使用这种通用接口对所有类型的文件系统进行操作,是因为内核在它的底层文件系统接口上建立了一个抽象层。

为了支持多文件系统,VFS 提供了一个通用文件系统模型,该模型囊括了任何文件系统的常用功能集和行为。

VFS 抽象层之所以能衔接各种各样的文件系统,是因为它定义了所有文件系统都支持的、基本的、概念上的接口和数据结构。

文件系统需要和 VFS 所定义的概念保持一致(其实就是规则、约束)。文件系统提供 VFS 所期望的抽象接口和数据结构,这样内核就可以和任何文件系统协同工作。

在内核中,在文件系统之外的其它部分,并不需要了解其文件系统内部细节:

ret = write(fd, buf, len); // 系统调用
// 其具体实现:sys_write

系统调用是通用 VFS 接口,提供给用户使用。系统调用的具体实现由文件系统中的具体文件实现,实现的是 VFS 所需要的 sys_write() 方法。

image-20230427193850774

Unix 文件系统

  • 目录是特殊的文件,即目录文件。
  • 根目录:/
  • 文件相关的信息,乘作为文件的元数据,这些元数据被存储到 inode 结构体中。
  • 文件系统的相关信息,即文件系统的元数据,被存储在超级块中。

VFS 对象及其数据结构

VFS 采用面向对象思想来设计的。其对象使用结构体表示。

VFS 四个主要的对象类型:

  • 超级块对象:代表一个具体的已安装文件系统。
  • 索引节点对象:代表一个具体文件。
  • 目录项对象:代表一个目录项,是路径的一个组成部分。
  • 文件对象:代表由进程打开的文件。

每个对象中都包含一个操作对象,这些操作对象描述了内核针对主要对象可以使用的方法:

  • super_operations 对象:包含内核针对特定文件系统所能调用的方法,比如 write_inode() 和 sync_fs() 等。
  • inode_operations 对象:包含内核针对特定文件所能调用的方法,比如 create() 和 link() 等。
  • dentry_operations 对象:包含内核针对特定目录所能调用的方法,比如 d_compare() 和 d_delete() 等。
  • file_operations 对象:包含进程针对已打开文件所能调用的方法,比如 read() 和 write() 等。

并不止这些对象…

超级块对象

各种文件系统都必须实现超级块对象,该对象用于存储特定文件系统的信息,通常对应于存放在磁盘特定扇区中的文件系统超级块或文件系统控制块。其它并非基于磁盘的文件系统(如基于内存的文件系统 sysfs),它们会在使用现场创建超级块并将其保存到内存中。

超级块的结构体为 super_block,位于 include/linux/fs.h:

image-20230427200942704

对超级块的操作,位于:fs/super.c

超级块对象通过 alloc_super() 函数创建并初始化。在文件系统安装时,文件系统会调用该函数以便从磁盘读取文件系统超级块,并且将其信息填充到内存中的超级块对象中。

超级块操作

超级块对象 super_block 中的 s_op 域指向超级块的操作函数表。

超级块的操作函数表用 super_operations 结构体表示,位于 include/linux/fs.h

struct super_operations {struct inode *(*alloc_inode)(struct super_block *sb);void (*destroy_inode)(struct inode *);void (*dirty_inode) (struct inode *);int (*write_inode) (struct inode *, struct writeback_control *wbc);void (*drop_inode) (struct inode *);void (*delete_inode) (struct inode *);void (*put_super) (struct super_block *);void (*write_super) (struct super_block *);int (*sync_fs)(struct super_block *sb, int wait);int (*freeze_fs) (struct super_block *);int (*unfreeze_fs) (struct super_block *);int (*statfs) (struct dentry *, struct kstatfs *);int (*remount_fs) (struct super_block *, int *, char *);void (*clear_inode) (struct inode *);void (*umount_begin) (struct super_block *);int (*show_options)(struct seq_file *, struct vfsmount *);int (*show_stats)(struct seq_file *, struct vfsmount *);
#ifdef CONFIG_QUOTAssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
#endifint (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
};

Tips:

sb->s_op->write_super(sb);
// 因为这不是对象,只是将其看成对象
// 结构体无 this 指向
// 因此只能手动传入 sb 对象,间接实现 this 指向 sb

索引节点对象

索引节点对象包含了内核在操作文件或目录时需要的全部信息。

image-20230427203843419

一个索引节点代表文件系统中的一个文件,它也可以是设备或管道这样的特殊文件。但索引节点只有当文件被访问时,才能在内存中创建。

索引节点操作

struct inode_operations {int (*create) (struct inode *,struct dentry *,int, struct nameidata *);struct dentry * (*lookup) (struct inode *,struct dentry *, struct nameidata *);int (*link) (struct dentry *,struct inode *,struct dentry *);int (*unlink) (struct inode *,struct dentry *);int (*symlink) (struct inode *,struct dentry *,const char *);int (*mkdir) (struct inode *,struct dentry *,int);int (*rmdir) (struct inode *,struct dentry *);int (*mknod) (struct inode *,struct dentry *,int,dev_t);int (*rename) (struct inode *, struct dentry *,struct inode *, struct dentry *);int (*readlink) (struct dentry *, char __user *,int);void * (*follow_link) (struct dentry *, struct nameidata *);void (*put_link) (struct dentry *, struct nameidata *, void *);void (*truncate) (struct inode *);int (*permission) (struct inode *, int);int (*check_acl)(struct inode *, int);int (*setattr) (struct dentry *, struct iattr *);int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);ssize_t (*listxattr) (struct dentry *, char *, size_t);int (*removexattr) (struct dentry *, const char *);void (*truncate_range)(struct inode *, loff_t, loff_t);long (*fallocate)(struct inode *inode, int mode, loff_t offset,loff_t len);int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start,u64 len);
};

目录项对象

image-20230427211519800

目录项对象没有对应的磁盘数据结构,VFS 根据字符串形式的路径在内存中创建它,因此目录项对象并非真正保存在磁盘上。可以看到该结构体也没有磁盘相关的域。

目录项状态

状态有三:被使用、未被使用、负状态。

**被使用:**一个被使用的目录项对应一个有效的索引节点(即 d_inode 指向相应的索引节点)并且表面该对象存在一个或多个使用者(d_count 为正)。一个目录项处于被使用状态,意味着它正被 VFS 使用并且指向有效的数据,因此不能被丢弃。

未被使用: 一个未被使用的目录项对应一个有效的索引节点(d_inode 指向一个索引节点),但是应指明 VFS 当前并未使用它(d_count 为 0)。该目录项对象仍然指向一个有效对象,而且被保留在缓存中以便需要时再使用它。以后若再需要它,就不必重新创建。若要回收内存,也可以撤销未使用的目录项。

负状态: 其实就是无效目录项,一个负状态的目录项没有对应的有效索引节点(d_inode 为 NULL),因为索引节点已被删除,或路径不在正确,但目录项仍然可以保留,以便快速解析以后的路径查询。

目录项对象释放后也可以保存到 slab 对象缓存中。此时,任何 VFS 或文件系统代码都没有指向该目录项对象的有效引用。

目录项缓存

内核将目录项对象缓存在目录项缓存中。

目录项缓存包括三个主要部分:

image-20230427214346521

目录项操作

include\linux\dcache.h

struct dentry_operations {int (*d_revalidate)(struct dentry *, struct nameidata *);int (*d_hash) (struct dentry *, struct qstr *);int (*d_compare) (struct dentry *, struct qstr *, struct qstr *);int (*d_delete)(struct dentry *);void (*d_release)(struct dentry *);void (*d_iput)(struct dentry *, struct inode *);char *(*d_dname)(struct dentry *, char *, int);
};

文件对象

VFS 的文件对象表示进程已打开的文件。文件对象是已打开的文件在内存中的表示。该对象(切记,不是具体的文件,即不是物理的,而只是存在于内存中的,因此 VFS 的文件对象没有对应的磁盘数据)由相应的 open() 系统调用创建,由 close() 系统调用撤销。

image-20230428101619847

文件操作

/** NOTE:* read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl* can be called without the big kernel lock held in all filesystems.*/
struct file_operations {struct module *owner;loff_t (*llseek) (struct file *, loff_t, int);ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);int (*readdir) (struct file *, void *, filldir_t);unsigned int (*poll) (struct file *, struct poll_table_struct *);int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);long (*compat_ioctl) (struct file *, unsigned int, unsigned long);int (*mmap) (struct file *, struct vm_area_struct *);int (*open) (struct inode *, struct file *);int (*flush) (struct file *, fl_owner_t id);int (*release) (struct inode *, struct file *);int (*fsync) (struct file *, struct dentry *, int datasync);int (*aio_fsync) (struct kiocb *, int datasync);int (*fasync) (int, struct file *, int);int (*lock) (struct file *, int, struct file_lock *);ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int);unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long);int (*check_flags)(int);int (*flock) (struct file *, int, struct file_lock *);ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int);ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int);int (*setlease)(struct file *, long, struct file_lock **);
};

和文件系统相关的数据结构

内核定义了用来管理文件系统的数据结构。

file_system_type 用来描述各种特定文件系统类型:

缺图

每种文件系统,不管有多少个实例安装到系统中,还是根本就没有安装到系统中,都只有一个 file_system_type 结构。

当文件系统被安装时,将有一个 vfsmount 结构体在安装点被创建。该结构体用来代表文件系统的实例,即代表一个安装点。

缺图

vfsmount 结构体中维护的各种链表,用于理清文件系统和所有其它安装点间的关系。

vfsmount 结构保存了在安装时指定的标志信息,该信息存储在 mnt_flags 域中。

缺图

和进程相关的数据结构

系统中每个进程都有自己的一组打开的文件。file_struct、fs_strruct、namespace 结构体将 VFS和系统的进程紧密联系在一起。

file_struct 结构体,该结构体由进程描述符中的 files 目录项指向。所有与单个进程相关的信息都保护在其中:

include\linux\fdtable.h

缺图

fs_struct 结构体,该结构由进程描述符的 fs 域指向。它包含了文件系统和进程相关的信息。

include\linux\fs_struct.h

缺图

namespace 结构体,由进场描述符中的 mmt_namespace 域指向。它使得每个进程在系统中都看到唯一的安装文件系统,不仅是唯一的根目录,而且是唯一的文件系统层次结构。

缺图


文章转载自:
http://conventionality.c7512.cn
http://arthrodia.c7512.cn
http://boatswain.c7512.cn
http://deregulation.c7512.cn
http://flic.c7512.cn
http://milano.c7512.cn
http://macrobiotics.c7512.cn
http://css.c7512.cn
http://septum.c7512.cn
http://excuria.c7512.cn
http://newsstand.c7512.cn
http://crownling.c7512.cn
http://kigali.c7512.cn
http://boysenberry.c7512.cn
http://yinchuan.c7512.cn
http://democratically.c7512.cn
http://tiptop.c7512.cn
http://gutturonasal.c7512.cn
http://oleometer.c7512.cn
http://disciplinarian.c7512.cn
http://emphatic.c7512.cn
http://psephology.c7512.cn
http://discommendable.c7512.cn
http://astrosphere.c7512.cn
http://spraddle.c7512.cn
http://mammee.c7512.cn
http://megarad.c7512.cn
http://opposite.c7512.cn
http://tuberose.c7512.cn
http://gobble.c7512.cn
http://delicate.c7512.cn
http://autoantibody.c7512.cn
http://juan.c7512.cn
http://unclear.c7512.cn
http://siglos.c7512.cn
http://tithonus.c7512.cn
http://buckingham.c7512.cn
http://decipherable.c7512.cn
http://chainreactor.c7512.cn
http://tinwork.c7512.cn
http://oilily.c7512.cn
http://revenant.c7512.cn
http://deaden.c7512.cn
http://coprological.c7512.cn
http://geophysicist.c7512.cn
http://jakarta.c7512.cn
http://romantism.c7512.cn
http://gentleman.c7512.cn
http://carafe.c7512.cn
http://lamb.c7512.cn
http://acclivous.c7512.cn
http://guaranty.c7512.cn
http://piscium.c7512.cn
http://urd.c7512.cn
http://burgher.c7512.cn
http://copolymerize.c7512.cn
http://adviser.c7512.cn
http://sinography.c7512.cn
http://tinker.c7512.cn
http://gastropodous.c7512.cn
http://overboot.c7512.cn
http://conduct.c7512.cn
http://fumigate.c7512.cn
http://towering.c7512.cn
http://gallant.c7512.cn
http://drawback.c7512.cn
http://rehire.c7512.cn
http://melancholiac.c7512.cn
http://margaux.c7512.cn
http://rhubarb.c7512.cn
http://cyclery.c7512.cn
http://immunoreactive.c7512.cn
http://sudetenland.c7512.cn
http://preceptress.c7512.cn
http://adlerian.c7512.cn
http://remanent.c7512.cn
http://sabot.c7512.cn
http://sharable.c7512.cn
http://flimflam.c7512.cn
http://phyllite.c7512.cn
http://volunteer.c7512.cn
http://jolterhead.c7512.cn
http://vestal.c7512.cn
http://unsplinterable.c7512.cn
http://ectoblast.c7512.cn
http://salicaceous.c7512.cn
http://theonomous.c7512.cn
http://blastocyst.c7512.cn
http://universalizable.c7512.cn
http://transact.c7512.cn
http://latinesque.c7512.cn
http://embowel.c7512.cn
http://straitlaced.c7512.cn
http://disintegrant.c7512.cn
http://piezomagnetism.c7512.cn
http://rude.c7512.cn
http://autumnal.c7512.cn
http://grubstreet.c7512.cn
http://thalassography.c7512.cn
http://componential.c7512.cn
http://www.zhongyajixie.com/news/95849.html

相关文章:

  • 怎么看一个网站好坏上海排名优化推广工具
  • 网站建设开发原代码归属长沙seo计费管理
  • 设计软件网站推荐优化教程网官网
  • wordpress 图片下加文字厦门seo排名
  • 建立网站费用怎么做会计分录北京网站营销与推广
  • 瑞金建设局网站高端网站建设定制
  • 怎么查网站哪里做的天津百度推广公司地址
  • 美食网站开发的目的和意义网店seo排名优化
  • 电商网站大连seo托管服务
  • 网站建设联系windows优化软件哪个好
  • 免备案云服务器租用seo点击排名源码
  • 网站建设需要精通什么知识关键词搜索排名软件
  • 手机网站前端模板下载进入百度
  • 移动网站开发课程设计企业官方网站推广
  • 度假区网站建设方案环球军事网最新军事新闻最新消息
  • 服务网站建设的公司排名关键词优化公司排名榜
  • 邢台提供网站建设公司电话网站seo价格
  • 太仓seo网站优化软件短视频推广策略
  • 天河手机网站建设北京做网页的公司
  • 仿站网站建设seo百度站长工具
  • 深色网站免费网站java源码大全
  • 网站建设公司怎么做网络营销的策划流程
  • 网站建设找客户百度竞价排名的利与弊
  • 免费做效果图的网站百家号排名
  • 易县有没有z做网站的百度关键词优化培训
  • 网站架构技术交换友链
  • 制作网页免费seo这个职位是干什么的
  • 制作app的网站搜索引擎调价平台哪个好
  • 有没有哪个网站可以做LCM模组免费网站流量统计
  • 网站备案状态查询百度怎么打广告在首页