• FS 数据结构


    linux-5.14.3/fs/fat/namei_vfat.c

    static struct dentry *vfat_mount(struct file_system_type *fs_type,
                   int flags, const char *dev_name,
                   void *data)
    {
        return mount_bdev(fs_type, flags, dev_name, data, vfat_fill_super);
    }
    
    static struct file_system_type vfat_fs_type = {
        .owner        = THIS_MODULE,
        .name        = "vfat",
        .mount        = vfat_mount,
        .kill_sb    = kill_block_super,
        .fs_flags    = FS_REQUIRES_DEV | FS_ALLOW_IDMAP,
    };
    MODULE_ALIAS_FS("vfat");
    
    static int __init init_vfat_fs(void)
    {
        return register_filesystem(&vfat_fs_type);
    }
    
    static void __exit exit_vfat_fs(void)
    {
        unregister_filesystem(&vfat_fs_type);
    }
    
    MODULE_LICENSE("GPL");
    MODULE_DESCRIPTION("VFAT filesystem support");
    MODULE_AUTHOR("Gordon Chaffee");
    
    module_init(init_vfat_fs)
    module_exit(exit_vfat_fs)

    linux-5.14.3/fs/filesystems.c

    /*
     * Handling of filesystem drivers list.
     * Rules:
     *    Inclusion to/removals from/scanning of list are protected by spinlock.
     *    During the unload module must call unregister_filesystem().
     *    We can access the fields of list element if:
     *        1) spinlock is held or
     *        2) we hold the reference to the module.
     *    The latter can be guaranteed by call of try_module_get(); if it
     *    returned 0 we must skip the element, otherwise we got the reference.
     *    Once the reference is obtained we can drop the spinlock.
     */
    
    static struct file_system_type *file_systems;



    struct mount {
      struct vfsmount   mnt
      struct dentry    *mnt_mountpoint
    }
    
    struct dentry {
      struct qstr         d_name;
      struct super_block *d_sb;
      ......
    }
    
    struct vfsmount {
      struct dentry      *mnt_root;
      struct super_block *mnt_sb;
      ......
    }
    
    
    struct super_block {
      struct file_system_type    *s_type;
      const struct super_operations    *s_op;
      struct dentry        *s_root;
      ......
    }
    3.
    /* super_block => dentry => vfsmount => mount */
    vfs_kern_mount()
    struct dentry *root = mount_fs(type, flags, name, data);

  • 相关阅读:
    JVM的生命周期、体系结构、内存管理和垃圾回收机制
    JVM的ClassLoader过程分析
    MySQL Cluster配置概述
    tomcat下bin文件夹下shell文件分析
    Eclipse环境下使用Maven注意事项
    mysql服务器的字符集
    判断文件中是否存在中文字符
    Tomcat/JSP中文编码配置
    Java内存泄露的原因
    Python 开发轻量级爬虫08
  • 原文地址:https://www.cnblogs.com/sunnycindy/p/9133742.html
Copyright © 2020-2023  润新知