|
libxr
1.0
Want to be the best embedded framework
|
轻量级内存文件系统 / Lightweight in-memory file system More...
#include <ramfs.hpp>
Data Structures | |
| class | Custom |
| 用户自定义节点,RamFS 仅负责命名和查找 / User-defined node; RamFS only stores and finds it by name More... | |
| class | Dir |
| 目录节点,管理直属子节点 / Directory node that owns a child namespace More... | |
| class | File |
| 内存文件或可执行文件 / Memory file or executable file More... | |
| class | FsNode |
| 文件系统节点基类 / Base class for all RamFS nodes More... | |
Public Types | |
| enum class | FsNodeType : uint8_t { FILE , DIR , CUSTOM } |
| 文件系统节点类型 / File-system node type More... | |
Public Member Functions | |
| RamFS (const char *name="ramfs") | |
构造 RamFS,并创建根目录和 bin 目录 / Construct RamFS with root and bin directories | |
| void | Add (File &file) |
| 添加文件节点到根目录 / Add a file node to the root directory | |
| void | Add (Dir &dir) |
| 添加目录节点到根目录 / Add a directory node to the root directory | |
| void | Add (Custom &custom) |
| 添加自定义节点到根目录 / Add a custom node to the root directory | |
| File * | FindFile (const char *name) |
| 从整个 RamFS 递归查找文件 / Find a file recursively from the RamFS root | |
| Dir * | FindDir (const char *name) |
| 从整个 RamFS 递归查找目录 / Find a directory recursively from the RamFS root | |
| Custom * | FindCustom (const char *name) |
| 从整个 RamFS 递归查找自定义节点 / Find a custom node recursively from the RamFS root | |
Static Public Member Functions | |
| template<typename DataType > | |
| static File | CreateFile (const char *name, DataType &raw) |
| 创建引用外部数据的文件 / Create a file referencing external data | |
| template<typename ArgType > | |
| static File | CreateFile (const char *name, int(*exec)(ArgType arg, int argc, char **argv), ArgType &&arg) |
| 创建可执行文件 / Create an executable file | |
| template<typename ArgType > | |
| static File | CreateCommand (const char *name, int(*exec)(ArgType arg, int argc, char **argv), ArgType &&arg) |
| 创建命令兼容入口,返回可执行文件 / Create a command-compatible executable file | |
| static Dir | CreateDir (const char *name) |
| 创建目录节点 / Create a directory node | |
Data Fields | |
| Dir | root_ |
| 根目录 / Root directory | |
| Dir | bin_ |
| 可执行文件目录 / Executable-file directory | |
Private Types | |
| enum class | FileType : uint8_t { READ_ONLY , READ_WRITE , EXEC } |
| using | Tree = RBTree<const char*> |
Static Private Member Functions | |
| static int | CompareStr (const char *const &a, const char *const &b) |
| static char * | DuplicateName (const char *name) |
轻量级内存文件系统 / Lightweight in-memory file system
RamFS 组织外部内存文件、可执行文件、目录和自定义节点 / RamFS organizes external-memory files, executable files, directories, and custom nodes. 文件数据由调用方持有 / File payload storage is owned by the caller.
|
private |
|
strongprivate |
|
strong |
| RamFS::RamFS | ( | const char * | name = "ramfs" | ) |
构造 RamFS,并创建根目录和 bin 目录 / Construct RamFS with root and bin directories
| name | 根目录名称 / Root directory name |
Definition at line 5 of file ramfs.cpp.
|
inline |
|
inline |
|
inline |
|
staticprivate |
|
inlinestatic |
创建命令兼容入口,返回可执行文件 / Create a command-compatible executable file
| ArgType | 执行上下文参数类型 / Execution context argument type |
| name | 文件名 / File name |
| exec | 执行函数 / Execution function |
| arg | 执行上下文参数 / Execution context argument |
Definition at line 452 of file ramfs.hpp.
|
inlinestatic |
|
inlinestatic |
创建引用外部数据的文件 / Create a file referencing external data
| DataType | 外部数据类型 / External data type |
| name | 文件名 / File name |
| raw | 外部数据引用 / External data reference |
Definition at line 384 of file ramfs.hpp.
|
inlinestatic |
创建可执行文件 / Create an executable file
| ArgType | 执行上下文参数类型 / Execution context argument type |
| name | 文件名 / File name |
| exec | 执行函数 / Execution function |
| arg | 执行上下文参数 / Execution context argument |
Definition at line 415 of file ramfs.hpp.
|
staticprivate |
|
inline |
从整个 RamFS 递归查找自定义节点 / Find a custom node recursively from the RamFS root
| name | 节点名称 / Node name |
Definition at line 506 of file ramfs.hpp.
|
inline |
从整个 RamFS 递归查找目录 / Find a directory recursively from the RamFS root
| name | 目录名 / Directory name |
Definition at line 498 of file ramfs.hpp.
|
inline |
| Dir LibXR::RamFS::bin_ |