Implement
- userland build in nix, with cross platform support and
non-previleged disk gen
- qemu start command in nix
- nix develop envrionment for make kernel
- document build environment defined by nix
Next Steps
- 减小rootfs占用nix store的体积
- deb包的打包兼容用的函数
- 更加灵活的构建依赖注入
- 保留先前系统内修改的内容
- nix rootfs build与qemu启动适配 vnc模式
- 适配 riscv64 构建
- Arm MacOS上的开发兼容
* feat(filesystem): Enhance symlink handling and VFS behavior
- Updated tmpfs to require page cache for both regular files and symlinks to ensure proper read/write operations.
- Increased the maximum symlink follow count to 40, aligning with Linux 6.6 standards.
- Improved symlink handling in VFS to correctly follow symlinks based on path conditions and trailing slashes.
- Added validation for conflicting flags in vfs_statx to prevent invalid operations.
- Refined syscall implementations for symlink and lstat to adhere to Linux semantics, ensuring correct behavior for symlink creation and path resolution.
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(vfs): 修正符号链接跟随次数的处理逻辑
- 将 VFS_MAX_FOLLOW_SYMLINK_TIMES 从 40 调整为 41,以保留 0 的禁用语义并实现最多
40 次跟随的 Linux 语义
- 重构路径解析逻辑,明确区分 max_follow_times 为
0(完全禁用跟随)、1(计数耗尽)及 >=2(允许继续跟随)三种情况
- 确保在计数耗尽(max_follow_times == 1)且需要跟随时正确返回 ELOOP 错误
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
- Set default umask to 0022 for new filesystem instances
- Add apply_umask_for_create() and chmod_preserve_type() helper functions
- Implement proper permission checks for file creation and chmod operations
- Fix fchmod syscall to work correctly and reject O_PATH file descriptors
- Add open_create_test to gvisor test suite
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(filesystem): Implement EventFd filesystem and enhance VFS inode capabilities
- Introduced EventFdFs as a new pseudo-filesystem to support eventfd file descriptors, including methods for root inode retrieval and filesystem information.
- Enhanced IndexNode trait with is_stream, supports_seek, supports_pread, and supports_pwrite methods to streamline file operation semantics for stream-like files.
- Updated file handling in VFS to utilize new inode capabilities, ensuring correct behavior for pread, pwrite, and lseek operations.
- Added eventfd_test to the syscall whitelist for testing purposes.
This implementation aligns with Linux semantics for eventfd and improves the overall VFS design by consolidating stream behavior checks.
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(vfs): 修复pread/pwrite中O_PATH和流式对象的错误处理顺序
- 调整O_PATH文件描述符的错误处理顺序,确保优先返回EBADF
- 为流式对象(FMODE_STREAM)添加ESPIPE错误处理,避免权限检查导致的误报
- 分离权限检查逻辑,确保错误码符合Linux语义
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(vfs): Implement append lock manager for file operations
- Introduced an `AppendLockManager` to ensure atomicity for append operations across filesystems, preventing data corruption in concurrent write scenarios.
- Updated file write methods to utilize the new append lock mechanism, ensuring that appending to files respects the latest end-of-file position.
- Enhanced `write_append` and `pwrite_append` methods to support forced append semantics, aligning with Linux behavior.
- Initialized the append lock manager during VFS initialization to ensure it is ready before any file write operations.
This addition improves the reliability of file operations in a multi-threaded environment, particularly for append scenarios.
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(kernel): 添加jhash库并用于append_lock的哈希计算
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(procfs): Add /proc/[pid]/mountinfo and /proc/[pid]/maps support
- Introduced new ProcFileType variants for /proc/[pid]/mountinfo and /proc/[pid]/maps.
- Implemented content generation for /proc/[pid]/mountinfo and /proc/[pid]/maps to align with Linux semantics.
- Updated ProcFS inode creation to include these new files for each process.
- Enhanced path handling in the VFS to ensure correct resolution based on process-specific root and current working directory.
This addition improves the process filesystem's functionality and compatibility with Linux behavior.
* feat(filesystem): Enhance page cache management in tmpfs
- Added an unevictable flag to the PageCache structure, allowing pages to be marked as unevictable to prevent reclamation.
- Updated the TmpfsInode structure to integrate page cache management, replacing direct data manipulation with page cache operations for read and write methods.
- Refactored truncate and resize methods to utilize the new page cache functionality, ensuring consistency and improved memory management.
* feat(filesystem): Enhance tmpfs functionality and VFS constraints
- Implemented support for readahead in tmpfs, allowing for optimized data retrieval.
- Added checks for filename length across various VFS operations to prevent errors related to excessively long names.
- Updated the tmpfs implementation to handle read and write operations directly through the page cache, improving memory management.
- Enhanced rename functionality to ensure type compatibility and empty directory checks during operations.
- Increased maximum path length and defined maximum single filename length for better filesystem compliance.
* refactor(fs): 重构tmpfs重命名逻辑并修复MountFSInode的move_to委托
- 将tmpfs跨目录移动逻辑提取为独立函数`tmpfs_move_entry_between_dirs`
- 优化锁顺序以避免死锁,按inode_id顺序锁定目录
- 修复MountFSInode::move_to中目标inode解包问题,确保正确委托给底层文件系统
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(filesystem): Implement zero-page creation for tmpfs and enhance page fault handling
- Added `create_zero_pages` method to `InnerPageCache` for efficient zero-page creation, optimizing memory usage in tmpfs.
- Updated `Tmpfs` to utilize the new zero-page creation during read and write operations, ensuring seamless handling of page faults.
- Enhanced `PageFaultHandler` with `pagecache_fault_zero` to manage page faults specifically for tmpfs, allowing for direct page cache access without disk I/O.
This improves the performance and reliability of memory file systems by reducing unnecessary allocations and ensuring proper page management.
* refactor(syscall): Rename check_and_clone_cstr to vfs_check_and_clone_cstr for clarity
- Updated the user access module to introduce vfs_check_and_clone_cstr, enhancing clarity in its purpose for VFS operations.
- Refactored sys_openat and utimensat to utilize the new vfs_check_and_clone_cstr function, ensuring consistent handling of C string paths across the filesystem.
---------
Signed-off-by: longjin <longjin@DragonOS.org>
* fix(net): udp getsockname/getpeername
* feat(ci): add test whitelist for new available inet syscall
---------
Co-authored-by: longjin <longjin@DragonOS.org>
* feat(filesystem): Add tmpfs support and integrate with devfs
- Introduced a new tmpfs module for temporary file storage in memory.
- Updated devfs to mount /dev/shm as tmpfs, aligning with Linux semantics.
- Enhanced vfs module to include TMPFS_MAGIC for tmpfs identification.
- Added necessary methods and structures for tmpfs functionality, including inode management and file operations.
Signed-off-by: longjin <longjin@DragonOS.org>
* feat(filesystem): Implement atomic size management for tmpfs
- Added atomic operations to manage the current size of the tmpfs filesystem, including methods to increase and decrease size based on file operations.
- Integrated size management into inode operations, ensuring that size updates are thread-safe and adhere to specified limits.
- Enhanced the resize and truncate methods to adjust the filesystem size accordingly during file modifications.
Signed-off-by: longjin <longjin@DragonOS.org>
---------
Signed-off-by: longjin <longjin@DragonOS.org>