文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>虚拟文件系统(VFS)

虚拟文件系统(VFS)

时间:2010-06-29  来源:dong066

                           虚拟文件系统(VFS) VFS是内核给用户空间提供的文件系接口,是内核的一个抽象结构,VFS使得不同的文件系统能够共存。

To register and unregister a filesystem, use the following API functions:

   #include <linux/fs.h>

   extern int register_filesystem(struct file_system_type *);

   extern int unregister_filesystem(struct file_system_type *);

  文件系统结构: struct file_system_type { const char *name;

       int fs_flags; int (*get_sb) (struct file_system_type *, int, const char *, void *, struct vfsmount *);

void (*kill_sb) (struct super_block *);

        struct module *owner;

        struct file_system_type * next;

        struct list_head fs_supers;

 struct lock_class_key s_lock_key;

           struct lock_class_key s_umount_key; }; 当一个新的文件系统实例被挂在时调用get_sb(),反之调用kill_sb(). struct vfsmount *mnt 描述一个被挂在的文件系统实体。 超级快,inode ,(解释见文件系统笔记) file 对象代表着一个实际打开的文件。

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 *);

       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 (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *);

ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *);

ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *);

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 *, size_t, unsigned int);

 ssize_t (*splice_read)(struct file *, struct pipe_inode_info *, size_t, unsigned int); };

也即是标准的系统调用。
相关阅读 更多 +
排行榜 更多 +
正太寿司屋游戏安卓版下载

正太寿司屋游戏安卓版下载

模拟经营 下载
波比的游戏时间第七章手游下载

波比的游戏时间第七章手游下载

休闲益智 下载
像素火影(次世代)千手扉间下载

像素火影(次世代)千手扉间下载

飞行射击 下载