Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(filesystem): 引入Umount系统调用 #719

Merged
merged 18 commits into from
Apr 15, 2024

Conversation

Samuka007
Copy link
Member

引入了

  • umount2 不完全的实现了文件系统卸载:
    忽略文件系统是否正在被占用
  • DName 实现了Inode原地拿到自己的目录名
  • MountList 实现了挂载点记录
  • VFS下
    • dname
    • dparent
    • absolute_path
    • umount
    • mkdir
    • mount_from
  • 新的注释风格

优化了

  • VFS 初始化
  • do_mkdir不符合预期的行为
  • ramfs与fatfs使用DName索引
  • mount的行为

删除了

  • 多余的rename api
  • 吾的尊名

下一步

  • 添加inode cache 以优化基于inode_id的查询的速度
  • proc下导出挂载点的记录

以上。

@dragonosbot
Copy link

感谢您的pull request,欢迎加入!🎉 DragonOS社区很兴奋地期待审核您的更改,您将在接下来的两周内收到 @fslongjin (or someone else) 的回复。💬😊

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-等待审查 and S-等待作者修改) stays updated, invoking these commands when appropriate:

  • @dragonosbot author: 审查结束后,PR的作者应检查评论并采取相应行动
  • @dragonosbot review: 作者已完成修改,将此PR提交给reviewer进行审阅,此PR将再次在审阅者队列中排队

@dragonosbot dragonosbot added A-fs Area: 文件系统 A-meta Area: Issues about the DragonOS repository. S-等待审查 Status: 等待assignee以及相关方的审查。 T-driver Relevant to the driver team, which will review and decide on the PR/issue. labels Apr 12, 2024
kernel/src/filesystem/fat/fs.rs Outdated Show resolved Hide resolved
kernel/src/filesystem/vfs/mod.rs Outdated Show resolved Hide resolved
@dragonosbot dragonosbot added O-x86_64 Target: x86_64 T-virtulization Relevant to the virtulization team, which will review and decide on the PR/issue. labels Apr 12, 2024
@dragonosbot
Copy link

设备驱动模型部分发生了更改,请进行审查

cc @fslongjin

@fslongjin
Copy link
Member

r? @Chiichen

@dragonosbot dragonosbot assigned Chiichen and unassigned fslongjin Apr 12, 2024
kernel/src/filesystem/vfs/mount.rs Outdated Show resolved Hide resolved
// 维护一个挂载点的记录,以支持特定于文件系统的索引
type MountListType = Option<Arc<RwLock<BTreeMap<MountPath, Arc<MountFS>>>>>;
pub struct MountList(MountListType);
static mut __MOUNTS_LIST: MountList = MountList(None);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感觉这样的写法很怪啊。把你这个MountListType封装到结构体内即可。然后全局Option<结构体>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单例设计的话这样作为对象更符合语义一点吧?即用的是MountList的成员函数而非某个模块下的pub函数

Copy link
Member

@fslongjin fslongjin Apr 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

单例设计的话这样作为对象更符合语义一点吧?即用的是MountList的成员函数而非某个模块下的pub函数

我记得rust语言圣经里面有说,尽量不要用type来定义类型,而要封装成strut

主要是后面如果你想加一些成员变量啊,或者是实现一些所谓的成员方法之类的话,这样的写法就很难搞。其他人维护的时候可能就出于省事,就会直接写一些散装函数了

@Chiichen Chiichen changed the title 引入Umount系统调用 feat(filesystem): 引入Umount系统调用 Apr 14, 2024
///
/// ## Safety(安全性)
///
/// 此函数为`unsafe`函数,因为它操作了`RwLock`,并且在初始化时可能会导致数据竞争。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个函数不是unsafe的,不用标safety

@fslongjin fslongjin merged commit 1074eb3 into DragonOS-Community:master Apr 15, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-fs Area: 文件系统 A-meta Area: Issues about the DragonOS repository. O-x86_64 Target: x86_64 S-等待审查 Status: 等待assignee以及相关方的审查。 T-driver Relevant to the driver team, which will review and decide on the PR/issue. T-virtulization Relevant to the virtulization team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants