-
-
Notifications
You must be signed in to change notification settings - Fork 168
feat(loop-device):实现Dragonos对loop的支持 #1261
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
base: master
Are you sure you want to change the base?
Conversation
da1ac6a to
f7e4c02
Compare
f7e4c02 to
5cbe962
Compare
e9ebe47 to
be65aaa
Compare
= 添加loopdevice的四种状态
- 添加loop_add和loop_remove函数 - 添加loop_control_ioctl的loop文件私有信息,发现data可以代替 - 待完成loop_ctl的read 和write
- 修改gendisk中的默认行为,使得read和write能传递到loop_device中 - 完成loop_device的正确挂载和写入数据的行为
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.
Pull Request Overview
This PR upgrades the Rust toolchain from nightly-2024-11-05 to nightly-2025-08-10 and introduces a loop device driver implementation for DragonOS.
Key changes include:
- Toolchain version update across all Makefiles and configuration files
- New loop device driver with complete device management infrastructure
- Integration of loop devices into the DevFS and block device management systems
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| user/apps/*/Makefile | Updated Rust toolchain version from nightly-2024-11-05 to nightly-2025-08-10 |
| tools/nix-dev-shell/flake.nix | Updated Rust toolchain version in Nix dev shell configuration |
| tools/Makefile | Updated cargo toolchain version for check command |
| build-scripts/Makefile | Updated cargo toolchain version for build and check commands |
| kernel/src/driver/base/block/loop_device.rs | New file implementing loop device driver with control device, manager, and device structures |
| kernel/src/driver/base/block/mod.rs | Added loop_device module and removed blank line |
| kernel/src/driver/base/block/manager.rs | Implemented unregister functionality for block devices |
| kernel/src/driver/base/block/gendisk/mod.rs | Added read/write support, dynamic metadata, and ioctl forwarding to underlying loop devices |
| kernel/src/driver/base/device/device_number.rs | Added LOOP_MAJOR constant (7) for loop devices |
| kernel/src/filesystem/vfs/file.rs | Added Loop variant to FilePrivateData enum with typo in comment |
| kernel/src/filesystem/devfs/mod.rs | Added special handling for loop-control and loop* devices in registration and removal |
| user/apps/c_unitest/test_loop.c | New test file for loop device functionality |
| config/app-blocklist.toml | Blocked NovaShell app with typo in toolchain version |
Comments suppressed due to low confidence (1)
kernel/src/driver/base/block/loop_device.rs:1
- Inconsistent indentation: line 47 has incorrect spacing (3 spaces instead of 4) compared to line 46.
use crate::{
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- feat: supplement test_loop
- add docs - delete some useless code - cargo fmt
- 修改一些注释,使其更符合rust注释规范
- 修正注释为rust语言规范
…nto feat/loop-device
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.
Pull Request Overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let dname = gendisk.dname()?; | ||
| devfs_unregister(dname.as_ref(), gendisk)?; | ||
| } | ||
| Ok(()) |
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.
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.
base目录是放置那种通用组件,比如gendisk之类的。
loop设备应当单独开个目录。在driver/block下面
- 添加多线程读写并发测试
- 添加多线程读写并发测试
…nto feat/loop-device
…nto feat/loop-device
|
@claude review this pr in chinese |
|
Claude finished @fslongjin's task —— View job PR审查进度已完成PR #1261的审查 待办事项清单:
审查完成! 以下是详细的中文审查反馈: 总体评价这个PR实现了DragonOS对loop设备的支持,包括loop设备驱动、控制设备、设备管理等完整功能。代码结构基本合理,功能实现较为完整。然而,存在一些代码质量、资源管理和规范符合性问题需要改进。 主要问题与改进建议1. 代码规范与注释格式问题文件:
/// 创建一个未绑定文件的 loop 设备实例
///
/// # 参数
/// - `devname`: 设备名称
/// - `minor`: 次设备号
///
/// # 返回值
/// - `Some(Arc<Self>)`: 成功创建的 loop 设备
/// - `None`: 内存不足或创建失败
pub fn new_empty_loop_device(devname: DevName, id: usize, minor: u32) -> Option<Arc<Self>> {2. 未使用代码和字段文件:
3. 验证逻辑重复文件:
4. 资源管理问题文件:
5. ID管理和设备命名文件:
6. 常量定义问题文件:
7. LoopControlDevice配置问题文件:
次要问题
总结该PR功能实现较为完整,但在代码质量、资源管理和规范符合性方面需要改进。建议重点解决资源管理回调机制、代码规范化和重复逻辑重构等问题。这些问题解决后,loop设备功能将更加健壮和可维护。 Claude finished @fslongjin's task |

No description provided.