-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
Conversation
感谢您的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 (
|
设备驱动模型部分发生了更改,请进行审查 cc @fslongjin |
r? @chiichen |
kernel/src/filesystem/vfs/mount.rs
Outdated
// 维护一个挂载点的记录,以支持特定于文件系统的索引 | ||
type MountListType = Option<Arc<RwLock<BTreeMap<MountPath, Arc<MountFS>>>>>; | ||
pub struct MountList(MountListType); | ||
static mut __MOUNTS_LIST: MountList = MountList(None); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这样的写法很怪啊。把你这个MountListType
封装到结构体内即可。然后全局Option<结构体>
。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
单例设计的话这样作为对象更符合语义一点吧?即用的是MountList的成员函数而非某个模块下的pub函数
There was a problem hiding this comment.
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
主要是后面如果你想加一些成员变量啊,或者是实现一些所谓的成员方法之类的话,这样的写法就很难搞。其他人维护的时候可能就出于省事,就会直接写一些散装函数了
kernel/src/filesystem/vfs/mount.rs
Outdated
/// | ||
/// ## Safety(安全性) | ||
/// | ||
/// 此函数为`unsafe`函数,因为它操作了`RwLock`,并且在初始化时可能会导致数据竞争。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个函数不是unsafe的,不用标safety
* feat(filesystem): 引入Umount系统调用 * 将所有ENOSYS误用更正 * 修复了一个使同一个挂载点可以挂载2个文件系统的bug * 统一注释,增强程序稳定性,统一接口。注意:Umount时在fatfs的路径要使用大写,此受限于当前文件系统设计。
引入了
忽略文件系统是否正在被占用
新的注释风格优化了
删除了
吾的尊名下一步
以上。