linux一些重要的数据结构,linux中一些重要的数据结构

本文详细介绍了Linux内核中的文件系统类型结构`structfile_system_type`和超级块结构`structsuper_block`,包括它们的成员变量及其作用,如文件系统名字、标志、超级块操作、限额方法等,揭示了Linux如何管理和组织文件系统。
摘要由CSDN通过智能技术生成

struct file_system_type {

const char *name; --文件系统的名字

int fs_flags; --几种文件系统flag标志,fs_flags的取值可能有很多种。例如,文件系统标识FS_REQUIRES_DEV表示文件系统只能加载在一个块设备上;FS_SINGLE表示文件系统只能有一个超级块;FS_NOMOUNT表示文件系统不能安装在用户空间上

struct super_block *(*read_super) (struct super_block *, void *, int); --read_super所指的函数用于读出该文件系统在外存的超级块

struct module *owner; --如果实现该文件系统的程序段是由module动态载入的,则指向该module;如果实现该文件系统的程序段是在内核编译时生成的,则owner = NULL

struct file_system_type * next; --文件系统类型链表的后续指针,初始化为NULL

struct list_head fs_supers; --该类型文件系统的超级块对象链表

};struct super_block {

struct list_head        s_list;            /* 指向超级块链表的指针 */

dev_t                   s_dev;             /* 设备标识符 */

unsigned long           s_blocksize;       /* 以字节为单位的块大小 */

unsigned long           s_old_blocksize;   /* 以位为单位的旧的块大小 */

unsigned char           s_blocksize_bits;  /* 以位为单位的块大小 */

unsigned char           s_dirt;            /* 修改脏标志 */

unsigned long long      s_maxbytes;        /* 文件大小上限 */

struct file_system_type s_type;            /* 文件系统类型 */

struct super_operations s_op;              /* 超级块方法 */

struct dquot_operations *dq_op;            /* 磁盘限额方法 */

struct quotactl_ops     *s_qcop;           /* 限额控制方法 */

struct export_operations *s_export_op;     /* 到处方法 */

unsigned long            s_flags;          /* 挂载标志 */

unsigned long            s_magic;          /* 文件系统魔数 */

struct dentry            *s_root;          /* 目录挂载点 */

struct rw_semaphore      s_umount;         /* 卸载信号量 */

struct semaphore         s_lock;           /* 超级块信号量 */

int                      s_count;          /* 引用计数 */

int                      s_syncing;        /* 文件系统同步标志 */

int                      s_need_sync_fs;   /* 尚未同步标志 */

atomic_t                 s_active;         /* 活动引用计数 */

void                     *s_security;      /* 安全模块 */

struct list_head         s_dirty;          /* 脏节点链表 */

struct list_head         s_io;             /* 回写链表 */

struct hlist_head        s_anon;           /* 匿名目录项 */

struct list_head         s_files;          /* 被分配文件链表 */

struct block_device      *s_bdev;          /* 相关块设备 */

struct list_head         s_instances;      /* 该类型文件系统 */

struct quota_info        s_dquot;          /* 限额相关选项 */

char                     s_id[32];         /* 文本名字 */

void                     *s_fs_info;       /* 文件系统特殊信号 */

struct semaphore         s_vfs_rename_sem; /* 重命名信号量 */

};

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值