zoukankan      html  css  js  c++  java
  • 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);

  • 相关阅读:
    字符串替换
    Problem E: Automatic Editing
    正则表达式学习(1)
    python中的enumerate使用
    使用bottle进行web开发(9):文件上传;json传递
    使用bottle进行web开发(8):get的参数传递,form里的额数据传递等
    dict的setdefault(学习bottle源代码)
    使用bottle进行web开发(6):Response 对象
    使用bottle进行web开发(5):Generating Content
    使用bottle进行web开发(4):HTTPError
  • 原文地址:https://www.cnblogs.com/sunnycindy/p/9133742.html
Copyright © 2011-2022 走看看