mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-21 11:56:34 +00:00
doc: Add ai doc translate tool and add English doc. (#1168)
- add tools/doc_translator.py - translated docs into English Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
16
docs/locales/en/kernel/filesystem/vfs/api.md
Normal file
16
docs/locales/en/kernel/filesystem/vfs/api.md
Normal file
@ -0,0 +1,16 @@
|
||||
:::{note}
|
||||
**AI Translation Notice**
|
||||
|
||||
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
|
||||
|
||||
- Source document: kernel/filesystem/vfs/api.md
|
||||
|
||||
- Translation time: 2025-05-19 01:41:12
|
||||
|
||||
- Translation model: `Qwen/Qwen3-8B`
|
||||
|
||||
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
|
||||
|
||||
:::
|
||||
|
||||
# VFS API Documentation
|
72
docs/locales/en/kernel/filesystem/vfs/design.md
Normal file
72
docs/locales/en/kernel/filesystem/vfs/design.md
Normal file
@ -0,0 +1,72 @@
|
||||
:::{note}
|
||||
**AI Translation Notice**
|
||||
|
||||
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
|
||||
|
||||
- Source document: kernel/filesystem/vfs/design.md
|
||||
|
||||
- Translation time: 2025-05-19 01:41:33
|
||||
|
||||
- Translation model: `Qwen/Qwen3-8B`
|
||||
|
||||
Please report issues via [Community Channel](https://github.com/DragonOS-Community/DragonOS/issues)
|
||||
|
||||
:::
|
||||
|
||||
:::{note}
|
||||
Author of this article: Long Jin
|
||||
|
||||
Email: <longjin@DragonOS.org>
|
||||
:::
|
||||
|
||||
# Design
|
||||
|
||||
  The architecture design of VFS is shown in the following diagram:
|
||||
|
||||
```text
|
||||
┌─────────┐
|
||||
│ │
|
||||
│ read │
|
||||
File │ │
|
||||
│ write │
|
||||
│ │ │
|
||||
│ │ ioctl │
|
||||
│ │ │
|
||||
│ │ lseek │
|
||||
│ │ │
|
||||
│ │ etc.. │
|
||||
│ └─────────┘
|
||||
│
|
||||
▼ ┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
MountFS │ Maintain the mount tree and handle the mounting of file systems. │
|
||||
│ │ In particular, it handles the "crossing file system boundaries" condition │
|
||||
│ │ while doing "lookup" or "find" operations. │
|
||||
│ └──────────────────────────────────────────────────────────────────────────────┘
|
||||
│
|
||||
│
|
||||
│
|
||||
Filesystems: │
|
||||
│
|
||||
▼ ┌────────────────────────────────────────────────────────────────────┐
|
||||
xxxFSInode │ Implement corresponding operations based on different file systems │
|
||||
└────────────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 1. File
|
||||
  The File structure is the most basic abstraction in VFS, representing an opened file. Whenever a process opens a file, a File structure is created to maintain the state information of that file.
|
||||
|
||||
## 2. Traits
|
||||
|
||||
  For each specific file system, the following traits must be implemented:
|
||||
|
||||
- FileSystem: Indicates that a struct is a file system
|
||||
- IndexNode: Indicates that a struct is an index node
|
||||
|
||||
  Generally, there is a one-to-one relationship between FileSystem and IndexNode, meaning that one file system corresponds to one type of IndexNode. However, for some special file systems, such as DevFS, different IndexNodes may exist based on different device types. Therefore, there is a one-to-many relationship between FileSystem and IndexNode.
|
||||
|
||||
## 3. MountFS
|
||||
|
||||
  Although MountFS implements the FileSystem and IndexNode traits, it is not itself a "file system," but rather a mechanism used to mount different file systems onto the same file system tree.
|
||||
All file systems that need to be mounted onto the file system tree must go through MountFS to complete the mounting process. In other words, each file system structure in the mount tree is wrapped with a MountFS structure.
|
||||
|
||||
  For most operations, MountFS simply forwards the operation to the specific file system without any processing. At the same time, to support cross-file system operations, such as searching in a directory tree, each lookup or find operation will go through the corresponding method of MountFSInode to determine whether the current inode is a mount point and handle it specially. If the operation is found to cross the boundary of a specific file system, MountFS will forward the operation to the next file system and perform an inode replacement. This functionality is implemented by wrapping a regular Inode structure with a MountFSInode structure.
|
33
docs/locales/en/kernel/filesystem/vfs/index.rst
Normal file
33
docs/locales/en/kernel/filesystem/vfs/index.rst
Normal file
@ -0,0 +1,33 @@
|
||||
.. note:: AI Translation Notice
|
||||
|
||||
This document was automatically translated by `Qwen/Qwen3-8B` model, for reference only.
|
||||
|
||||
- Source document: kernel/filesystem/vfs/index.rst
|
||||
|
||||
- Translation time: 2025-05-19 01:41:14
|
||||
|
||||
- Translation model: `Qwen/Qwen3-8B`
|
||||
|
||||
|
||||
Please report issues via `Community Channel <https://github.com/DragonOS-Community/DragonOS/issues>`_
|
||||
|
||||
VFS Virtual File System
|
||||
====================================
|
||||
|
||||
In DragonOS, VFS acts as an adapter, hiding the differences between specific file systems and providing a unified file operation interface abstraction to the outside.
|
||||
|
||||
VFS is the core of the file system in DragonOS. It provides a set of unified file system interfaces, enabling DragonOS to support various different file systems. The main functions of VFS include:
|
||||
|
||||
- Providing a unified file system interface
|
||||
- Providing mount and unmount mechanisms for file systems (MountFS)
|
||||
- Providing file abstraction (File)
|
||||
- Providing file system abstraction (FileSystem)
|
||||
- Providing IndexNode abstraction
|
||||
- Providing caching and synchronization mechanisms for file systems (not yet implemented)
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
:caption: Directory
|
||||
|
||||
design
|
||||
api
|
Reference in New Issue
Block a user