Skip to content

Conversation

@xboHodx
Copy link
Contributor

@xboHodx xboHodx commented Nov 27, 2025

  • ModeType 重命名为 InodeMode,明确其为inode权限位
  • FileMode 重命名为 FileFlags,明确其为文件打开标志(O_RDONLY等)
  • 新增 FileMode 结构体,对应Linux内核的 file.f_mode,表示内核专用访问模式(FMODE_READ/FMODE_WRITE/FMODE_LSEEK等)
  • 新增 InodeFlags 结构体,支持 S_SYNC、S_APPEND、S_IMMUTABLE 等inode标志
  • 修复管道 poll 函数中的标志判断逻辑

Copilot AI review requested due to automatic review settings November 27, 2025 12:53
@github-actions github-actions bot added ambiguous The title of PR/issue doesn't match the format enhancement New feature or request labels Nov 27, 2025
Copilot finished reviewing on behalf of xboHodx November 27, 2025 12:54
Copy link
Contributor

Copilot AI left a 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 performs a comprehensive refactoring of file-related type names in the VFS layer to better align with Linux kernel semantics:

  • Renames FileMode to FileFlags (user-space open flags like O_RDONLY, O_WRONLY, O_RDWR)
  • Introduces a new FileMode type representing kernel-internal f_mode flags (FMODE_READ, FMODE_WRITE, etc.)
  • Renames ModeType to InodeMode (inode permission bits like 0o755)
  • Fixes pipe poll permission checking logic to use proper helper methods instead of direct flag checks

Key Changes

  • New FileMode::open_fmode() function converts FileFlags to internal FileMode representation
  • Enhanced permission checking in File::readable() and File::writeable() methods
  • Pipe poll now uses is_write_only() and is_read_only() helper methods for clearer access mode checks

Reviewed changes

Copilot reviewed 100 out of 100 changed files in this pull request and generated no comments.

Show a summary per file
File Description
kernel/src/filesystem/vfs/file.rs Core refactoring: adds new FileMode type, renames FileMode to FileFlags, implements conversion logic and permission checks
kernel/src/ipc/pipe.rs Renames mode field to file_flags, fixes poll permission check logic using new helper methods
kernel/src/filesystem/vfs/syscall/mod.rs Renames ModeType to InodeMode throughout syscall interfaces
kernel/src/filesystem/vfs/mod.rs Updates IndexNode trait methods to use FileFlags parameter, updates InodeMode conversions
All other files Mechanical renames of FileMode→FileFlags and ModeType→InodeMode across device drivers, filesystems, and system components

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- 新增O_SYNC/O_DSYNC标志处理及数据同步逻辑
- 实现S_APPEND/S_IMMUTABLE标志的权限检查
- 添加datasync()接口支持O_DSYNC语义
- 修复O_APPEND模式下的竞态条件问题
@xboHodx xboHodx changed the title [TBD]feat: 重命名原有的FileMode为FileFlags;新增FileMode类型 feat(vfs): 重构文件系统标志体系,区分打开标志与访问模式 Dec 1, 2025
@github-actions github-actions bot removed the ambiguous The title of PR/issue doesn't match the format label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant